Merge pull request #139 from TheBlueMatt/main
[ldk-java] / ts / bindings.c
1 #define LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ LDKCVec_TransactionOutputsZ
2 #define CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free CVec_TransactionOutputsZ_free
3 #include "js-wasm.h"
4 #include <stdatomic.h>
5 #include <lightning.h>
6
7 // These should be provided...somehow...
8 void *memset(void *s, int c, size_t n);
9 void *memcpy(void *dest, const void *src, size_t n);
10 int memcmp(const void *s1, const void *s2, size_t n);
11
12 extern void __attribute__((noreturn)) abort(void);
13 static inline void assert(bool expression) {
14         if (!expression) { abort(); }
15 }
16
17 uint32_t __attribute__((export_name("test_bigint_pass_deadbeef0badf00d"))) test_bigint_pass_deadbeef0badf00d(uint64_t val) {
18         return val == 0xdeadbeef0badf00dULL;
19 }
20
21
22 void *malloc(size_t size);
23 void free(void *ptr);
24
25 #define MALLOC(a, _) malloc(a)
26 #define do_MALLOC(a, _b, _c) malloc(a)
27 #define FREE(p) if ((unsigned long)(p) > 4096) { free(p); }
28 #define DO_ASSERT(a) (void)(a)
29 #define CHECK(a)
30 #define CHECK_ACCESS(p)
31 #define CHECK_INNER_FIELD_ACCESS_OR_NULL(v)
32
33 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
34 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
35 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
36 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
37
38 _Static_assert(sizeof(void*) == 4, "Pointers mut be 32 bits");
39
40 #define DECL_ARR_TYPE(ty, name) \
41         struct name##array { \
42                 uint64_t arr_len; /* uint32_t would suffice but we want to align uint64_ts as well */ \
43                 ty elems[]; \
44         }; \
45         typedef struct name##array * name##Array; \
46         static inline name##Array init_##name##Array(size_t arr_len, int lineno) { \
47                 name##Array arr = (name##Array)do_MALLOC(arr_len * sizeof(ty) + sizeof(uint64_t), #name" array init", lineno); \
48                 arr->arr_len = arr_len; \
49                 return arr; \
50         }
51
52 DECL_ARR_TYPE(int64_t, int64_t);
53 DECL_ARR_TYPE(uint64_t, uint64_t);
54 DECL_ARR_TYPE(int8_t, int8_t);
55 DECL_ARR_TYPE(int16_t, int16_t);
56 DECL_ARR_TYPE(uint32_t, uint32_t);
57 DECL_ARR_TYPE(void*, ptr);
58 DECL_ARR_TYPE(char, char);
59 typedef charArray jstring;
60
61 static inline jstring str_ref_to_ts(const char* chars, size_t len) {
62         charArray arr = init_charArray(len, __LINE__);
63         memcpy(arr->elems, chars, len);
64         return arr;
65 }
66 static inline LDKStr str_ref_to_owned_c(const jstring str) {
67         char* newchars = MALLOC(str->arr_len + 1, "String chars");
68         memcpy(newchars, str->elems, str->arr_len);
69         newchars[str->arr_len] = 0;
70         LDKStr res = {
71                 .chars = newchars,
72                 .len = str->arr_len,
73                 .chars_is_owned = true
74         };
75         return res;
76 }
77
78 typedef bool jboolean;
79
80 uint32_t __attribute__((export_name("TS_malloc"))) TS_malloc(uint32_t size) {
81         return (uint32_t)MALLOC(size, "JS-Called malloc");
82 }
83 void __attribute__((export_name("TS_free"))) TS_free(uint32_t ptr) {
84         FREE((void*)ptr);
85 }
86
87 jstring __attribute__((export_name("TS_get_ldk_c_bindings_version"))) TS_get_ldk_c_bindings_version() {
88         const char *res = check_get_ldk_bindings_version();
89         if (res == NULL) return NULL;
90         return str_ref_to_ts(res, strlen(res));
91 }
92 jstring __attribute__((export_name("TS_get_ldk_version"))) get_ldk_version() {
93         const char *res = check_get_ldk_version();
94         if (res == NULL) return NULL;
95         return str_ref_to_ts(res, strlen(res));
96 }
97 #include "version.c"
98 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
99
100 static inline void* untag_ptr(uint64_t ptr) {
101         if (ptr < 4096) return (void*)ptr;
102         if (sizeof(void*) == 4) {
103                 // For 32-bit systems, store pointers as 64-bit ints and use the 31st bit
104                 return (void*)(uintptr_t)ptr;
105         } else {
106                 // For 64-bit systems, assume the top byte is used for tagging, then
107                 // use bit 9 ^ bit 10.
108                 uint64_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
109                 uintptr_t p = (ptr & ~(1ULL << 55)) | (tenth_bit << 55);
110 #ifdef LDK_DEBUG_BUILD
111                 // On debug builds we also use the 11th bit as a debug flag
112                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
113                 CHECK(tenth_bit != eleventh_bit);
114                 p ^= 1ULL << 53;
115 #endif
116                 return (void*)p;
117         }
118 }
119 static inline bool ptr_is_owned(uint64_t ptr) {
120         if(ptr < 4096) return true;
121         if (sizeof(void*) == 4) {
122                 return ptr & (1ULL << 32);
123         } else {
124                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
125                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
126 #ifdef LDK_DEBUG_BUILD
127                 // On debug builds we also use the 11th bit as a debug flag
128                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
129                 CHECK(tenth_bit != eleventh_bit);
130 #endif
131                 return (ninth_bit ^ tenth_bit) ? true : false;
132         }
133 }
134 static inline uint64_t tag_ptr(const void* ptr, bool is_owned) {
135         if ((uintptr_t)ptr < 4096) return (uint64_t)ptr;
136         if (sizeof(void*) == 4) {
137                 return (((uint64_t)ptr) | ((is_owned ? 1ULL : 0) << 32));
138         } else {
139                 CHECK(sizeof(uintptr_t) == 8);
140                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
141                 uintptr_t t = (((uintptr_t)ptr) | (((is_owned ? 1ULL : 0ULL) ^ tenth_bit) << 55));
142 #ifdef LDK_DEBUG_BUILD
143                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
144                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
145                 CHECK(ninth_bit == tenth_bit);
146                 CHECK(ninth_bit == eleventh_bit);
147                 t ^= 1ULL << 53;
148 #endif
149                 CHECK(ptr_is_owned(t) == is_owned);
150                 CHECK(untag_ptr(t) == ptr);
151                 return t;
152         }
153 }
154
155 static inline LDKBolt11SemanticError LDKBolt11SemanticError_from_js(int32_t ord) {
156         switch (ord) {
157                 case 0: return LDKBolt11SemanticError_NoPaymentHash;
158                 case 1: return LDKBolt11SemanticError_MultiplePaymentHashes;
159                 case 2: return LDKBolt11SemanticError_NoDescription;
160                 case 3: return LDKBolt11SemanticError_MultipleDescriptions;
161                 case 4: return LDKBolt11SemanticError_NoPaymentSecret;
162                 case 5: return LDKBolt11SemanticError_MultiplePaymentSecrets;
163                 case 6: return LDKBolt11SemanticError_InvalidFeatures;
164                 case 7: return LDKBolt11SemanticError_InvalidRecoveryId;
165                 case 8: return LDKBolt11SemanticError_InvalidSignature;
166                 case 9: return LDKBolt11SemanticError_ImpreciseAmount;
167         }
168         abort();
169 }
170 static inline int32_t LDKBolt11SemanticError_to_js(LDKBolt11SemanticError val) {
171         switch (val) {
172                 case LDKBolt11SemanticError_NoPaymentHash: return 0;
173                 case LDKBolt11SemanticError_MultiplePaymentHashes: return 1;
174                 case LDKBolt11SemanticError_NoDescription: return 2;
175                 case LDKBolt11SemanticError_MultipleDescriptions: return 3;
176                 case LDKBolt11SemanticError_NoPaymentSecret: return 4;
177                 case LDKBolt11SemanticError_MultiplePaymentSecrets: return 5;
178                 case LDKBolt11SemanticError_InvalidFeatures: return 6;
179                 case LDKBolt11SemanticError_InvalidRecoveryId: return 7;
180                 case LDKBolt11SemanticError_InvalidSignature: return 8;
181                 case LDKBolt11SemanticError_ImpreciseAmount: return 9;
182                 default: abort();
183         }
184 }
185 static inline LDKBolt12SemanticError LDKBolt12SemanticError_from_js(int32_t ord) {
186         switch (ord) {
187                 case 0: return LDKBolt12SemanticError_AlreadyExpired;
188                 case 1: return LDKBolt12SemanticError_UnsupportedChain;
189                 case 2: return LDKBolt12SemanticError_UnexpectedChain;
190                 case 3: return LDKBolt12SemanticError_MissingAmount;
191                 case 4: return LDKBolt12SemanticError_InvalidAmount;
192                 case 5: return LDKBolt12SemanticError_InsufficientAmount;
193                 case 6: return LDKBolt12SemanticError_UnexpectedAmount;
194                 case 7: return LDKBolt12SemanticError_UnsupportedCurrency;
195                 case 8: return LDKBolt12SemanticError_UnknownRequiredFeatures;
196                 case 9: return LDKBolt12SemanticError_UnexpectedFeatures;
197                 case 10: return LDKBolt12SemanticError_MissingDescription;
198                 case 11: return LDKBolt12SemanticError_MissingSigningPubkey;
199                 case 12: return LDKBolt12SemanticError_InvalidSigningPubkey;
200                 case 13: return LDKBolt12SemanticError_UnexpectedSigningPubkey;
201                 case 14: return LDKBolt12SemanticError_MissingQuantity;
202                 case 15: return LDKBolt12SemanticError_InvalidQuantity;
203                 case 16: return LDKBolt12SemanticError_UnexpectedQuantity;
204                 case 17: return LDKBolt12SemanticError_InvalidMetadata;
205                 case 18: return LDKBolt12SemanticError_UnexpectedMetadata;
206                 case 19: return LDKBolt12SemanticError_MissingPayerMetadata;
207                 case 20: return LDKBolt12SemanticError_MissingPayerId;
208                 case 21: return LDKBolt12SemanticError_MissingPaths;
209                 case 22: return LDKBolt12SemanticError_InvalidPayInfo;
210                 case 23: return LDKBolt12SemanticError_MissingCreationTime;
211                 case 24: return LDKBolt12SemanticError_MissingPaymentHash;
212                 case 25: return LDKBolt12SemanticError_MissingSignature;
213         }
214         abort();
215 }
216 static inline int32_t LDKBolt12SemanticError_to_js(LDKBolt12SemanticError val) {
217         switch (val) {
218                 case LDKBolt12SemanticError_AlreadyExpired: return 0;
219                 case LDKBolt12SemanticError_UnsupportedChain: return 1;
220                 case LDKBolt12SemanticError_UnexpectedChain: return 2;
221                 case LDKBolt12SemanticError_MissingAmount: return 3;
222                 case LDKBolt12SemanticError_InvalidAmount: return 4;
223                 case LDKBolt12SemanticError_InsufficientAmount: return 5;
224                 case LDKBolt12SemanticError_UnexpectedAmount: return 6;
225                 case LDKBolt12SemanticError_UnsupportedCurrency: return 7;
226                 case LDKBolt12SemanticError_UnknownRequiredFeatures: return 8;
227                 case LDKBolt12SemanticError_UnexpectedFeatures: return 9;
228                 case LDKBolt12SemanticError_MissingDescription: return 10;
229                 case LDKBolt12SemanticError_MissingSigningPubkey: return 11;
230                 case LDKBolt12SemanticError_InvalidSigningPubkey: return 12;
231                 case LDKBolt12SemanticError_UnexpectedSigningPubkey: return 13;
232                 case LDKBolt12SemanticError_MissingQuantity: return 14;
233                 case LDKBolt12SemanticError_InvalidQuantity: return 15;
234                 case LDKBolt12SemanticError_UnexpectedQuantity: return 16;
235                 case LDKBolt12SemanticError_InvalidMetadata: return 17;
236                 case LDKBolt12SemanticError_UnexpectedMetadata: return 18;
237                 case LDKBolt12SemanticError_MissingPayerMetadata: return 19;
238                 case LDKBolt12SemanticError_MissingPayerId: return 20;
239                 case LDKBolt12SemanticError_MissingPaths: return 21;
240                 case LDKBolt12SemanticError_InvalidPayInfo: return 22;
241                 case LDKBolt12SemanticError_MissingCreationTime: return 23;
242                 case LDKBolt12SemanticError_MissingPaymentHash: return 24;
243                 case LDKBolt12SemanticError_MissingSignature: return 25;
244                 default: abort();
245         }
246 }
247 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_js(int32_t ord) {
248         switch (ord) {
249                 case 0: return LDKCOption_NoneZ_Some;
250                 case 1: return LDKCOption_NoneZ_None;
251         }
252         abort();
253 }
254 static inline int32_t LDKCOption_NoneZ_to_js(LDKCOption_NoneZ val) {
255         switch (val) {
256                 case LDKCOption_NoneZ_Some: return 0;
257                 case LDKCOption_NoneZ_None: return 1;
258                 default: abort();
259         }
260 }
261 static inline LDKChannelMonitorUpdateStatus LDKChannelMonitorUpdateStatus_from_js(int32_t ord) {
262         switch (ord) {
263                 case 0: return LDKChannelMonitorUpdateStatus_Completed;
264                 case 1: return LDKChannelMonitorUpdateStatus_InProgress;
265                 case 2: return LDKChannelMonitorUpdateStatus_UnrecoverableError;
266         }
267         abort();
268 }
269 static inline int32_t LDKChannelMonitorUpdateStatus_to_js(LDKChannelMonitorUpdateStatus val) {
270         switch (val) {
271                 case LDKChannelMonitorUpdateStatus_Completed: return 0;
272                 case LDKChannelMonitorUpdateStatus_InProgress: return 1;
273                 case LDKChannelMonitorUpdateStatus_UnrecoverableError: return 2;
274                 default: abort();
275         }
276 }
277 static inline LDKChannelShutdownState LDKChannelShutdownState_from_js(int32_t ord) {
278         switch (ord) {
279                 case 0: return LDKChannelShutdownState_NotShuttingDown;
280                 case 1: return LDKChannelShutdownState_ShutdownInitiated;
281                 case 2: return LDKChannelShutdownState_ResolvingHTLCs;
282                 case 3: return LDKChannelShutdownState_NegotiatingClosingFee;
283                 case 4: return LDKChannelShutdownState_ShutdownComplete;
284         }
285         abort();
286 }
287 static inline int32_t LDKChannelShutdownState_to_js(LDKChannelShutdownState val) {
288         switch (val) {
289                 case LDKChannelShutdownState_NotShuttingDown: return 0;
290                 case LDKChannelShutdownState_ShutdownInitiated: return 1;
291                 case LDKChannelShutdownState_ResolvingHTLCs: return 2;
292                 case LDKChannelShutdownState_NegotiatingClosingFee: return 3;
293                 case LDKChannelShutdownState_ShutdownComplete: return 4;
294                 default: abort();
295         }
296 }
297 static inline LDKConfirmationTarget LDKConfirmationTarget_from_js(int32_t ord) {
298         switch (ord) {
299                 case 0: return LDKConfirmationTarget_MempoolMinimum;
300                 case 1: return LDKConfirmationTarget_Background;
301                 case 2: return LDKConfirmationTarget_Normal;
302                 case 3: return LDKConfirmationTarget_HighPriority;
303         }
304         abort();
305 }
306 static inline int32_t LDKConfirmationTarget_to_js(LDKConfirmationTarget val) {
307         switch (val) {
308                 case LDKConfirmationTarget_MempoolMinimum: return 0;
309                 case LDKConfirmationTarget_Background: return 1;
310                 case LDKConfirmationTarget_Normal: return 2;
311                 case LDKConfirmationTarget_HighPriority: return 3;
312                 default: abort();
313         }
314 }
315 static inline LDKCreationError LDKCreationError_from_js(int32_t ord) {
316         switch (ord) {
317                 case 0: return LDKCreationError_DescriptionTooLong;
318                 case 1: return LDKCreationError_RouteTooLong;
319                 case 2: return LDKCreationError_TimestampOutOfBounds;
320                 case 3: return LDKCreationError_InvalidAmount;
321                 case 4: return LDKCreationError_MissingRouteHints;
322                 case 5: return LDKCreationError_MinFinalCltvExpiryDeltaTooShort;
323         }
324         abort();
325 }
326 static inline int32_t LDKCreationError_to_js(LDKCreationError val) {
327         switch (val) {
328                 case LDKCreationError_DescriptionTooLong: return 0;
329                 case LDKCreationError_RouteTooLong: return 1;
330                 case LDKCreationError_TimestampOutOfBounds: return 2;
331                 case LDKCreationError_InvalidAmount: return 3;
332                 case LDKCreationError_MissingRouteHints: return 4;
333                 case LDKCreationError_MinFinalCltvExpiryDeltaTooShort: return 5;
334                 default: abort();
335         }
336 }
337 static inline LDKCurrency LDKCurrency_from_js(int32_t ord) {
338         switch (ord) {
339                 case 0: return LDKCurrency_Bitcoin;
340                 case 1: return LDKCurrency_BitcoinTestnet;
341                 case 2: return LDKCurrency_Regtest;
342                 case 3: return LDKCurrency_Simnet;
343                 case 4: return LDKCurrency_Signet;
344         }
345         abort();
346 }
347 static inline int32_t LDKCurrency_to_js(LDKCurrency val) {
348         switch (val) {
349                 case LDKCurrency_Bitcoin: return 0;
350                 case LDKCurrency_BitcoinTestnet: return 1;
351                 case LDKCurrency_Regtest: return 2;
352                 case LDKCurrency_Simnet: return 3;
353                 case LDKCurrency_Signet: return 4;
354                 default: abort();
355         }
356 }
357 static inline LDKHTLCClaim LDKHTLCClaim_from_js(int32_t ord) {
358         switch (ord) {
359                 case 0: return LDKHTLCClaim_OfferedTimeout;
360                 case 1: return LDKHTLCClaim_OfferedPreimage;
361                 case 2: return LDKHTLCClaim_AcceptedTimeout;
362                 case 3: return LDKHTLCClaim_AcceptedPreimage;
363                 case 4: return LDKHTLCClaim_Revocation;
364         }
365         abort();
366 }
367 static inline int32_t LDKHTLCClaim_to_js(LDKHTLCClaim val) {
368         switch (val) {
369                 case LDKHTLCClaim_OfferedTimeout: return 0;
370                 case LDKHTLCClaim_OfferedPreimage: return 1;
371                 case LDKHTLCClaim_AcceptedTimeout: return 2;
372                 case LDKHTLCClaim_AcceptedPreimage: return 3;
373                 case LDKHTLCClaim_Revocation: return 4;
374                 default: abort();
375         }
376 }
377 static inline LDKIOError LDKIOError_from_js(int32_t ord) {
378         switch (ord) {
379                 case 0: return LDKIOError_NotFound;
380                 case 1: return LDKIOError_PermissionDenied;
381                 case 2: return LDKIOError_ConnectionRefused;
382                 case 3: return LDKIOError_ConnectionReset;
383                 case 4: return LDKIOError_ConnectionAborted;
384                 case 5: return LDKIOError_NotConnected;
385                 case 6: return LDKIOError_AddrInUse;
386                 case 7: return LDKIOError_AddrNotAvailable;
387                 case 8: return LDKIOError_BrokenPipe;
388                 case 9: return LDKIOError_AlreadyExists;
389                 case 10: return LDKIOError_WouldBlock;
390                 case 11: return LDKIOError_InvalidInput;
391                 case 12: return LDKIOError_InvalidData;
392                 case 13: return LDKIOError_TimedOut;
393                 case 14: return LDKIOError_WriteZero;
394                 case 15: return LDKIOError_Interrupted;
395                 case 16: return LDKIOError_Other;
396                 case 17: return LDKIOError_UnexpectedEof;
397         }
398         abort();
399 }
400 static inline int32_t LDKIOError_to_js(LDKIOError val) {
401         switch (val) {
402                 case LDKIOError_NotFound: return 0;
403                 case LDKIOError_PermissionDenied: return 1;
404                 case LDKIOError_ConnectionRefused: return 2;
405                 case LDKIOError_ConnectionReset: return 3;
406                 case LDKIOError_ConnectionAborted: return 4;
407                 case LDKIOError_NotConnected: return 5;
408                 case LDKIOError_AddrInUse: return 6;
409                 case LDKIOError_AddrNotAvailable: return 7;
410                 case LDKIOError_BrokenPipe: return 8;
411                 case LDKIOError_AlreadyExists: return 9;
412                 case LDKIOError_WouldBlock: return 10;
413                 case LDKIOError_InvalidInput: return 11;
414                 case LDKIOError_InvalidData: return 12;
415                 case LDKIOError_TimedOut: return 13;
416                 case LDKIOError_WriteZero: return 14;
417                 case LDKIOError_Interrupted: return 15;
418                 case LDKIOError_Other: return 16;
419                 case LDKIOError_UnexpectedEof: return 17;
420                 default: abort();
421         }
422 }
423 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
424         switch (ord) {
425                 case 0: return LDKLevel_Gossip;
426                 case 1: return LDKLevel_Trace;
427                 case 2: return LDKLevel_Debug;
428                 case 3: return LDKLevel_Info;
429                 case 4: return LDKLevel_Warn;
430                 case 5: return LDKLevel_Error;
431         }
432         abort();
433 }
434 static inline int32_t LDKLevel_to_js(LDKLevel val) {
435         switch (val) {
436                 case LDKLevel_Gossip: return 0;
437                 case LDKLevel_Trace: return 1;
438                 case LDKLevel_Debug: return 2;
439                 case LDKLevel_Info: return 3;
440                 case LDKLevel_Warn: return 4;
441                 case LDKLevel_Error: return 5;
442                 default: abort();
443         }
444 }
445 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
446         switch (ord) {
447                 case 0: return LDKNetwork_Bitcoin;
448                 case 1: return LDKNetwork_Testnet;
449                 case 2: return LDKNetwork_Regtest;
450                 case 3: return LDKNetwork_Signet;
451         }
452         abort();
453 }
454 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
455         switch (val) {
456                 case LDKNetwork_Bitcoin: return 0;
457                 case LDKNetwork_Testnet: return 1;
458                 case LDKNetwork_Regtest: return 2;
459                 case LDKNetwork_Signet: return 3;
460                 default: abort();
461         }
462 }
463 static inline LDKPaymentFailureReason LDKPaymentFailureReason_from_js(int32_t ord) {
464         switch (ord) {
465                 case 0: return LDKPaymentFailureReason_RecipientRejected;
466                 case 1: return LDKPaymentFailureReason_UserAbandoned;
467                 case 2: return LDKPaymentFailureReason_RetriesExhausted;
468                 case 3: return LDKPaymentFailureReason_PaymentExpired;
469                 case 4: return LDKPaymentFailureReason_RouteNotFound;
470                 case 5: return LDKPaymentFailureReason_UnexpectedError;
471         }
472         abort();
473 }
474 static inline int32_t LDKPaymentFailureReason_to_js(LDKPaymentFailureReason val) {
475         switch (val) {
476                 case LDKPaymentFailureReason_RecipientRejected: return 0;
477                 case LDKPaymentFailureReason_UserAbandoned: return 1;
478                 case LDKPaymentFailureReason_RetriesExhausted: return 2;
479                 case LDKPaymentFailureReason_PaymentExpired: return 3;
480                 case LDKPaymentFailureReason_RouteNotFound: return 4;
481                 case LDKPaymentFailureReason_UnexpectedError: return 5;
482                 default: abort();
483         }
484 }
485 static inline LDKRecipient LDKRecipient_from_js(int32_t ord) {
486         switch (ord) {
487                 case 0: return LDKRecipient_Node;
488                 case 1: return LDKRecipient_PhantomNode;
489         }
490         abort();
491 }
492 static inline int32_t LDKRecipient_to_js(LDKRecipient val) {
493         switch (val) {
494                 case LDKRecipient_Node: return 0;
495                 case LDKRecipient_PhantomNode: return 1;
496                 default: abort();
497         }
498 }
499 static inline LDKRetryableSendFailure LDKRetryableSendFailure_from_js(int32_t ord) {
500         switch (ord) {
501                 case 0: return LDKRetryableSendFailure_PaymentExpired;
502                 case 1: return LDKRetryableSendFailure_RouteNotFound;
503                 case 2: return LDKRetryableSendFailure_DuplicatePayment;
504         }
505         abort();
506 }
507 static inline int32_t LDKRetryableSendFailure_to_js(LDKRetryableSendFailure val) {
508         switch (val) {
509                 case LDKRetryableSendFailure_PaymentExpired: return 0;
510                 case LDKRetryableSendFailure_RouteNotFound: return 1;
511                 case LDKRetryableSendFailure_DuplicatePayment: return 2;
512                 default: abort();
513         }
514 }
515 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
516         switch (ord) {
517                 case 0: return LDKSecp256k1Error_IncorrectSignature;
518                 case 1: return LDKSecp256k1Error_InvalidMessage;
519                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
520                 case 3: return LDKSecp256k1Error_InvalidSignature;
521                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
522                 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
523                 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
524                 case 7: return LDKSecp256k1Error_InvalidTweak;
525                 case 8: return LDKSecp256k1Error_NotEnoughMemory;
526                 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
527                 case 10: return LDKSecp256k1Error_InvalidParityValue;
528         }
529         abort();
530 }
531 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
532         switch (val) {
533                 case LDKSecp256k1Error_IncorrectSignature: return 0;
534                 case LDKSecp256k1Error_InvalidMessage: return 1;
535                 case LDKSecp256k1Error_InvalidPublicKey: return 2;
536                 case LDKSecp256k1Error_InvalidSignature: return 3;
537                 case LDKSecp256k1Error_InvalidSecretKey: return 4;
538                 case LDKSecp256k1Error_InvalidSharedSecret: return 5;
539                 case LDKSecp256k1Error_InvalidRecoveryId: return 6;
540                 case LDKSecp256k1Error_InvalidTweak: return 7;
541                 case LDKSecp256k1Error_NotEnoughMemory: return 8;
542                 case LDKSecp256k1Error_InvalidPublicKeySum: return 9;
543                 case LDKSecp256k1Error_InvalidParityValue: return 10;
544                 default: abort();
545         }
546 }
547 static inline LDKSiPrefix LDKSiPrefix_from_js(int32_t ord) {
548         switch (ord) {
549                 case 0: return LDKSiPrefix_Milli;
550                 case 1: return LDKSiPrefix_Micro;
551                 case 2: return LDKSiPrefix_Nano;
552                 case 3: return LDKSiPrefix_Pico;
553         }
554         abort();
555 }
556 static inline int32_t LDKSiPrefix_to_js(LDKSiPrefix val) {
557         switch (val) {
558                 case LDKSiPrefix_Milli: return 0;
559                 case LDKSiPrefix_Micro: return 1;
560                 case LDKSiPrefix_Nano: return 2;
561                 case LDKSiPrefix_Pico: return 3;
562                 default: abort();
563         }
564 }
565 static inline LDKSocketAddressParseError LDKSocketAddressParseError_from_js(int32_t ord) {
566         switch (ord) {
567                 case 0: return LDKSocketAddressParseError_SocketAddrParse;
568                 case 1: return LDKSocketAddressParseError_InvalidInput;
569                 case 2: return LDKSocketAddressParseError_InvalidPort;
570                 case 3: return LDKSocketAddressParseError_InvalidOnionV3;
571         }
572         abort();
573 }
574 static inline int32_t LDKSocketAddressParseError_to_js(LDKSocketAddressParseError val) {
575         switch (val) {
576                 case LDKSocketAddressParseError_SocketAddrParse: return 0;
577                 case LDKSocketAddressParseError_InvalidInput: return 1;
578                 case LDKSocketAddressParseError_InvalidPort: return 2;
579                 case LDKSocketAddressParseError_InvalidOnionV3: return 3;
580                 default: abort();
581         }
582 }
583 static inline LDKUtxoLookupError LDKUtxoLookupError_from_js(int32_t ord) {
584         switch (ord) {
585                 case 0: return LDKUtxoLookupError_UnknownChain;
586                 case 1: return LDKUtxoLookupError_UnknownTx;
587         }
588         abort();
589 }
590 static inline int32_t LDKUtxoLookupError_to_js(LDKUtxoLookupError val) {
591         switch (val) {
592                 case LDKUtxoLookupError_UnknownChain: return 0;
593                 case LDKUtxoLookupError_UnknownTx: return 1;
594                 default: abort();
595         }
596 }
597 struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) {
598         LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes };
599         return ret;
600 }
601 int8_tArray  __attribute__((export_name("TS_BigEndianScalar_get_bytes"))) TS_BigEndianScalar_get_bytes(uint64_t thing) {
602         LDKBigEndianScalar* thing_conv = (LDKBigEndianScalar*)untag_ptr(thing);
603         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
604         memcpy(ret_arr->elems, BigEndianScalar_get_bytes(thing_conv).data, 32);
605         return ret_arr;
606 }
607
608 static void BigEndianScalar_free (struct LDKBigEndianScalar thing) {}
609 void  __attribute__((export_name("TS_BigEndianScalar_free"))) TS_BigEndianScalar_free(uint64_t thing) {
610         if (!ptr_is_owned(thing)) return;
611         void* thing_ptr = untag_ptr(thing);
612         CHECK_ACCESS(thing_ptr);
613         LDKBigEndianScalar thing_conv = *(LDKBigEndianScalar*)(thing_ptr);
614         FREE(untag_ptr(thing));
615         BigEndianScalar_free(thing_conv);
616 }
617
618 uint32_t __attribute__((export_name("TS_LDKBech32Error_ty_from_ptr"))) TS_LDKBech32Error_ty_from_ptr(uint64_t ptr) {
619         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
620         switch(obj->tag) {
621                 case LDKBech32Error_MissingSeparator: return 0;
622                 case LDKBech32Error_InvalidChecksum: return 1;
623                 case LDKBech32Error_InvalidLength: return 2;
624                 case LDKBech32Error_InvalidChar: return 3;
625                 case LDKBech32Error_InvalidData: return 4;
626                 case LDKBech32Error_InvalidPadding: return 5;
627                 case LDKBech32Error_MixedCase: return 6;
628                 default: abort();
629         }
630 }
631 int32_t __attribute__((export_name("TS_LDKBech32Error_InvalidChar_get_invalid_char"))) TS_LDKBech32Error_InvalidChar_get_invalid_char(uint64_t ptr) {
632         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
633         assert(obj->tag == LDKBech32Error_InvalidChar);
634                         int32_t invalid_char_conv = obj->invalid_char;
635         return invalid_char_conv;
636 }
637 int8_t __attribute__((export_name("TS_LDKBech32Error_InvalidData_get_invalid_data"))) TS_LDKBech32Error_InvalidData_get_invalid_data(uint64_t ptr) {
638         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
639         assert(obj->tag == LDKBech32Error_InvalidData);
640                         int8_t invalid_data_conv = obj->invalid_data;
641         return invalid_data_conv;
642 }
643 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
644         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
645         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
646         return ret;
647 }
648 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) {
649         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
650         LDKWitness ret_var = TxIn_get_witness(thing_conv);
651         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
652         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
653         Witness_free(ret_var);
654         return ret_arr;
655 }
656
657 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) {
658         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
659         LDKCVec_u8Z ret_var = TxIn_get_script_sig(thing_conv);
660         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
661         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
662         CVec_u8Z_free(ret_var);
663         return ret_arr;
664 }
665
666 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) {
667         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
668         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
669         memcpy(ret_arr->elems, TxIn_get_previous_txid(thing_conv).data, 32);
670         return ret_arr;
671 }
672
673 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) {
674         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
675         int32_t ret_conv = TxIn_get_previous_vout(thing_conv);
676         return ret_conv;
677 }
678
679 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) {
680         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
681         int32_t ret_conv = TxIn_get_sequence(thing_conv);
682         return ret_conv;
683 }
684
685 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) {
686         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
687         LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
688         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
689         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
690         CVec_u8Z_free(ret_var);
691         return ret_arr;
692 }
693
694 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) {
695         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
696         int64_t ret_conv = TxOut_get_value(thing_conv);
697         return ret_conv;
698 }
699
700 uint32_t __attribute__((export_name("TS_LDKCOption_u64Z_ty_from_ptr"))) TS_LDKCOption_u64Z_ty_from_ptr(uint64_t ptr) {
701         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
702         switch(obj->tag) {
703                 case LDKCOption_u64Z_Some: return 0;
704                 case LDKCOption_u64Z_None: return 1;
705                 default: abort();
706         }
707 }
708 int64_t __attribute__((export_name("TS_LDKCOption_u64Z_Some_get_some"))) TS_LDKCOption_u64Z_Some_get_some(uint64_t ptr) {
709         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
710         assert(obj->tag == LDKCOption_u64Z_Some);
711                         int64_t some_conv = obj->some;
712         return some_conv;
713 }
714 static inline LDKCVec_BlindedPathZ CVec_BlindedPathZ_clone(const LDKCVec_BlindedPathZ *orig) {
715         LDKCVec_BlindedPathZ ret = { .data = MALLOC(sizeof(LDKBlindedPath) * orig->datalen, "LDKCVec_BlindedPathZ clone bytes"), .datalen = orig->datalen };
716         for (size_t i = 0; i < ret.datalen; i++) {
717                 ret.data[i] = BlindedPath_clone(&orig->data[i]);
718         }
719         return ret;
720 }
721 static inline struct LDKRefund CResult_RefundBolt12ParseErrorZ_get_ok(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
722         LDKRefund ret = *owner->contents.result;
723         ret.is_owned = false;
724         return ret;
725 }
726 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_get_ok"))) TS_CResult_RefundBolt12ParseErrorZ_get_ok(uint64_t owner) {
727         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
728         LDKRefund ret_var = CResult_RefundBolt12ParseErrorZ_get_ok(owner_conv);
729         uint64_t ret_ref = 0;
730         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
731         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
732         return ret_ref;
733 }
734
735 static inline struct LDKBolt12ParseError CResult_RefundBolt12ParseErrorZ_get_err(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
736         LDKBolt12ParseError ret = *owner->contents.err;
737         ret.is_owned = false;
738         return ret;
739 }
740 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_get_err"))) TS_CResult_RefundBolt12ParseErrorZ_get_err(uint64_t owner) {
741         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
742         LDKBolt12ParseError ret_var = CResult_RefundBolt12ParseErrorZ_get_err(owner_conv);
743         uint64_t ret_ref = 0;
744         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
745         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
746         return ret_ref;
747 }
748
749 uint32_t __attribute__((export_name("TS_LDKRetry_ty_from_ptr"))) TS_LDKRetry_ty_from_ptr(uint64_t ptr) {
750         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
751         switch(obj->tag) {
752                 case LDKRetry_Attempts: return 0;
753                 default: abort();
754         }
755 }
756 int32_t __attribute__((export_name("TS_LDKRetry_Attempts_get_attempts"))) TS_LDKRetry_Attempts_get_attempts(uint64_t ptr) {
757         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
758         assert(obj->tag == LDKRetry_Attempts);
759                         int32_t attempts_conv = obj->attempts;
760         return attempts_conv;
761 }
762 uint32_t __attribute__((export_name("TS_LDKDecodeError_ty_from_ptr"))) TS_LDKDecodeError_ty_from_ptr(uint64_t ptr) {
763         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
764         switch(obj->tag) {
765                 case LDKDecodeError_UnknownVersion: return 0;
766                 case LDKDecodeError_UnknownRequiredFeature: return 1;
767                 case LDKDecodeError_InvalidValue: return 2;
768                 case LDKDecodeError_ShortRead: return 3;
769                 case LDKDecodeError_BadLengthDescriptor: return 4;
770                 case LDKDecodeError_Io: return 5;
771                 case LDKDecodeError_UnsupportedCompression: return 6;
772                 default: abort();
773         }
774 }
775 uint32_t __attribute__((export_name("TS_LDKDecodeError_Io_get_io"))) TS_LDKDecodeError_Io_get_io(uint64_t ptr) {
776         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
777         assert(obj->tag == LDKDecodeError_Io);
778                         uint32_t io_conv = LDKIOError_to_js(obj->io);
779         return io_conv;
780 }
781 static inline struct LDKRetry CResult_RetryDecodeErrorZ_get_ok(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
782 CHECK(owner->result_ok);
783         return Retry_clone(&*owner->contents.result);
784 }
785 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_get_ok"))) TS_CResult_RetryDecodeErrorZ_get_ok(uint64_t owner) {
786         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
787         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
788         *ret_copy = CResult_RetryDecodeErrorZ_get_ok(owner_conv);
789         uint64_t ret_ref = tag_ptr(ret_copy, true);
790         return ret_ref;
791 }
792
793 static inline struct LDKDecodeError CResult_RetryDecodeErrorZ_get_err(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
794 CHECK(!owner->result_ok);
795         return DecodeError_clone(&*owner->contents.err);
796 }
797 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_get_err"))) TS_CResult_RetryDecodeErrorZ_get_err(uint64_t owner) {
798         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
799         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
800         *ret_copy = CResult_RetryDecodeErrorZ_get_err(owner_conv);
801         uint64_t ret_ref = tag_ptr(ret_copy, true);
802         return ret_ref;
803 }
804
805 uint32_t __attribute__((export_name("TS_LDKAPIError_ty_from_ptr"))) TS_LDKAPIError_ty_from_ptr(uint64_t ptr) {
806         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
807         switch(obj->tag) {
808                 case LDKAPIError_APIMisuseError: return 0;
809                 case LDKAPIError_FeeRateTooHigh: return 1;
810                 case LDKAPIError_InvalidRoute: return 2;
811                 case LDKAPIError_ChannelUnavailable: return 3;
812                 case LDKAPIError_MonitorUpdateInProgress: return 4;
813                 case LDKAPIError_IncompatibleShutdownScript: return 5;
814                 default: abort();
815         }
816 }
817 jstring __attribute__((export_name("TS_LDKAPIError_APIMisuseError_get_err"))) TS_LDKAPIError_APIMisuseError_get_err(uint64_t ptr) {
818         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
819         assert(obj->tag == LDKAPIError_APIMisuseError);
820                         LDKStr err_str = obj->api_misuse_error.err;
821                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
822         return err_conv;
823 }
824 jstring __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_err"))) TS_LDKAPIError_FeeRateTooHigh_get_err(uint64_t ptr) {
825         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
826         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
827                         LDKStr err_str = obj->fee_rate_too_high.err;
828                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
829         return err_conv;
830 }
831 int32_t __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_feerate"))) TS_LDKAPIError_FeeRateTooHigh_get_feerate(uint64_t ptr) {
832         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
833         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
834                         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
835         return feerate_conv;
836 }
837 jstring __attribute__((export_name("TS_LDKAPIError_InvalidRoute_get_err"))) TS_LDKAPIError_InvalidRoute_get_err(uint64_t ptr) {
838         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
839         assert(obj->tag == LDKAPIError_InvalidRoute);
840                         LDKStr err_str = obj->invalid_route.err;
841                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
842         return err_conv;
843 }
844 jstring __attribute__((export_name("TS_LDKAPIError_ChannelUnavailable_get_err"))) TS_LDKAPIError_ChannelUnavailable_get_err(uint64_t ptr) {
845         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
846         assert(obj->tag == LDKAPIError_ChannelUnavailable);
847                         LDKStr err_str = obj->channel_unavailable.err;
848                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
849         return err_conv;
850 }
851 uint64_t __attribute__((export_name("TS_LDKAPIError_IncompatibleShutdownScript_get_script"))) TS_LDKAPIError_IncompatibleShutdownScript_get_script(uint64_t ptr) {
852         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
853         assert(obj->tag == LDKAPIError_IncompatibleShutdownScript);
854                         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
855                         uint64_t script_ref = 0;
856                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
857                         script_ref = tag_ptr(script_var.inner, false);
858         return script_ref;
859 }
860 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
861 CHECK(owner->result_ok);
862         return *owner->contents.result;
863 }
864 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_ok"))) TS_CResult_NoneAPIErrorZ_get_ok(uint64_t owner) {
865         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
866         CResult_NoneAPIErrorZ_get_ok(owner_conv);
867 }
868
869 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
870 CHECK(!owner->result_ok);
871         return APIError_clone(&*owner->contents.err);
872 }
873 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_err"))) TS_CResult_NoneAPIErrorZ_get_err(uint64_t owner) {
874         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
875         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
876         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
877         uint64_t ret_ref = tag_ptr(ret_copy, true);
878         return ret_ref;
879 }
880
881 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
882         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
883         for (size_t i = 0; i < ret.datalen; i++) {
884                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
885         }
886         return ret;
887 }
888 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
889         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
890         for (size_t i = 0; i < ret.datalen; i++) {
891                 ret.data[i] = APIError_clone(&orig->data[i]);
892         }
893         return ret;
894 }
895 uint32_t __attribute__((export_name("TS_LDKCOption_ThirtyTwoBytesZ_ty_from_ptr"))) TS_LDKCOption_ThirtyTwoBytesZ_ty_from_ptr(uint64_t ptr) {
896         LDKCOption_ThirtyTwoBytesZ *obj = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(ptr);
897         switch(obj->tag) {
898                 case LDKCOption_ThirtyTwoBytesZ_Some: return 0;
899                 case LDKCOption_ThirtyTwoBytesZ_None: return 1;
900                 default: abort();
901         }
902 }
903 int8_tArray __attribute__((export_name("TS_LDKCOption_ThirtyTwoBytesZ_Some_get_some"))) TS_LDKCOption_ThirtyTwoBytesZ_Some_get_some(uint64_t ptr) {
904         LDKCOption_ThirtyTwoBytesZ *obj = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(ptr);
905         assert(obj->tag == LDKCOption_ThirtyTwoBytesZ_Some);
906                         int8_tArray some_arr = init_int8_tArray(32, __LINE__);
907                         memcpy(some_arr->elems, obj->some.data, 32);
908         return some_arr;
909 }
910 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_u8ZZ_ty_from_ptr"))) TS_LDKCOption_CVec_u8ZZ_ty_from_ptr(uint64_t ptr) {
911         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
912         switch(obj->tag) {
913                 case LDKCOption_CVec_u8ZZ_Some: return 0;
914                 case LDKCOption_CVec_u8ZZ_None: return 1;
915                 default: abort();
916         }
917 }
918 int8_tArray __attribute__((export_name("TS_LDKCOption_CVec_u8ZZ_Some_get_some"))) TS_LDKCOption_CVec_u8ZZ_Some_get_some(uint64_t ptr) {
919         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
920         assert(obj->tag == LDKCOption_CVec_u8ZZ_Some);
921                         LDKCVec_u8Z some_var = obj->some;
922                         int8_tArray some_arr = init_int8_tArray(some_var.datalen, __LINE__);
923                         memcpy(some_arr->elems, some_var.data, some_var.datalen);
924         return some_arr;
925 }
926 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
927         LDKRecipientOnionFields ret = *owner->contents.result;
928         ret.is_owned = false;
929         return ret;
930 }
931 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_ok"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(uint64_t owner) {
932         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
933         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(owner_conv);
934         uint64_t ret_ref = 0;
935         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
936         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
937         return ret_ref;
938 }
939
940 static inline struct LDKDecodeError CResult_RecipientOnionFieldsDecodeErrorZ_get_err(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
941 CHECK(!owner->result_ok);
942         return DecodeError_clone(&*owner->contents.err);
943 }
944 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_err"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_err(uint64_t owner) {
945         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
946         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
947         *ret_copy = CResult_RecipientOnionFieldsDecodeErrorZ_get_err(owner_conv);
948         uint64_t ret_ref = tag_ptr(ret_copy, true);
949         return ret_ref;
950 }
951
952 static inline uint64_t C2Tuple_u64CVec_u8ZZ_get_a(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
953         return owner->a;
954 }
955 int64_t  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_get_a"))) TS_C2Tuple_u64CVec_u8ZZ_get_a(uint64_t owner) {
956         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
957         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_get_a(owner_conv);
958         return ret_conv;
959 }
960
961 static inline struct LDKCVec_u8Z C2Tuple_u64CVec_u8ZZ_get_b(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
962         return CVec_u8Z_clone(&owner->b);
963 }
964 int8_tArray  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_get_b"))) TS_C2Tuple_u64CVec_u8ZZ_get_b(uint64_t owner) {
965         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
966         LDKCVec_u8Z ret_var = C2Tuple_u64CVec_u8ZZ_get_b(owner_conv);
967         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
968         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
969         CVec_u8Z_free(ret_var);
970         return ret_arr;
971 }
972
973 static inline LDKCVec_C2Tuple_u64CVec_u8ZZZ CVec_C2Tuple_u64CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u64CVec_u8ZZZ *orig) {
974         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u64CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
975         for (size_t i = 0; i < ret.datalen; i++) {
976                 ret.data[i] = C2Tuple_u64CVec_u8ZZ_clone(&orig->data[i]);
977         }
978         return ret;
979 }
980 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsNoneZ_get_ok(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
981         LDKRecipientOnionFields ret = *owner->contents.result;
982         ret.is_owned = false;
983         return ret;
984 }
985 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_get_ok"))) TS_CResult_RecipientOnionFieldsNoneZ_get_ok(uint64_t owner) {
986         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
987         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsNoneZ_get_ok(owner_conv);
988         uint64_t ret_ref = 0;
989         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
990         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
991         return ret_ref;
992 }
993
994 static inline void CResult_RecipientOnionFieldsNoneZ_get_err(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
995 CHECK(!owner->result_ok);
996         return *owner->contents.err;
997 }
998 void  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_get_err"))) TS_CResult_RecipientOnionFieldsNoneZ_get_err(uint64_t owner) {
999         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
1000         CResult_RecipientOnionFieldsNoneZ_get_err(owner_conv);
1001 }
1002
1003 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
1004         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
1005         for (size_t i = 0; i < ret.datalen; i++) {
1006                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1007         }
1008         return ret;
1009 }
1010 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_ThirtyTwoBytesZZ_ty_from_ptr"))) TS_LDKCOption_CVec_ThirtyTwoBytesZZ_ty_from_ptr(uint64_t ptr) {
1011         LDKCOption_CVec_ThirtyTwoBytesZZ *obj = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(ptr);
1012         switch(obj->tag) {
1013                 case LDKCOption_CVec_ThirtyTwoBytesZZ_Some: return 0;
1014                 case LDKCOption_CVec_ThirtyTwoBytesZZ_None: return 1;
1015                 default: abort();
1016         }
1017 }
1018 ptrArray __attribute__((export_name("TS_LDKCOption_CVec_ThirtyTwoBytesZZ_Some_get_some"))) TS_LDKCOption_CVec_ThirtyTwoBytesZZ_Some_get_some(uint64_t ptr) {
1019         LDKCOption_CVec_ThirtyTwoBytesZZ *obj = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(ptr);
1020         assert(obj->tag == LDKCOption_CVec_ThirtyTwoBytesZZ_Some);
1021                         LDKCVec_ThirtyTwoBytesZ some_var = obj->some;
1022                         ptrArray some_arr = NULL;
1023                         some_arr = init_ptrArray(some_var.datalen, __LINE__);
1024                         int8_tArray *some_arr_ptr = (int8_tArray*)(((uint8_t*)some_arr) + 8);
1025                         for (size_t m = 0; m < some_var.datalen; m++) {
1026                                 int8_tArray some_conv_12_arr = init_int8_tArray(32, __LINE__);
1027                                 memcpy(some_conv_12_arr->elems, some_var.data[m].data, 32);
1028                                 some_arr_ptr[m] = some_conv_12_arr;
1029                         }
1030                         
1031         return some_arr;
1032 }
1033 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesNoneZ_get_ok(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
1034 CHECK(owner->result_ok);
1035         return ThirtyTwoBytes_clone(&*owner->contents.result);
1036 }
1037 int8_tArray  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_get_ok"))) TS_CResult_ThirtyTwoBytesNoneZ_get_ok(uint64_t owner) {
1038         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
1039         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1040         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesNoneZ_get_ok(owner_conv).data, 32);
1041         return ret_arr;
1042 }
1043
1044 static inline void CResult_ThirtyTwoBytesNoneZ_get_err(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
1045 CHECK(!owner->result_ok);
1046         return *owner->contents.err;
1047 }
1048 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_get_err"))) TS_CResult_ThirtyTwoBytesNoneZ_get_err(uint64_t owner) {
1049         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
1050         CResult_ThirtyTwoBytesNoneZ_get_err(owner_conv);
1051 }
1052
1053 static inline struct LDKBlindedPayInfo CResult_BlindedPayInfoDecodeErrorZ_get_ok(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
1054         LDKBlindedPayInfo ret = *owner->contents.result;
1055         ret.is_owned = false;
1056         return ret;
1057 }
1058 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_get_ok"))) TS_CResult_BlindedPayInfoDecodeErrorZ_get_ok(uint64_t owner) {
1059         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
1060         LDKBlindedPayInfo ret_var = CResult_BlindedPayInfoDecodeErrorZ_get_ok(owner_conv);
1061         uint64_t ret_ref = 0;
1062         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1063         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1064         return ret_ref;
1065 }
1066
1067 static inline struct LDKDecodeError CResult_BlindedPayInfoDecodeErrorZ_get_err(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
1068 CHECK(!owner->result_ok);
1069         return DecodeError_clone(&*owner->contents.err);
1070 }
1071 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_get_err"))) TS_CResult_BlindedPayInfoDecodeErrorZ_get_err(uint64_t owner) {
1072         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
1073         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1074         *ret_copy = CResult_BlindedPayInfoDecodeErrorZ_get_err(owner_conv);
1075         uint64_t ret_ref = tag_ptr(ret_copy, true);
1076         return ret_ref;
1077 }
1078
1079 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1080         LDKDelayedPaymentOutputDescriptor ret = *owner->contents.result;
1081         ret.is_owned = false;
1082         return ret;
1083 }
1084 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
1085         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1086         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1087         uint64_t ret_ref = 0;
1088         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1089         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1090         return ret_ref;
1091 }
1092
1093 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1094 CHECK(!owner->result_ok);
1095         return DecodeError_clone(&*owner->contents.err);
1096 }
1097 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
1098         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1099         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1100         *ret_copy = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1101         uint64_t ret_ref = tag_ptr(ret_copy, true);
1102         return ret_ref;
1103 }
1104
1105 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1106         LDKStaticPaymentOutputDescriptor ret = *owner->contents.result;
1107         ret.is_owned = false;
1108         return ret;
1109 }
1110 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
1111         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1112         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1113         uint64_t ret_ref = 0;
1114         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1115         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1116         return ret_ref;
1117 }
1118
1119 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1120 CHECK(!owner->result_ok);
1121         return DecodeError_clone(&*owner->contents.err);
1122 }
1123 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
1124         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1125         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1126         *ret_copy = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1127         uint64_t ret_ref = tag_ptr(ret_copy, true);
1128         return ret_ref;
1129 }
1130
1131 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_ty_from_ptr"))) TS_LDKSpendableOutputDescriptor_ty_from_ptr(uint64_t ptr) {
1132         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1133         switch(obj->tag) {
1134                 case LDKSpendableOutputDescriptor_StaticOutput: return 0;
1135                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: return 1;
1136                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: return 2;
1137                 default: abort();
1138         }
1139 }
1140 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint(uint64_t ptr) {
1141         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1142         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1143                         LDKOutPoint outpoint_var = obj->static_output.outpoint;
1144                         uint64_t outpoint_ref = 0;
1145                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
1146                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
1147         return outpoint_ref;
1148 }
1149 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_output"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_output(uint64_t ptr) {
1150         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1151         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1152                         LDKTxOut* output_ref = &obj->static_output.output;
1153         return tag_ptr(output_ref, false);
1154 }
1155 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output"))) TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output(uint64_t ptr) {
1156         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1157         assert(obj->tag == LDKSpendableOutputDescriptor_DelayedPaymentOutput);
1158                         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1159                         uint64_t delayed_payment_output_ref = 0;
1160                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
1161                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
1162         return delayed_payment_output_ref;
1163 }
1164 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output"))) TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output(uint64_t ptr) {
1165         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1166         assert(obj->tag == LDKSpendableOutputDescriptor_StaticPaymentOutput);
1167                         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1168                         uint64_t static_payment_output_ref = 0;
1169                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
1170                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
1171         return static_payment_output_ref;
1172 }
1173 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1174 CHECK(owner->result_ok);
1175         return SpendableOutputDescriptor_clone(&*owner->contents.result);
1176 }
1177 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
1178         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1179         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
1180         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1181         uint64_t ret_ref = tag_ptr(ret_copy, true);
1182         return ret_ref;
1183 }
1184
1185 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1186 CHECK(!owner->result_ok);
1187         return DecodeError_clone(&*owner->contents.err);
1188 }
1189 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
1190         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1191         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1192         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1193         uint64_t ret_ref = tag_ptr(ret_copy, true);
1194         return ret_ref;
1195 }
1196
1197 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1198         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1199         for (size_t i = 0; i < ret.datalen; i++) {
1200                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1201         }
1202         return ret;
1203 }
1204 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
1205         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
1206         for (size_t i = 0; i < ret.datalen; i++) {
1207                 ret.data[i] = TxOut_clone(&orig->data[i]);
1208         }
1209         return ret;
1210 }
1211 uint32_t __attribute__((export_name("TS_LDKCOption_u32Z_ty_from_ptr"))) TS_LDKCOption_u32Z_ty_from_ptr(uint64_t ptr) {
1212         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
1213         switch(obj->tag) {
1214                 case LDKCOption_u32Z_Some: return 0;
1215                 case LDKCOption_u32Z_None: return 1;
1216                 default: abort();
1217         }
1218 }
1219 int32_t __attribute__((export_name("TS_LDKCOption_u32Z_Some_get_some"))) TS_LDKCOption_u32Z_Some_get_some(uint64_t ptr) {
1220         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
1221         assert(obj->tag == LDKCOption_u32Z_Some);
1222                         int32_t some_conv = obj->some;
1223         return some_conv;
1224 }
1225 static inline struct LDKCVec_u8Z C2Tuple_CVec_u8ZusizeZ_get_a(LDKC2Tuple_CVec_u8ZusizeZ *NONNULL_PTR owner){
1226         return CVec_u8Z_clone(&owner->a);
1227 }
1228 int8_tArray  __attribute__((export_name("TS_C2Tuple_CVec_u8ZusizeZ_get_a"))) TS_C2Tuple_CVec_u8ZusizeZ_get_a(uint64_t owner) {
1229         LDKC2Tuple_CVec_u8ZusizeZ* owner_conv = (LDKC2Tuple_CVec_u8ZusizeZ*)untag_ptr(owner);
1230         LDKCVec_u8Z ret_var = C2Tuple_CVec_u8ZusizeZ_get_a(owner_conv);
1231         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
1232         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1233         CVec_u8Z_free(ret_var);
1234         return ret_arr;
1235 }
1236
1237 static inline uintptr_t C2Tuple_CVec_u8ZusizeZ_get_b(LDKC2Tuple_CVec_u8ZusizeZ *NONNULL_PTR owner){
1238         return owner->b;
1239 }
1240 uint32_t  __attribute__((export_name("TS_C2Tuple_CVec_u8ZusizeZ_get_b"))) TS_C2Tuple_CVec_u8ZusizeZ_get_b(uint64_t owner) {
1241         LDKC2Tuple_CVec_u8ZusizeZ* owner_conv = (LDKC2Tuple_CVec_u8ZusizeZ*)untag_ptr(owner);
1242         uint32_t ret_conv = C2Tuple_CVec_u8ZusizeZ_get_b(owner_conv);
1243         return ret_conv;
1244 }
1245
1246 static inline struct LDKC2Tuple_CVec_u8ZusizeZ CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_ok(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ *NONNULL_PTR owner){
1247 CHECK(owner->result_ok);
1248         return C2Tuple_CVec_u8ZusizeZ_clone(&*owner->contents.result);
1249 }
1250 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_ok"))) TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_ok(uint64_t owner) {
1251         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)untag_ptr(owner);
1252         LDKC2Tuple_CVec_u8ZusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8ZusizeZ), "LDKC2Tuple_CVec_u8ZusizeZ");
1253         *ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_ok(owner_conv);
1254         return tag_ptr(ret_conv, true);
1255 }
1256
1257 static inline void CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_err(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ *NONNULL_PTR owner){
1258 CHECK(!owner->result_ok);
1259         return *owner->contents.err;
1260 }
1261 void  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_err"))) TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_err(uint64_t owner) {
1262         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)untag_ptr(owner);
1263         CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_err(owner_conv);
1264 }
1265
1266 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1267 CHECK(owner->result_ok);
1268         return *owner->contents.result;
1269 }
1270 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_ok"))) TS_CResult_NoneNoneZ_get_ok(uint64_t owner) {
1271         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
1272         CResult_NoneNoneZ_get_ok(owner_conv);
1273 }
1274
1275 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1276 CHECK(!owner->result_ok);
1277         return *owner->contents.err;
1278 }
1279 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_err"))) TS_CResult_NoneNoneZ_get_err(uint64_t owner) {
1280         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
1281         CResult_NoneNoneZ_get_err(owner_conv);
1282 }
1283
1284 static inline struct LDKECDSASignature C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
1285         return owner->a;
1286 }
1287 int8_tArray  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(uint64_t owner) {
1288         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
1289         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1290         memcpy(ret_arr->elems, C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(owner_conv).compact_form, 64);
1291         return ret_arr;
1292 }
1293
1294 static inline struct LDKCVec_ECDSASignatureZ C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
1295         return owner->b;
1296 }
1297 ptrArray  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(uint64_t owner) {
1298         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
1299         LDKCVec_ECDSASignatureZ ret_var = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(owner_conv);
1300         ptrArray ret_arr = NULL;
1301         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
1302         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
1303         for (size_t m = 0; m < ret_var.datalen; m++) {
1304                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
1305                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
1306                 ret_arr_ptr[m] = ret_conv_12_arr;
1307         }
1308         
1309         return ret_arr;
1310 }
1311
1312 static inline struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
1313 CHECK(owner->result_ok);
1314         return C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(&*owner->contents.result);
1315 }
1316 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(uint64_t owner) {
1317         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
1318         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
1319         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(owner_conv);
1320         return tag_ptr(ret_conv, true);
1321 }
1322
1323 static inline void CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
1324 CHECK(!owner->result_ok);
1325         return *owner->contents.err;
1326 }
1327 void  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(uint64_t owner) {
1328         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
1329         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(owner_conv);
1330 }
1331
1332 static inline struct LDKECDSASignature CResult_ECDSASignatureNoneZ_get_ok(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
1333 CHECK(owner->result_ok);
1334         return *owner->contents.result;
1335 }
1336 int8_tArray  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_get_ok"))) TS_CResult_ECDSASignatureNoneZ_get_ok(uint64_t owner) {
1337         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
1338         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1339         memcpy(ret_arr->elems, CResult_ECDSASignatureNoneZ_get_ok(owner_conv).compact_form, 64);
1340         return ret_arr;
1341 }
1342
1343 static inline void CResult_ECDSASignatureNoneZ_get_err(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
1344 CHECK(!owner->result_ok);
1345         return *owner->contents.err;
1346 }
1347 void  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_get_err"))) TS_CResult_ECDSASignatureNoneZ_get_err(uint64_t owner) {
1348         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
1349         CResult_ECDSASignatureNoneZ_get_err(owner_conv);
1350 }
1351
1352 static inline struct LDKPublicKey CResult_PublicKeyNoneZ_get_ok(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
1353 CHECK(owner->result_ok);
1354         return *owner->contents.result;
1355 }
1356 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_get_ok"))) TS_CResult_PublicKeyNoneZ_get_ok(uint64_t owner) {
1357         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
1358         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
1359         memcpy(ret_arr->elems, CResult_PublicKeyNoneZ_get_ok(owner_conv).compressed_form, 33);
1360         return ret_arr;
1361 }
1362
1363 static inline void CResult_PublicKeyNoneZ_get_err(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
1364 CHECK(!owner->result_ok);
1365         return *owner->contents.err;
1366 }
1367 void  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_get_err"))) TS_CResult_PublicKeyNoneZ_get_err(uint64_t owner) {
1368         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
1369         CResult_PublicKeyNoneZ_get_err(owner_conv);
1370 }
1371
1372 uint32_t __attribute__((export_name("TS_LDKCOption_BigEndianScalarZ_ty_from_ptr"))) TS_LDKCOption_BigEndianScalarZ_ty_from_ptr(uint64_t ptr) {
1373         LDKCOption_BigEndianScalarZ *obj = (LDKCOption_BigEndianScalarZ*)untag_ptr(ptr);
1374         switch(obj->tag) {
1375                 case LDKCOption_BigEndianScalarZ_Some: return 0;
1376                 case LDKCOption_BigEndianScalarZ_None: return 1;
1377                 default: abort();
1378         }
1379 }
1380 uint64_t __attribute__((export_name("TS_LDKCOption_BigEndianScalarZ_Some_get_some"))) TS_LDKCOption_BigEndianScalarZ_Some_get_some(uint64_t ptr) {
1381         LDKCOption_BigEndianScalarZ *obj = (LDKCOption_BigEndianScalarZ*)untag_ptr(ptr);
1382         assert(obj->tag == LDKCOption_BigEndianScalarZ_Some);
1383                         LDKBigEndianScalar* some_ref = &obj->some;
1384         return tag_ptr(some_ref, false);
1385 }
1386 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
1387 CHECK(owner->result_ok);
1388         return *owner->contents.result;
1389 }
1390 int8_tArray  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_ok"))) TS_CResult_RecoverableSignatureNoneZ_get_ok(uint64_t owner) {
1391         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
1392         int8_tArray ret_arr = init_int8_tArray(68, __LINE__);
1393         memcpy(ret_arr->elems, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form, 68);
1394         return ret_arr;
1395 }
1396
1397 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
1398 CHECK(!owner->result_ok);
1399         return *owner->contents.err;
1400 }
1401 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_err"))) TS_CResult_RecoverableSignatureNoneZ_get_err(uint64_t owner) {
1402         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
1403         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
1404 }
1405
1406 static inline struct LDKSchnorrSignature CResult_SchnorrSignatureNoneZ_get_ok(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
1407 CHECK(owner->result_ok);
1408         return *owner->contents.result;
1409 }
1410 int8_tArray  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_get_ok"))) TS_CResult_SchnorrSignatureNoneZ_get_ok(uint64_t owner) {
1411         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
1412         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1413         memcpy(ret_arr->elems, CResult_SchnorrSignatureNoneZ_get_ok(owner_conv).compact_form, 64);
1414         return ret_arr;
1415 }
1416
1417 static inline void CResult_SchnorrSignatureNoneZ_get_err(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
1418 CHECK(!owner->result_ok);
1419         return *owner->contents.err;
1420 }
1421 void  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_get_err"))) TS_CResult_SchnorrSignatureNoneZ_get_err(uint64_t owner) {
1422         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
1423         CResult_SchnorrSignatureNoneZ_get_err(owner_conv);
1424 }
1425
1426 typedef struct LDKChannelSigner_JCalls {
1427         atomic_size_t refcnt;
1428         uint32_t instance_ptr;
1429 } LDKChannelSigner_JCalls;
1430 static void LDKChannelSigner_JCalls_free(void* this_arg) {
1431         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1432         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1433                 FREE(j_calls);
1434         }
1435 }
1436 LDKPublicKey get_per_commitment_point_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
1437         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1438         int64_t idx_conv = idx;
1439         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 0, idx_conv, 0, 0, 0, 0, 0);
1440         LDKPublicKey ret_ref;
1441         CHECK(ret->arr_len == 33);
1442         memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
1443         return ret_ref;
1444 }
1445 LDKThirtyTwoBytes release_commitment_secret_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
1446         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1447         int64_t idx_conv = idx;
1448         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 1, idx_conv, 0, 0, 0, 0, 0);
1449         LDKThirtyTwoBytes ret_ref;
1450         CHECK(ret->arr_len == 32);
1451         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
1452         return ret_ref;
1453 }
1454 LDKCResult_NoneNoneZ validate_holder_commitment_LDKChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_ThirtyTwoBytesZ preimages) {
1455         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1456         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
1457         uint64_t holder_tx_ref = 0;
1458         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
1459         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
1460         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
1461         LDKCVec_ThirtyTwoBytesZ preimages_var = preimages;
1462         ptrArray preimages_arr = NULL;
1463         preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
1464         int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 8);
1465         for (size_t m = 0; m < preimages_var.datalen; m++) {
1466                 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
1467                 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
1468                 preimages_arr_ptr[m] = preimages_conv_12_arr;
1469         }
1470         
1471         FREE(preimages_var.data);
1472         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 2, holder_tx_ref, (uint32_t)preimages_arr, 0, 0, 0, 0);
1473         void* ret_ptr = untag_ptr(ret);
1474         CHECK_ACCESS(ret_ptr);
1475         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1476         FREE(untag_ptr(ret));
1477         return ret_conv;
1478 }
1479 LDKThirtyTwoBytes channel_keys_id_LDKChannelSigner_jcall(const void* this_arg) {
1480         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1481         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 3, 0, 0, 0, 0, 0, 0);
1482         LDKThirtyTwoBytes ret_ref;
1483         CHECK(ret->arr_len == 32);
1484         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
1485         return ret_ref;
1486 }
1487 void provide_channel_parameters_LDKChannelSigner_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
1488         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1489         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
1490         uint64_t channel_parameters_ref = 0;
1491         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
1492         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
1493         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
1494         js_invoke_function_buuuuu(j_calls->instance_ptr, 4, channel_parameters_ref, 0, 0, 0, 0, 0);
1495 }
1496 static void LDKChannelSigner_JCalls_cloned(LDKChannelSigner* new_obj) {
1497         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) new_obj->this_arg;
1498         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1499 }
1500 static inline LDKChannelSigner LDKChannelSigner_init (JSValue o, uint64_t pubkeys) {
1501         LDKChannelSigner_JCalls *calls = MALLOC(sizeof(LDKChannelSigner_JCalls), "LDKChannelSigner_JCalls");
1502         atomic_init(&calls->refcnt, 1);
1503         calls->instance_ptr = o;
1504
1505         LDKChannelPublicKeys pubkeys_conv;
1506         pubkeys_conv.inner = untag_ptr(pubkeys);
1507         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
1508         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
1509
1510         LDKChannelSigner ret = {
1511                 .this_arg = (void*) calls,
1512                 .get_per_commitment_point = get_per_commitment_point_LDKChannelSigner_jcall,
1513                 .release_commitment_secret = release_commitment_secret_LDKChannelSigner_jcall,
1514                 .validate_holder_commitment = validate_holder_commitment_LDKChannelSigner_jcall,
1515                 .channel_keys_id = channel_keys_id_LDKChannelSigner_jcall,
1516                 .provide_channel_parameters = provide_channel_parameters_LDKChannelSigner_jcall,
1517                 .free = LDKChannelSigner_JCalls_free,
1518                 .pubkeys = pubkeys_conv,
1519                 .set_pubkeys = NULL,
1520         };
1521         return ret;
1522 }
1523 uint64_t  __attribute__((export_name("TS_LDKChannelSigner_new"))) TS_LDKChannelSigner_new(JSValue o, uint64_t pubkeys) {
1524         LDKChannelSigner *res_ptr = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
1525         *res_ptr = LDKChannelSigner_init(o, pubkeys);
1526         return tag_ptr(res_ptr, true);
1527 }
1528 int8_tArray  __attribute__((export_name("TS_ChannelSigner_get_per_commitment_point"))) TS_ChannelSigner_get_per_commitment_point(uint64_t this_arg, int64_t idx) {
1529         void* this_arg_ptr = untag_ptr(this_arg);
1530         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1531         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1532         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
1533         memcpy(ret_arr->elems, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
1534         return ret_arr;
1535 }
1536
1537 int8_tArray  __attribute__((export_name("TS_ChannelSigner_release_commitment_secret"))) TS_ChannelSigner_release_commitment_secret(uint64_t this_arg, int64_t idx) {
1538         void* this_arg_ptr = untag_ptr(this_arg);
1539         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1540         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1541         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1542         memcpy(ret_arr->elems, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
1543         return ret_arr;
1544 }
1545
1546 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) {
1547         void* this_arg_ptr = untag_ptr(this_arg);
1548         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1549         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1550         LDKHolderCommitmentTransaction holder_tx_conv;
1551         holder_tx_conv.inner = untag_ptr(holder_tx);
1552         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
1553         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
1554         holder_tx_conv.is_owned = false;
1555         LDKCVec_ThirtyTwoBytesZ preimages_constr;
1556         preimages_constr.datalen = preimages->arr_len;
1557         if (preimages_constr.datalen > 0)
1558                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
1559         else
1560                 preimages_constr.data = NULL;
1561         int8_tArray* preimages_vals = (void*) preimages->elems;
1562         for (size_t m = 0; m < preimages_constr.datalen; m++) {
1563                 int8_tArray preimages_conv_12 = preimages_vals[m];
1564                 LDKThirtyTwoBytes preimages_conv_12_ref;
1565                 CHECK(preimages_conv_12->arr_len == 32);
1566                 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
1567                 preimages_constr.data[m] = preimages_conv_12_ref;
1568         }
1569         FREE(preimages);
1570         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
1571         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
1572         return tag_ptr(ret_conv, true);
1573 }
1574
1575 int8_tArray  __attribute__((export_name("TS_ChannelSigner_channel_keys_id"))) TS_ChannelSigner_channel_keys_id(uint64_t this_arg) {
1576         void* this_arg_ptr = untag_ptr(this_arg);
1577         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1578         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1579         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1580         memcpy(ret_arr->elems, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
1581         return ret_arr;
1582 }
1583
1584 void  __attribute__((export_name("TS_ChannelSigner_provide_channel_parameters"))) TS_ChannelSigner_provide_channel_parameters(uint64_t this_arg, uint64_t channel_parameters) {
1585         void* this_arg_ptr = untag_ptr(this_arg);
1586         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1587         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1588         LDKChannelTransactionParameters channel_parameters_conv;
1589         channel_parameters_conv.inner = untag_ptr(channel_parameters);
1590         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
1591         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
1592         channel_parameters_conv.is_owned = false;
1593         (this_arg_conv->provide_channel_parameters)(this_arg_conv->this_arg, &channel_parameters_conv);
1594 }
1595
1596 LDKChannelPublicKeys LDKChannelSigner_set_get_pubkeys(LDKChannelSigner* this_arg) {
1597         if (this_arg->set_pubkeys != NULL)
1598                 this_arg->set_pubkeys(this_arg);
1599         return this_arg->pubkeys;
1600 }
1601 uint64_t  __attribute__((export_name("TS_ChannelSigner_get_pubkeys"))) TS_ChannelSigner_get_pubkeys(uint64_t this_arg) {
1602         void* this_arg_ptr = untag_ptr(this_arg);
1603         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1604         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1605         LDKChannelPublicKeys ret_var = LDKChannelSigner_set_get_pubkeys(this_arg_conv);
1606         uint64_t ret_ref = 0;
1607         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1608         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1609         return ret_ref;
1610 }
1611
1612 typedef struct LDKEcdsaChannelSigner_JCalls {
1613         atomic_size_t refcnt;
1614         uint32_t instance_ptr;
1615         LDKChannelSigner_JCalls* ChannelSigner;
1616 } LDKEcdsaChannelSigner_JCalls;
1617 static void LDKEcdsaChannelSigner_JCalls_free(void* this_arg) {
1618         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1619         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1620                 FREE(j_calls);
1621         }
1622 }
1623 LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_ThirtyTwoBytesZ preimages) {
1624         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1625         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1626         uint64_t commitment_tx_ref = 0;
1627         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
1628         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
1629         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
1630         LDKCVec_ThirtyTwoBytesZ preimages_var = preimages;
1631         ptrArray preimages_arr = NULL;
1632         preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
1633         int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 8);
1634         for (size_t m = 0; m < preimages_var.datalen; m++) {
1635                 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
1636                 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
1637                 preimages_arr_ptr[m] = preimages_conv_12_arr;
1638         }
1639         
1640         FREE(preimages_var.data);
1641         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 5, commitment_tx_ref, (uint32_t)preimages_arr, 0, 0, 0, 0);
1642         void* ret_ptr = untag_ptr(ret);
1643         CHECK_ACCESS(ret_ptr);
1644         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(ret_ptr);
1645         FREE(untag_ptr(ret));
1646         return ret_conv;
1647 }
1648 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
1649         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1650         int64_t idx_conv = idx;
1651         int8_tArray secret_arr = init_int8_tArray(32, __LINE__);
1652         memcpy(secret_arr->elems, *secret, 32);
1653         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 6, idx_conv, (uint32_t)secret_arr, 0, 0, 0, 0);
1654         void* ret_ptr = untag_ptr(ret);
1655         CHECK_ACCESS(ret_ptr);
1656         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1657         FREE(untag_ptr(ret));
1658         return ret_conv;
1659 }
1660 LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1661         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1662         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1663         uint64_t commitment_tx_ref = 0;
1664         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
1665         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
1666         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
1667         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 7, commitment_tx_ref, 0, 0, 0, 0, 0);
1668         void* ret_ptr = untag_ptr(ret);
1669         CHECK_ACCESS(ret_ptr);
1670         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(ret_ptr);
1671         FREE(untag_ptr(ret));
1672         return ret_conv;
1673 }
1674 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]) {
1675         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1676         LDKTransaction justice_tx_var = justice_tx;
1677         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
1678         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
1679         Transaction_free(justice_tx_var);
1680         uint32_t input_conv = input;
1681         int64_t amount_conv = amount;
1682         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
1683         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
1684         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);
1685         void* ret_ptr = untag_ptr(ret);
1686         CHECK_ACCESS(ret_ptr);
1687         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1688         FREE(untag_ptr(ret));
1689         return ret_conv;
1690 }
1691 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) {
1692         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1693         LDKTransaction justice_tx_var = justice_tx;
1694         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
1695         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
1696         Transaction_free(justice_tx_var);
1697         uint32_t input_conv = input;
1698         int64_t amount_conv = amount;
1699         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
1700         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
1701         LDKHTLCOutputInCommitment htlc_var = *htlc;
1702         uint64_t htlc_ref = 0;
1703         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
1704         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
1705         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
1706         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);
1707         void* ret_ptr = untag_ptr(ret);
1708         CHECK_ACCESS(ret_ptr);
1709         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1710         FREE(untag_ptr(ret));
1711         return ret_conv;
1712 }
1713 LDKCResult_ECDSASignatureNoneZ sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, const LDKHTLCDescriptor * htlc_descriptor) {
1714         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1715         LDKTransaction htlc_tx_var = htlc_tx;
1716         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
1717         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
1718         Transaction_free(htlc_tx_var);
1719         uint32_t input_conv = input;
1720         LDKHTLCDescriptor htlc_descriptor_var = *htlc_descriptor;
1721         uint64_t htlc_descriptor_ref = 0;
1722         htlc_descriptor_var = HTLCDescriptor_clone(&htlc_descriptor_var);
1723         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_var);
1724         htlc_descriptor_ref = tag_ptr(htlc_descriptor_var.inner, htlc_descriptor_var.is_owned);
1725         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);
1726         void* ret_ptr = untag_ptr(ret);
1727         CHECK_ACCESS(ret_ptr);
1728         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1729         FREE(untag_ptr(ret));
1730         return ret_conv;
1731 }
1732 LDKCResult_ECDSASignatureNoneZ sign_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) {
1733         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1734         LDKTransaction htlc_tx_var = htlc_tx;
1735         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
1736         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
1737         Transaction_free(htlc_tx_var);
1738         uint32_t input_conv = input;
1739         int64_t amount_conv = amount;
1740         int8_tArray per_commitment_point_arr = init_int8_tArray(33, __LINE__);
1741         memcpy(per_commitment_point_arr->elems, per_commitment_point.compressed_form, 33);
1742         LDKHTLCOutputInCommitment htlc_var = *htlc;
1743         uint64_t htlc_ref = 0;
1744         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
1745         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
1746         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
1747         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);
1748         void* ret_ptr = untag_ptr(ret);
1749         CHECK_ACCESS(ret_ptr);
1750         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1751         FREE(untag_ptr(ret));
1752         return ret_conv;
1753 }
1754 LDKCResult_ECDSASignatureNoneZ sign_closing_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
1755         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1756         LDKClosingTransaction closing_tx_var = *closing_tx;
1757         uint64_t closing_tx_ref = 0;
1758         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
1759         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
1760         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
1761         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 12, closing_tx_ref, 0, 0, 0, 0, 0);
1762         void* ret_ptr = untag_ptr(ret);
1763         CHECK_ACCESS(ret_ptr);
1764         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1765         FREE(untag_ptr(ret));
1766         return ret_conv;
1767 }
1768 LDKCResult_ECDSASignatureNoneZ sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) {
1769         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1770         LDKTransaction anchor_tx_var = anchor_tx;
1771         int8_tArray anchor_tx_arr = init_int8_tArray(anchor_tx_var.datalen, __LINE__);
1772         memcpy(anchor_tx_arr->elems, anchor_tx_var.data, anchor_tx_var.datalen);
1773         Transaction_free(anchor_tx_var);
1774         uint32_t input_conv = input;
1775         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 13, (uint32_t)anchor_tx_arr, input_conv, 0, 0, 0, 0);
1776         void* ret_ptr = untag_ptr(ret);
1777         CHECK_ACCESS(ret_ptr);
1778         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1779         FREE(untag_ptr(ret));
1780         return ret_conv;
1781 }
1782 LDKCResult_ECDSASignatureNoneZ sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
1783         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1784         LDKUnsignedChannelAnnouncement msg_var = *msg;
1785         uint64_t msg_ref = 0;
1786         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
1787         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1788         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
1789         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 14, msg_ref, 0, 0, 0, 0, 0);
1790         void* ret_ptr = untag_ptr(ret);
1791         CHECK_ACCESS(ret_ptr);
1792         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1793         FREE(untag_ptr(ret));
1794         return ret_conv;
1795 }
1796 static void LDKEcdsaChannelSigner_JCalls_cloned(LDKEcdsaChannelSigner* new_obj) {
1797         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) new_obj->this_arg;
1798         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1799         atomic_fetch_add_explicit(&j_calls->ChannelSigner->refcnt, 1, memory_order_release);
1800 }
1801 static inline LDKEcdsaChannelSigner LDKEcdsaChannelSigner_init (JSValue o, JSValue ChannelSigner, uint64_t pubkeys) {
1802         LDKEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKEcdsaChannelSigner_JCalls), "LDKEcdsaChannelSigner_JCalls");
1803         atomic_init(&calls->refcnt, 1);
1804         calls->instance_ptr = o;
1805
1806         LDKChannelPublicKeys pubkeys_conv;
1807         pubkeys_conv.inner = untag_ptr(pubkeys);
1808         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
1809         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
1810
1811         LDKEcdsaChannelSigner ret = {
1812                 .this_arg = (void*) calls,
1813                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall,
1814                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall,
1815                 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKEcdsaChannelSigner_jcall,
1816                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall,
1817                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall,
1818                 .sign_holder_htlc_transaction = sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall,
1819                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall,
1820                 .sign_closing_transaction = sign_closing_transaction_LDKEcdsaChannelSigner_jcall,
1821                 .sign_holder_anchor_input = sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall,
1822                 .sign_channel_announcement_with_funding_key = sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall,
1823                 .free = LDKEcdsaChannelSigner_JCalls_free,
1824                 .ChannelSigner = LDKChannelSigner_init(ChannelSigner, pubkeys),
1825         };
1826         calls->ChannelSigner = ret.ChannelSigner.this_arg;
1827         return ret;
1828 }
1829 uint64_t  __attribute__((export_name("TS_LDKEcdsaChannelSigner_new"))) TS_LDKEcdsaChannelSigner_new(JSValue o, JSValue ChannelSigner, uint64_t pubkeys) {
1830         LDKEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
1831         *res_ptr = LDKEcdsaChannelSigner_init(o, ChannelSigner, pubkeys);
1832         return tag_ptr(res_ptr, true);
1833 }
1834 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) {
1835         void* this_arg_ptr = untag_ptr(this_arg);
1836         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1837         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
1838         LDKCommitmentTransaction commitment_tx_conv;
1839         commitment_tx_conv.inner = untag_ptr(commitment_tx);
1840         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
1841         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
1842         commitment_tx_conv.is_owned = false;
1843         LDKCVec_ThirtyTwoBytesZ preimages_constr;
1844         preimages_constr.datalen = preimages->arr_len;
1845         if (preimages_constr.datalen > 0)
1846                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
1847         else
1848                 preimages_constr.data = NULL;
1849         int8_tArray* preimages_vals = (void*) preimages->elems;
1850         for (size_t m = 0; m < preimages_constr.datalen; m++) {
1851                 int8_tArray preimages_conv_12 = preimages_vals[m];
1852                 LDKThirtyTwoBytes preimages_conv_12_ref;
1853                 CHECK(preimages_conv_12->arr_len == 32);
1854                 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
1855                 preimages_constr.data[m] = preimages_conv_12_ref;
1856         }
1857         FREE(preimages);
1858         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
1859         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
1860         return tag_ptr(ret_conv, true);
1861 }
1862
1863 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) {
1864         void* this_arg_ptr = untag_ptr(this_arg);
1865         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1866         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
1867         uint8_t secret_arr[32];
1868         CHECK(secret->arr_len == 32);
1869         memcpy(secret_arr, secret->elems, 32); FREE(secret);
1870         uint8_t (*secret_ref)[32] = &secret_arr;
1871         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
1872         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
1873         return tag_ptr(ret_conv, true);
1874 }
1875
1876 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) {
1877         void* this_arg_ptr = untag_ptr(this_arg);
1878         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1879         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
1880         LDKHolderCommitmentTransaction commitment_tx_conv;
1881         commitment_tx_conv.inner = untag_ptr(commitment_tx);
1882         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
1883         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
1884         commitment_tx_conv.is_owned = false;
1885         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
1886         *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
1887         return tag_ptr(ret_conv, true);
1888 }
1889
1890 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) {
1891         void* this_arg_ptr = untag_ptr(this_arg);
1892         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1893         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
1894         LDKTransaction justice_tx_ref;
1895         justice_tx_ref.datalen = justice_tx->arr_len;
1896         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1897         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
1898         justice_tx_ref.data_is_owned = true;
1899         uint8_t per_commitment_key_arr[32];
1900         CHECK(per_commitment_key->arr_len == 32);
1901         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
1902         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1903         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
1904         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
1905         return tag_ptr(ret_conv, true);
1906 }
1907
1908 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) {
1909         void* this_arg_ptr = untag_ptr(this_arg);
1910         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1911         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
1912         LDKTransaction justice_tx_ref;
1913         justice_tx_ref.datalen = justice_tx->arr_len;
1914         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1915         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
1916         justice_tx_ref.data_is_owned = true;
1917         uint8_t per_commitment_key_arr[32];
1918         CHECK(per_commitment_key->arr_len == 32);
1919         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
1920         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1921         LDKHTLCOutputInCommitment htlc_conv;
1922         htlc_conv.inner = untag_ptr(htlc);
1923         htlc_conv.is_owned = ptr_is_owned(htlc);
1924         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
1925         htlc_conv.is_owned = false;
1926         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
1927         *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);
1928         return tag_ptr(ret_conv, true);
1929 }
1930
1931 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) {
1932         void* this_arg_ptr = untag_ptr(this_arg);
1933         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1934         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
1935         LDKTransaction htlc_tx_ref;
1936         htlc_tx_ref.datalen = htlc_tx->arr_len;
1937         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
1938         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
1939         htlc_tx_ref.data_is_owned = true;
1940         LDKHTLCDescriptor htlc_descriptor_conv;
1941         htlc_descriptor_conv.inner = untag_ptr(htlc_descriptor);
1942         htlc_descriptor_conv.is_owned = ptr_is_owned(htlc_descriptor);
1943         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_conv);
1944         htlc_descriptor_conv.is_owned = false;
1945         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
1946         *ret_conv = (this_arg_conv->sign_holder_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_ref, input, &htlc_descriptor_conv);
1947         return tag_ptr(ret_conv, true);
1948 }
1949
1950 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) {
1951         void* this_arg_ptr = untag_ptr(this_arg);
1952         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1953         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
1954         LDKTransaction htlc_tx_ref;
1955         htlc_tx_ref.datalen = htlc_tx->arr_len;
1956         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
1957         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
1958         htlc_tx_ref.data_is_owned = true;
1959         LDKPublicKey per_commitment_point_ref;
1960         CHECK(per_commitment_point->arr_len == 33);
1961         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
1962         LDKHTLCOutputInCommitment htlc_conv;
1963         htlc_conv.inner = untag_ptr(htlc);
1964         htlc_conv.is_owned = ptr_is_owned(htlc);
1965         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
1966         htlc_conv.is_owned = false;
1967         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
1968         *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);
1969         return tag_ptr(ret_conv, true);
1970 }
1971
1972 uint64_t  __attribute__((export_name("TS_EcdsaChannelSigner_sign_closing_transaction"))) TS_EcdsaChannelSigner_sign_closing_transaction(uint64_t this_arg, uint64_t closing_tx) {
1973         void* this_arg_ptr = untag_ptr(this_arg);
1974         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1975         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
1976         LDKClosingTransaction closing_tx_conv;
1977         closing_tx_conv.inner = untag_ptr(closing_tx);
1978         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
1979         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
1980         closing_tx_conv.is_owned = false;
1981         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
1982         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
1983         return tag_ptr(ret_conv, true);
1984 }
1985
1986 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) {
1987         void* this_arg_ptr = untag_ptr(this_arg);
1988         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1989         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
1990         LDKTransaction anchor_tx_ref;
1991         anchor_tx_ref.datalen = anchor_tx->arr_len;
1992         anchor_tx_ref.data = MALLOC(anchor_tx_ref.datalen, "LDKTransaction Bytes");
1993         memcpy(anchor_tx_ref.data, anchor_tx->elems, anchor_tx_ref.datalen); FREE(anchor_tx);
1994         anchor_tx_ref.data_is_owned = true;
1995         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
1996         *ret_conv = (this_arg_conv->sign_holder_anchor_input)(this_arg_conv->this_arg, anchor_tx_ref, input);
1997         return tag_ptr(ret_conv, true);
1998 }
1999
2000 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) {
2001         void* this_arg_ptr = untag_ptr(this_arg);
2002         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2003         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2004         LDKUnsignedChannelAnnouncement msg_conv;
2005         msg_conv.inner = untag_ptr(msg);
2006         msg_conv.is_owned = ptr_is_owned(msg);
2007         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
2008         msg_conv.is_owned = false;
2009         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2010         *ret_conv = (this_arg_conv->sign_channel_announcement_with_funding_key)(this_arg_conv->this_arg, &msg_conv);
2011         return tag_ptr(ret_conv, true);
2012 }
2013
2014 typedef struct LDKWriteableEcdsaChannelSigner_JCalls {
2015         atomic_size_t refcnt;
2016         uint32_t instance_ptr;
2017         LDKEcdsaChannelSigner_JCalls* EcdsaChannelSigner;
2018         LDKChannelSigner_JCalls* ChannelSigner;
2019 } LDKWriteableEcdsaChannelSigner_JCalls;
2020 static void LDKWriteableEcdsaChannelSigner_JCalls_free(void* this_arg) {
2021         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
2022         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2023                 FREE(j_calls);
2024         }
2025 }
2026 LDKCVec_u8Z write_LDKWriteableEcdsaChannelSigner_jcall(const void* this_arg) {
2027         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
2028         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 15, 0, 0, 0, 0, 0, 0);
2029         LDKCVec_u8Z ret_ref;
2030         ret_ref.datalen = ret->arr_len;
2031         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2032         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
2033         return ret_ref;
2034 }
2035 static void LDKWriteableEcdsaChannelSigner_JCalls_cloned(LDKWriteableEcdsaChannelSigner* new_obj) {
2036         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) new_obj->this_arg;
2037         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2038         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->refcnt, 1, memory_order_release);
2039         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->ChannelSigner->refcnt, 1, memory_order_release);
2040 }
2041 static inline LDKWriteableEcdsaChannelSigner LDKWriteableEcdsaChannelSigner_init (JSValue o, JSValue EcdsaChannelSigner, JSValue ChannelSigner, uint64_t pubkeys) {
2042         LDKWriteableEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner_JCalls), "LDKWriteableEcdsaChannelSigner_JCalls");
2043         atomic_init(&calls->refcnt, 1);
2044         calls->instance_ptr = o;
2045
2046         LDKChannelPublicKeys pubkeys_conv;
2047         pubkeys_conv.inner = untag_ptr(pubkeys);
2048         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
2049         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2050
2051         LDKWriteableEcdsaChannelSigner ret = {
2052                 .this_arg = (void*) calls,
2053                 .write = write_LDKWriteableEcdsaChannelSigner_jcall,
2054                 .cloned = LDKWriteableEcdsaChannelSigner_JCalls_cloned,
2055                 .free = LDKWriteableEcdsaChannelSigner_JCalls_free,
2056                 .EcdsaChannelSigner = LDKEcdsaChannelSigner_init(EcdsaChannelSigner, ChannelSigner, pubkeys),
2057         };
2058         calls->EcdsaChannelSigner = ret.EcdsaChannelSigner.this_arg;
2059         calls->ChannelSigner = ret.EcdsaChannelSigner.ChannelSigner.this_arg;
2060         return ret;
2061 }
2062 uint64_t  __attribute__((export_name("TS_LDKWriteableEcdsaChannelSigner_new"))) TS_LDKWriteableEcdsaChannelSigner_new(JSValue o, JSValue EcdsaChannelSigner, JSValue ChannelSigner, uint64_t pubkeys) {
2063         LDKWriteableEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
2064         *res_ptr = LDKWriteableEcdsaChannelSigner_init(o, EcdsaChannelSigner, ChannelSigner, pubkeys);
2065         return tag_ptr(res_ptr, true);
2066 }
2067 int8_tArray  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_write"))) TS_WriteableEcdsaChannelSigner_write(uint64_t this_arg) {
2068         void* this_arg_ptr = untag_ptr(this_arg);
2069         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2070         LDKWriteableEcdsaChannelSigner* this_arg_conv = (LDKWriteableEcdsaChannelSigner*)this_arg_ptr;
2071         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2072         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2073         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2074         CVec_u8Z_free(ret_var);
2075         return ret_arr;
2076 }
2077
2078 static inline struct LDKWriteableEcdsaChannelSigner CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
2079 CHECK(owner->result_ok);
2080         return WriteableEcdsaChannelSigner_clone(&*owner->contents.result);
2081 }
2082 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(uint64_t owner) {
2083         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
2084         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
2085         *ret_ret = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(owner_conv);
2086         return tag_ptr(ret_ret, true);
2087 }
2088
2089 static inline struct LDKDecodeError CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
2090 CHECK(!owner->result_ok);
2091         return DecodeError_clone(&*owner->contents.err);
2092 }
2093 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(uint64_t owner) {
2094         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
2095         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2096         *ret_copy = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(owner_conv);
2097         uint64_t ret_ref = tag_ptr(ret_copy, true);
2098         return ret_ref;
2099 }
2100
2101 static inline struct LDKCVec_u8Z CResult_CVec_u8ZNoneZ_get_ok(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
2102 CHECK(owner->result_ok);
2103         return CVec_u8Z_clone(&*owner->contents.result);
2104 }
2105 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_get_ok"))) TS_CResult_CVec_u8ZNoneZ_get_ok(uint64_t owner) {
2106         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
2107         LDKCVec_u8Z ret_var = CResult_CVec_u8ZNoneZ_get_ok(owner_conv);
2108         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2109         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2110         CVec_u8Z_free(ret_var);
2111         return ret_arr;
2112 }
2113
2114 static inline void CResult_CVec_u8ZNoneZ_get_err(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
2115 CHECK(!owner->result_ok);
2116         return *owner->contents.err;
2117 }
2118 void  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_get_err"))) TS_CResult_CVec_u8ZNoneZ_get_err(uint64_t owner) {
2119         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
2120         CResult_CVec_u8ZNoneZ_get_err(owner_conv);
2121 }
2122
2123 static inline struct LDKShutdownScript CResult_ShutdownScriptNoneZ_get_ok(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
2124         LDKShutdownScript ret = *owner->contents.result;
2125         ret.is_owned = false;
2126         return ret;
2127 }
2128 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_get_ok"))) TS_CResult_ShutdownScriptNoneZ_get_ok(uint64_t owner) {
2129         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
2130         LDKShutdownScript ret_var = CResult_ShutdownScriptNoneZ_get_ok(owner_conv);
2131         uint64_t ret_ref = 0;
2132         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2133         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2134         return ret_ref;
2135 }
2136
2137 static inline void CResult_ShutdownScriptNoneZ_get_err(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
2138 CHECK(!owner->result_ok);
2139         return *owner->contents.err;
2140 }
2141 void  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_get_err"))) TS_CResult_ShutdownScriptNoneZ_get_err(uint64_t owner) {
2142         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
2143         CResult_ShutdownScriptNoneZ_get_err(owner_conv);
2144 }
2145
2146 uint32_t __attribute__((export_name("TS_LDKCOption_u16Z_ty_from_ptr"))) TS_LDKCOption_u16Z_ty_from_ptr(uint64_t ptr) {
2147         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
2148         switch(obj->tag) {
2149                 case LDKCOption_u16Z_Some: return 0;
2150                 case LDKCOption_u16Z_None: return 1;
2151                 default: abort();
2152         }
2153 }
2154 int16_t __attribute__((export_name("TS_LDKCOption_u16Z_Some_get_some"))) TS_LDKCOption_u16Z_Some_get_some(uint64_t ptr) {
2155         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
2156         assert(obj->tag == LDKCOption_u16Z_Some);
2157                         int16_t some_conv = obj->some;
2158         return some_conv;
2159 }
2160 uint32_t __attribute__((export_name("TS_LDKCOption_boolZ_ty_from_ptr"))) TS_LDKCOption_boolZ_ty_from_ptr(uint64_t ptr) {
2161         LDKCOption_boolZ *obj = (LDKCOption_boolZ*)untag_ptr(ptr);
2162         switch(obj->tag) {
2163                 case LDKCOption_boolZ_Some: return 0;
2164                 case LDKCOption_boolZ_None: return 1;
2165                 default: abort();
2166         }
2167 }
2168 jboolean __attribute__((export_name("TS_LDKCOption_boolZ_Some_get_some"))) TS_LDKCOption_boolZ_Some_get_some(uint64_t ptr) {
2169         LDKCOption_boolZ *obj = (LDKCOption_boolZ*)untag_ptr(ptr);
2170         assert(obj->tag == LDKCOption_boolZ_Some);
2171                         jboolean some_conv = obj->some;
2172         return some_conv;
2173 }
2174 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
2175         LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
2176         for (size_t i = 0; i < ret.datalen; i++) {
2177                 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
2178         }
2179         return ret;
2180 }
2181 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
2182 CHECK(owner->result_ok);
2183         return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
2184 }
2185 ptrArray  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok(uint64_t owner) {
2186         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
2187         LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
2188         ptrArray ret_arr = NULL;
2189         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
2190         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
2191         for (size_t m = 0; m < ret_var.datalen; m++) {
2192                 LDKCVec_u8Z ret_conv_12_var = ret_var.data[m];
2193                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
2194                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
2195                 CVec_u8Z_free(ret_conv_12_var);
2196                 ret_arr_ptr[m] = ret_conv_12_arr;
2197         }
2198         
2199         FREE(ret_var.data);
2200         return ret_arr;
2201 }
2202
2203 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
2204 CHECK(!owner->result_ok);
2205         return *owner->contents.err;
2206 }
2207 void  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_err(uint64_t owner) {
2208         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
2209         CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
2210 }
2211
2212 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
2213         LDKInMemorySigner ret = *owner->contents.result;
2214         ret.is_owned = false;
2215         return ret;
2216 }
2217 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_get_ok(uint64_t owner) {
2218         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
2219         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
2220         uint64_t ret_ref = 0;
2221         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2222         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2223         return ret_ref;
2224 }
2225
2226 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
2227 CHECK(!owner->result_ok);
2228         return DecodeError_clone(&*owner->contents.err);
2229 }
2230 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_err"))) TS_CResult_InMemorySignerDecodeErrorZ_get_err(uint64_t owner) {
2231         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
2232         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2233         *ret_copy = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
2234         uint64_t ret_ref = tag_ptr(ret_copy, true);
2235         return ret_ref;
2236 }
2237
2238 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
2239 CHECK(owner->result_ok);
2240         return *owner->contents.result;
2241 }
2242 int8_tArray  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_ok"))) TS_CResult_TransactionNoneZ_get_ok(uint64_t owner) {
2243         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
2244         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
2245         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2246         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2247         return ret_arr;
2248 }
2249
2250 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
2251 CHECK(!owner->result_ok);
2252         return *owner->contents.err;
2253 }
2254 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_err"))) TS_CResult_TransactionNoneZ_get_err(uint64_t owner) {
2255         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
2256         CResult_TransactionNoneZ_get_err(owner_conv);
2257 }
2258
2259 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
2260         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
2261         for (size_t i = 0; i < ret.datalen; i++) {
2262                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
2263         }
2264         return ret;
2265 }
2266 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
2267         LDKRoute ret = *owner->contents.result;
2268         ret.is_owned = false;
2269         return ret;
2270 }
2271 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_ok"))) TS_CResult_RouteLightningErrorZ_get_ok(uint64_t owner) {
2272         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
2273         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
2274         uint64_t ret_ref = 0;
2275         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2276         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2277         return ret_ref;
2278 }
2279
2280 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
2281         LDKLightningError ret = *owner->contents.err;
2282         ret.is_owned = false;
2283         return ret;
2284 }
2285 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_err"))) TS_CResult_RouteLightningErrorZ_get_err(uint64_t owner) {
2286         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
2287         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
2288         uint64_t ret_ref = 0;
2289         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2290         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2291         return ret_ref;
2292 }
2293
2294 static inline struct LDKInFlightHtlcs CResult_InFlightHtlcsDecodeErrorZ_get_ok(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
2295         LDKInFlightHtlcs ret = *owner->contents.result;
2296         ret.is_owned = false;
2297         return ret;
2298 }
2299 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok(uint64_t owner) {
2300         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
2301         LDKInFlightHtlcs ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_ok(owner_conv);
2302         uint64_t ret_ref = 0;
2303         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2304         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2305         return ret_ref;
2306 }
2307
2308 static inline struct LDKDecodeError CResult_InFlightHtlcsDecodeErrorZ_get_err(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
2309 CHECK(!owner->result_ok);
2310         return DecodeError_clone(&*owner->contents.err);
2311 }
2312 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_err(uint64_t owner) {
2313         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
2314         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2315         *ret_copy = CResult_InFlightHtlcsDecodeErrorZ_get_err(owner_conv);
2316         uint64_t ret_ref = tag_ptr(ret_copy, true);
2317         return ret_ref;
2318 }
2319
2320 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
2321         LDKRouteHop ret = *owner->contents.result;
2322         ret.is_owned = false;
2323         return ret;
2324 }
2325 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHopDecodeErrorZ_get_ok(uint64_t owner) {
2326         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
2327         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
2328         uint64_t ret_ref = 0;
2329         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2330         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2331         return ret_ref;
2332 }
2333
2334 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
2335 CHECK(!owner->result_ok);
2336         return DecodeError_clone(&*owner->contents.err);
2337 }
2338 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_err"))) TS_CResult_RouteHopDecodeErrorZ_get_err(uint64_t owner) {
2339         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
2340         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2341         *ret_copy = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
2342         uint64_t ret_ref = tag_ptr(ret_copy, true);
2343         return ret_ref;
2344 }
2345
2346 static inline LDKCVec_BlindedHopZ CVec_BlindedHopZ_clone(const LDKCVec_BlindedHopZ *orig) {
2347         LDKCVec_BlindedHopZ ret = { .data = MALLOC(sizeof(LDKBlindedHop) * orig->datalen, "LDKCVec_BlindedHopZ clone bytes"), .datalen = orig->datalen };
2348         for (size_t i = 0; i < ret.datalen; i++) {
2349                 ret.data[i] = BlindedHop_clone(&orig->data[i]);
2350         }
2351         return ret;
2352 }
2353 static inline struct LDKBlindedTail CResult_BlindedTailDecodeErrorZ_get_ok(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
2354         LDKBlindedTail ret = *owner->contents.result;
2355         ret.is_owned = false;
2356         return ret;
2357 }
2358 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_get_ok"))) TS_CResult_BlindedTailDecodeErrorZ_get_ok(uint64_t owner) {
2359         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
2360         LDKBlindedTail ret_var = CResult_BlindedTailDecodeErrorZ_get_ok(owner_conv);
2361         uint64_t ret_ref = 0;
2362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2364         return ret_ref;
2365 }
2366
2367 static inline struct LDKDecodeError CResult_BlindedTailDecodeErrorZ_get_err(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
2368 CHECK(!owner->result_ok);
2369         return DecodeError_clone(&*owner->contents.err);
2370 }
2371 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_get_err"))) TS_CResult_BlindedTailDecodeErrorZ_get_err(uint64_t owner) {
2372         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
2373         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2374         *ret_copy = CResult_BlindedTailDecodeErrorZ_get_err(owner_conv);
2375         uint64_t ret_ref = tag_ptr(ret_copy, true);
2376         return ret_ref;
2377 }
2378
2379 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
2380         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
2381         for (size_t i = 0; i < ret.datalen; i++) {
2382                 ret.data[i] = RouteHop_clone(&orig->data[i]);
2383         }
2384         return ret;
2385 }
2386 static inline LDKCVec_PathZ CVec_PathZ_clone(const LDKCVec_PathZ *orig) {
2387         LDKCVec_PathZ ret = { .data = MALLOC(sizeof(LDKPath) * orig->datalen, "LDKCVec_PathZ clone bytes"), .datalen = orig->datalen };
2388         for (size_t i = 0; i < ret.datalen; i++) {
2389                 ret.data[i] = Path_clone(&orig->data[i]);
2390         }
2391         return ret;
2392 }
2393 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
2394         LDKRoute ret = *owner->contents.result;
2395         ret.is_owned = false;
2396         return ret;
2397 }
2398 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_ok"))) TS_CResult_RouteDecodeErrorZ_get_ok(uint64_t owner) {
2399         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
2400         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
2401         uint64_t ret_ref = 0;
2402         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2403         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2404         return ret_ref;
2405 }
2406
2407 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
2408 CHECK(!owner->result_ok);
2409         return DecodeError_clone(&*owner->contents.err);
2410 }
2411 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_err"))) TS_CResult_RouteDecodeErrorZ_get_err(uint64_t owner) {
2412         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
2413         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2414         *ret_copy = CResult_RouteDecodeErrorZ_get_err(owner_conv);
2415         uint64_t ret_ref = tag_ptr(ret_copy, true);
2416         return ret_ref;
2417 }
2418
2419 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
2420         LDKRouteParameters ret = *owner->contents.result;
2421         ret.is_owned = false;
2422         return ret;
2423 }
2424 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_ok"))) TS_CResult_RouteParametersDecodeErrorZ_get_ok(uint64_t owner) {
2425         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
2426         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
2427         uint64_t ret_ref = 0;
2428         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2429         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2430         return ret_ref;
2431 }
2432
2433 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
2434 CHECK(!owner->result_ok);
2435         return DecodeError_clone(&*owner->contents.err);
2436 }
2437 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_err"))) TS_CResult_RouteParametersDecodeErrorZ_get_err(uint64_t owner) {
2438         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
2439         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2440         *ret_copy = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
2441         uint64_t ret_ref = tag_ptr(ret_copy, true);
2442         return ret_ref;
2443 }
2444
2445 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
2446         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
2447         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
2448         return ret;
2449 }
2450 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
2451         LDKPaymentParameters ret = *owner->contents.result;
2452         ret.is_owned = false;
2453         return ret;
2454 }
2455 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_get_ok(uint64_t owner) {
2456         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
2457         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
2458         uint64_t ret_ref = 0;
2459         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2460         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2461         return ret_ref;
2462 }
2463
2464 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
2465 CHECK(!owner->result_ok);
2466         return DecodeError_clone(&*owner->contents.err);
2467 }
2468 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_err"))) TS_CResult_PaymentParametersDecodeErrorZ_get_err(uint64_t owner) {
2469         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
2470         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2471         *ret_copy = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
2472         uint64_t ret_ref = tag_ptr(ret_copy, true);
2473         return ret_ref;
2474 }
2475
2476 static inline struct LDKBlindedPayInfo C2Tuple_BlindedPayInfoBlindedPathZ_get_a(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
2477         LDKBlindedPayInfo ret = owner->a;
2478         ret.is_owned = false;
2479         return ret;
2480 }
2481 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_a"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_a(uint64_t owner) {
2482         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
2483         LDKBlindedPayInfo ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_a(owner_conv);
2484         uint64_t ret_ref = 0;
2485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2486         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2487         return ret_ref;
2488 }
2489
2490 static inline struct LDKBlindedPath C2Tuple_BlindedPayInfoBlindedPathZ_get_b(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
2491         LDKBlindedPath ret = owner->b;
2492         ret.is_owned = false;
2493         return ret;
2494 }
2495 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_b"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_b(uint64_t owner) {
2496         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
2497         LDKBlindedPath ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_b(owner_conv);
2498         uint64_t ret_ref = 0;
2499         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2500         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2501         return ret_ref;
2502 }
2503
2504 static inline LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(const LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ *orig) {
2505         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ) * orig->datalen, "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ clone bytes"), .datalen = orig->datalen };
2506         for (size_t i = 0; i < ret.datalen; i++) {
2507                 ret.data[i] = C2Tuple_BlindedPayInfoBlindedPathZ_clone(&orig->data[i]);
2508         }
2509         return ret;
2510 }
2511 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
2512         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
2513         for (size_t i = 0; i < ret.datalen; i++) {
2514                 ret.data[i] = RouteHint_clone(&orig->data[i]);
2515         }
2516         return ret;
2517 }
2518 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
2519         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
2520         for (size_t i = 0; i < ret.datalen; i++) {
2521                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
2522         }
2523         return ret;
2524 }
2525 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
2526         LDKRouteHint ret = *owner->contents.result;
2527         ret.is_owned = false;
2528         return ret;
2529 }
2530 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_ok"))) TS_CResult_RouteHintDecodeErrorZ_get_ok(uint64_t owner) {
2531         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
2532         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
2533         uint64_t ret_ref = 0;
2534         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2535         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2536         return ret_ref;
2537 }
2538
2539 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
2540 CHECK(!owner->result_ok);
2541         return DecodeError_clone(&*owner->contents.err);
2542 }
2543 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_err"))) TS_CResult_RouteHintDecodeErrorZ_get_err(uint64_t owner) {
2544         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
2545         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2546         *ret_copy = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
2547         uint64_t ret_ref = tag_ptr(ret_copy, true);
2548         return ret_ref;
2549 }
2550
2551 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
2552         LDKRouteHintHop ret = *owner->contents.result;
2553         ret.is_owned = false;
2554         return ret;
2555 }
2556 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_get_ok(uint64_t owner) {
2557         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
2558         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
2559         uint64_t ret_ref = 0;
2560         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2561         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2562         return ret_ref;
2563 }
2564
2565 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
2566 CHECK(!owner->result_ok);
2567         return DecodeError_clone(&*owner->contents.err);
2568 }
2569 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_err"))) TS_CResult_RouteHintHopDecodeErrorZ_get_err(uint64_t owner) {
2570         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
2571         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2572         *ret_copy = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
2573         uint64_t ret_ref = tag_ptr(ret_copy, true);
2574         return ret_ref;
2575 }
2576
2577 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2578         LDKFixedPenaltyScorer ret = *owner->contents.result;
2579         ret.is_owned = false;
2580         return ret;
2581 }
2582 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(uint64_t owner) {
2583         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
2584         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
2585         uint64_t ret_ref = 0;
2586         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2587         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2588         return ret_ref;
2589 }
2590
2591 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2592 CHECK(!owner->result_ok);
2593         return DecodeError_clone(&*owner->contents.err);
2594 }
2595 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err(uint64_t owner) {
2596         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
2597         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2598         *ret_copy = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
2599         uint64_t ret_ref = tag_ptr(ret_copy, true);
2600         return ret_ref;
2601 }
2602
2603 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
2604         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
2605         for (size_t i = 0; i < ret.datalen; i++) {
2606                 ret.data[i] = NodeId_clone(&orig->data[i]);
2607         }
2608         return ret;
2609 }
2610 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
2611         return owner->a;
2612 }
2613 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_a"))) TS_C2Tuple_u64u64Z_get_a(uint64_t owner) {
2614         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
2615         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
2616         return ret_conv;
2617 }
2618
2619 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
2620         return owner->b;
2621 }
2622 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_b"))) TS_C2Tuple_u64u64Z_get_b(uint64_t owner) {
2623         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
2624         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
2625         return ret_conv;
2626 }
2627
2628 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr(uint64_t ptr) {
2629         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
2630         switch(obj->tag) {
2631                 case LDKCOption_C2Tuple_u64u64ZZ_Some: return 0;
2632                 case LDKCOption_C2Tuple_u64u64ZZ_None: return 1;
2633                 default: abort();
2634         }
2635 }
2636 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some(uint64_t ptr) {
2637         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
2638         assert(obj->tag == LDKCOption_C2Tuple_u64u64ZZ_Some);
2639                         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
2640                         *some_conv = obj->some;
2641                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
2642         return tag_ptr(some_conv, true);
2643 }
2644 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_a(LDKC2Tuple_Z *NONNULL_PTR owner){
2645         return owner->a;
2646 }
2647 int16_tArray  __attribute__((export_name("TS_C2Tuple_Z_get_a"))) TS_C2Tuple_Z_get_a(uint64_t owner) {
2648         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
2649         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
2650         memcpy(ret_arr->elems, C2Tuple_Z_get_a(owner_conv).data, 32 * 2);
2651         return ret_arr;
2652 }
2653
2654 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_b(LDKC2Tuple_Z *NONNULL_PTR owner){
2655         return owner->b;
2656 }
2657 int16_tArray  __attribute__((export_name("TS_C2Tuple_Z_get_b"))) TS_C2Tuple_Z_get_b(uint64_t owner) {
2658         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
2659         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
2660         memcpy(ret_arr->elems, C2Tuple_Z_get_b(owner_conv).data, 32 * 2);
2661         return ret_arr;
2662 }
2663
2664 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_a(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
2665         return owner->a;
2666 }
2667 int16_tArray  __attribute__((export_name("TS_C2Tuple__u1632_u1632Z_get_a"))) TS_C2Tuple__u1632_u1632Z_get_a(uint64_t owner) {
2668         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
2669         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
2670         memcpy(ret_arr->elems, C2Tuple__u1632_u1632Z_get_a(owner_conv).data, 32 * 2);
2671         return ret_arr;
2672 }
2673
2674 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_b(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
2675         return owner->b;
2676 }
2677 int16_tArray  __attribute__((export_name("TS_C2Tuple__u1632_u1632Z_get_b"))) TS_C2Tuple__u1632_u1632Z_get_b(uint64_t owner) {
2678         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
2679         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
2680         memcpy(ret_arr->elems, C2Tuple__u1632_u1632Z_get_b(owner_conv).data, 32 * 2);
2681         return ret_arr;
2682 }
2683
2684 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_ty_from_ptr(uint64_t ptr) {
2685         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *obj = (LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)untag_ptr(ptr);
2686         switch(obj->tag) {
2687                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some: return 0;
2688                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None: return 1;
2689                 default: abort();
2690         }
2691 }
2692 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_get_some(uint64_t ptr) {
2693         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *obj = (LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)untag_ptr(ptr);
2694         assert(obj->tag == LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some);
2695                         LDKC2Tuple__u1632_u1632Z* some_conv = &obj->some;
2696                         // WARNING: we really need to clone here, but no clone is available for LDKC2Tuple__u1632_u1632Z
2697         return tag_ptr(some_conv, false);
2698 }
2699 uint32_t __attribute__((export_name("TS_LDKCOption_f64Z_ty_from_ptr"))) TS_LDKCOption_f64Z_ty_from_ptr(uint64_t ptr) {
2700         LDKCOption_f64Z *obj = (LDKCOption_f64Z*)untag_ptr(ptr);
2701         switch(obj->tag) {
2702                 case LDKCOption_f64Z_Some: return 0;
2703                 case LDKCOption_f64Z_None: return 1;
2704                 default: abort();
2705         }
2706 }
2707 double __attribute__((export_name("TS_LDKCOption_f64Z_Some_get_some"))) TS_LDKCOption_f64Z_Some_get_some(uint64_t ptr) {
2708         LDKCOption_f64Z *obj = (LDKCOption_f64Z*)untag_ptr(ptr);
2709         assert(obj->tag == LDKCOption_f64Z_Some);
2710                         double some_conv = obj->some;
2711         return some_conv;
2712 }
2713 typedef struct LDKLogger_JCalls {
2714         atomic_size_t refcnt;
2715         uint32_t instance_ptr;
2716 } LDKLogger_JCalls;
2717 static void LDKLogger_JCalls_free(void* this_arg) {
2718         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2719         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2720                 FREE(j_calls);
2721         }
2722 }
2723 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
2724         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2725         LDKRecord record_var = *record;
2726         uint64_t record_ref = 0;
2727         record_var = Record_clone(&record_var);
2728         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
2729         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
2730         js_invoke_function_buuuuu(j_calls->instance_ptr, 16, record_ref, 0, 0, 0, 0, 0);
2731 }
2732 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
2733         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
2734         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2735 }
2736 static inline LDKLogger LDKLogger_init (JSValue o) {
2737         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
2738         atomic_init(&calls->refcnt, 1);
2739         calls->instance_ptr = o;
2740
2741         LDKLogger ret = {
2742                 .this_arg = (void*) calls,
2743                 .log = log_LDKLogger_jcall,
2744                 .free = LDKLogger_JCalls_free,
2745         };
2746         return ret;
2747 }
2748 uint64_t  __attribute__((export_name("TS_LDKLogger_new"))) TS_LDKLogger_new(JSValue o) {
2749         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
2750         *res_ptr = LDKLogger_init(o);
2751         return tag_ptr(res_ptr, true);
2752 }
2753 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
2754         LDKProbabilisticScorer ret = *owner->contents.result;
2755         ret.is_owned = false;
2756         return ret;
2757 }
2758 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok(uint64_t owner) {
2759         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
2760         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
2761         uint64_t ret_ref = 0;
2762         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2763         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2764         return ret_ref;
2765 }
2766
2767 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
2768 CHECK(!owner->result_ok);
2769         return DecodeError_clone(&*owner->contents.err);
2770 }
2771 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err(uint64_t owner) {
2772         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
2773         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2774         *ret_copy = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
2775         uint64_t ret_ref = tag_ptr(ret_copy, true);
2776         return ret_ref;
2777 }
2778
2779 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2780         return owner->a;
2781 }
2782 uint32_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_a"))) TS_C2Tuple_usizeTransactionZ_get_a(uint64_t owner) {
2783         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
2784         uint32_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
2785         return ret_conv;
2786 }
2787
2788 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2789         return owner->b;
2790 }
2791 int8_tArray  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_b"))) TS_C2Tuple_usizeTransactionZ_get_b(uint64_t owner) {
2792         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
2793         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
2794         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2795         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2796         return ret_arr;
2797 }
2798
2799 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
2800         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
2801         for (size_t i = 0; i < ret.datalen; i++) {
2802                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
2803         }
2804         return ret;
2805 }
2806 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
2807         return ThirtyTwoBytes_clone(&owner->a);
2808 }
2809 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_a(uint64_t owner) {
2810         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)untag_ptr(owner);
2811         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
2812         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_a(owner_conv).data, 32);
2813         return ret_arr;
2814 }
2815
2816 static inline struct LDKCOption_ThirtyTwoBytesZ C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
2817         return COption_ThirtyTwoBytesZ_clone(&owner->b);
2818 }
2819 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_b(uint64_t owner) {
2820         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)untag_ptr(owner);
2821         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
2822         *ret_copy = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_b(owner_conv);
2823         uint64_t ret_ref = tag_ptr(ret_copy, true);
2824         return ret_ref;
2825 }
2826
2827 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ *orig) {
2828         LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ clone bytes"), .datalen = orig->datalen };
2829         for (size_t i = 0; i < ret.datalen; i++) {
2830                 ret.data[i] = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone(&orig->data[i]);
2831         }
2832         return ret;
2833 }
2834 static inline enum LDKChannelMonitorUpdateStatus CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
2835 CHECK(owner->result_ok);
2836         return ChannelMonitorUpdateStatus_clone(&*owner->contents.result);
2837 }
2838 uint32_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_get_ok"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(uint64_t owner) {
2839         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
2840         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(owner_conv));
2841         return ret_conv;
2842 }
2843
2844 static inline void CResult_ChannelMonitorUpdateStatusNoneZ_get_err(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
2845 CHECK(!owner->result_ok);
2846         return *owner->contents.err;
2847 }
2848 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_get_err"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_get_err(uint64_t owner) {
2849         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
2850         CResult_ChannelMonitorUpdateStatusNoneZ_get_err(owner_conv);
2851 }
2852
2853 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_ty_from_ptr"))) TS_LDKMonitorEvent_ty_from_ptr(uint64_t ptr) {
2854         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2855         switch(obj->tag) {
2856                 case LDKMonitorEvent_HTLCEvent: return 0;
2857                 case LDKMonitorEvent_HolderForceClosed: return 1;
2858                 case LDKMonitorEvent_Completed: return 2;
2859                 default: abort();
2860         }
2861 }
2862 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HTLCEvent_get_htlc_event"))) TS_LDKMonitorEvent_HTLCEvent_get_htlc_event(uint64_t ptr) {
2863         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2864         assert(obj->tag == LDKMonitorEvent_HTLCEvent);
2865                         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
2866                         uint64_t htlc_event_ref = 0;
2867                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
2868                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
2869         return htlc_event_ref;
2870 }
2871 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HolderForceClosed_get_holder_force_closed"))) TS_LDKMonitorEvent_HolderForceClosed_get_holder_force_closed(uint64_t ptr) {
2872         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2873         assert(obj->tag == LDKMonitorEvent_HolderForceClosed);
2874                         LDKOutPoint holder_force_closed_var = obj->holder_force_closed;
2875                         uint64_t holder_force_closed_ref = 0;
2876                         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_force_closed_var);
2877                         holder_force_closed_ref = tag_ptr(holder_force_closed_var.inner, false);
2878         return holder_force_closed_ref;
2879 }
2880 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_funding_txo"))) TS_LDKMonitorEvent_Completed_get_funding_txo(uint64_t ptr) {
2881         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2882         assert(obj->tag == LDKMonitorEvent_Completed);
2883                         LDKOutPoint funding_txo_var = obj->completed.funding_txo;
2884                         uint64_t funding_txo_ref = 0;
2885                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
2886                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
2887         return funding_txo_ref;
2888 }
2889 int64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_monitor_update_id"))) TS_LDKMonitorEvent_Completed_get_monitor_update_id(uint64_t ptr) {
2890         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2891         assert(obj->tag == LDKMonitorEvent_Completed);
2892                         int64_t monitor_update_id_conv = obj->completed.monitor_update_id;
2893         return monitor_update_id_conv;
2894 }
2895 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
2896         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
2897         for (size_t i = 0; i < ret.datalen; i++) {
2898                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
2899         }
2900         return ret;
2901 }
2902 static inline struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2903         LDKOutPoint ret = owner->a;
2904         ret.is_owned = false;
2905         return ret;
2906 }
2907 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(uint64_t owner) {
2908         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2909         LDKOutPoint ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
2910         uint64_t ret_ref = 0;
2911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2913         return ret_ref;
2914 }
2915
2916 static inline struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2917         return CVec_MonitorEventZ_clone(&owner->b);
2918 }
2919 uint64_tArray  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(uint64_t owner) {
2920         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2921         LDKCVec_MonitorEventZ ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
2922         uint64_tArray ret_arr = NULL;
2923         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
2924         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
2925         for (size_t o = 0; o < ret_var.datalen; o++) {
2926                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
2927                 *ret_conv_14_copy = ret_var.data[o];
2928                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
2929                 ret_arr_ptr[o] = ret_conv_14_ref;
2930         }
2931         
2932         FREE(ret_var.data);
2933         return ret_arr;
2934 }
2935
2936 static inline struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2937         return owner->c;
2938 }
2939 int8_tArray  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(uint64_t owner) {
2940         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2941         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
2942         memcpy(ret_arr->elems, C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(owner_conv).compressed_form, 33);
2943         return ret_arr;
2944 }
2945
2946 static inline LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ *orig) {
2947         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
2948         for (size_t i = 0; i < ret.datalen; i++) {
2949                 ret.data[i] = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
2950         }
2951         return ret;
2952 }
2953 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
2954         LDKInitFeatures ret = *owner->contents.result;
2955         ret.is_owned = false;
2956         return ret;
2957 }
2958 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2959         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
2960         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
2961         uint64_t ret_ref = 0;
2962         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2963         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2964         return ret_ref;
2965 }
2966
2967 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
2968 CHECK(!owner->result_ok);
2969         return DecodeError_clone(&*owner->contents.err);
2970 }
2971 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_err"))) TS_CResult_InitFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2972         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
2973         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2974         *ret_copy = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
2975         uint64_t ret_ref = tag_ptr(ret_copy, true);
2976         return ret_ref;
2977 }
2978
2979 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
2980         LDKChannelFeatures ret = *owner->contents.result;
2981         ret.is_owned = false;
2982         return ret;
2983 }
2984 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2985         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
2986         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
2987         uint64_t ret_ref = 0;
2988         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2989         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2990         return ret_ref;
2991 }
2992
2993 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
2994 CHECK(!owner->result_ok);
2995         return DecodeError_clone(&*owner->contents.err);
2996 }
2997 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2998         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
2999         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3000         *ret_copy = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
3001         uint64_t ret_ref = tag_ptr(ret_copy, true);
3002         return ret_ref;
3003 }
3004
3005 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3006         LDKNodeFeatures ret = *owner->contents.result;
3007         ret.is_owned = false;
3008         return ret;
3009 }
3010 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3011         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
3012         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
3013         uint64_t ret_ref = 0;
3014         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3015         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3016         return ret_ref;
3017 }
3018
3019 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3020 CHECK(!owner->result_ok);
3021         return DecodeError_clone(&*owner->contents.err);
3022 }
3023 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3024         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
3025         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3026         *ret_copy = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
3027         uint64_t ret_ref = tag_ptr(ret_copy, true);
3028         return ret_ref;
3029 }
3030
3031 static inline struct LDKBolt11InvoiceFeatures CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3032         LDKBolt11InvoiceFeatures ret = *owner->contents.result;
3033         ret.is_owned = false;
3034         return ret;
3035 }
3036 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3037         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3038         LDKBolt11InvoiceFeatures ret_var = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3039         uint64_t ret_ref = 0;
3040         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3041         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3042         return ret_ref;
3043 }
3044
3045 static inline struct LDKDecodeError CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3046 CHECK(!owner->result_ok);
3047         return DecodeError_clone(&*owner->contents.err);
3048 }
3049 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3050         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3051         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3052         *ret_copy = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3053         uint64_t ret_ref = tag_ptr(ret_copy, true);
3054         return ret_ref;
3055 }
3056
3057 static inline struct LDKBolt12InvoiceFeatures CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3058         LDKBolt12InvoiceFeatures ret = *owner->contents.result;
3059         ret.is_owned = false;
3060         return ret;
3061 }
3062 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3063         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3064         LDKBolt12InvoiceFeatures ret_var = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3065         uint64_t ret_ref = 0;
3066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3068         return ret_ref;
3069 }
3070
3071 static inline struct LDKDecodeError CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3072 CHECK(!owner->result_ok);
3073         return DecodeError_clone(&*owner->contents.err);
3074 }
3075 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3076         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3077         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3078         *ret_copy = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3079         uint64_t ret_ref = tag_ptr(ret_copy, true);
3080         return ret_ref;
3081 }
3082
3083 static inline struct LDKBlindedHopFeatures CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
3084         LDKBlindedHopFeatures ret = *owner->contents.result;
3085         ret.is_owned = false;
3086         return ret;
3087 }
3088 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3089         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
3090         LDKBlindedHopFeatures ret_var = CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(owner_conv);
3091         uint64_t ret_ref = 0;
3092         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3093         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3094         return ret_ref;
3095 }
3096
3097 static inline struct LDKDecodeError CResult_BlindedHopFeaturesDecodeErrorZ_get_err(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
3098 CHECK(!owner->result_ok);
3099         return DecodeError_clone(&*owner->contents.err);
3100 }
3101 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_err"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3102         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
3103         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3104         *ret_copy = CResult_BlindedHopFeaturesDecodeErrorZ_get_err(owner_conv);
3105         uint64_t ret_ref = tag_ptr(ret_copy, true);
3106         return ret_ref;
3107 }
3108
3109 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3110         LDKChannelTypeFeatures ret = *owner->contents.result;
3111         ret.is_owned = false;
3112         return ret;
3113 }
3114 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3115         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
3116         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
3117         uint64_t ret_ref = 0;
3118         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3119         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3120         return ret_ref;
3121 }
3122
3123 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3124 CHECK(!owner->result_ok);
3125         return DecodeError_clone(&*owner->contents.err);
3126 }
3127 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3128         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
3129         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3130         *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
3131         uint64_t ret_ref = tag_ptr(ret_copy, true);
3132         return ret_ref;
3133 }
3134
3135 static inline struct LDKOffer CResult_OfferBolt12ParseErrorZ_get_ok(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
3136         LDKOffer ret = *owner->contents.result;
3137         ret.is_owned = false;
3138         return ret;
3139 }
3140 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_get_ok"))) TS_CResult_OfferBolt12ParseErrorZ_get_ok(uint64_t owner) {
3141         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
3142         LDKOffer ret_var = CResult_OfferBolt12ParseErrorZ_get_ok(owner_conv);
3143         uint64_t ret_ref = 0;
3144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3146         return ret_ref;
3147 }
3148
3149 static inline struct LDKBolt12ParseError CResult_OfferBolt12ParseErrorZ_get_err(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
3150         LDKBolt12ParseError ret = *owner->contents.err;
3151         ret.is_owned = false;
3152         return ret;
3153 }
3154 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_get_err"))) TS_CResult_OfferBolt12ParseErrorZ_get_err(uint64_t owner) {
3155         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
3156         LDKBolt12ParseError ret_var = CResult_OfferBolt12ParseErrorZ_get_err(owner_conv);
3157         uint64_t ret_ref = 0;
3158         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3159         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3160         return ret_ref;
3161 }
3162
3163 static inline struct LDKPublicKey CResult_PublicKeySecp256k1ErrorZ_get_ok(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
3164 CHECK(owner->result_ok);
3165         return *owner->contents.result;
3166 }
3167 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_get_ok"))) TS_CResult_PublicKeySecp256k1ErrorZ_get_ok(uint64_t owner) {
3168         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
3169         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3170         memcpy(ret_arr->elems, CResult_PublicKeySecp256k1ErrorZ_get_ok(owner_conv).compressed_form, 33);
3171         return ret_arr;
3172 }
3173
3174 static inline enum LDKSecp256k1Error CResult_PublicKeySecp256k1ErrorZ_get_err(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
3175 CHECK(!owner->result_ok);
3176         return *owner->contents.err;
3177 }
3178 uint32_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_get_err"))) TS_CResult_PublicKeySecp256k1ErrorZ_get_err(uint64_t owner) {
3179         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
3180         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PublicKeySecp256k1ErrorZ_get_err(owner_conv));
3181         return ret_conv;
3182 }
3183
3184 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3185         LDKNodeId ret = *owner->contents.result;
3186         ret.is_owned = false;
3187         return ret;
3188 }
3189 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_ok"))) TS_CResult_NodeIdDecodeErrorZ_get_ok(uint64_t owner) {
3190         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
3191         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
3192         uint64_t ret_ref = 0;
3193         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3194         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3195         return ret_ref;
3196 }
3197
3198 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3199 CHECK(!owner->result_ok);
3200         return DecodeError_clone(&*owner->contents.err);
3201 }
3202 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_err"))) TS_CResult_NodeIdDecodeErrorZ_get_err(uint64_t owner) {
3203         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
3204         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3205         *ret_copy = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
3206         uint64_t ret_ref = tag_ptr(ret_copy, true);
3207         return ret_ref;
3208 }
3209
3210 uint32_t __attribute__((export_name("TS_LDKNetworkUpdate_ty_from_ptr"))) TS_LDKNetworkUpdate_ty_from_ptr(uint64_t ptr) {
3211         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3212         switch(obj->tag) {
3213                 case LDKNetworkUpdate_ChannelUpdateMessage: return 0;
3214                 case LDKNetworkUpdate_ChannelFailure: return 1;
3215                 case LDKNetworkUpdate_NodeFailure: return 2;
3216                 default: abort();
3217         }
3218 }
3219 uint64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg"))) TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg(uint64_t ptr) {
3220         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3221         assert(obj->tag == LDKNetworkUpdate_ChannelUpdateMessage);
3222                         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
3223                         uint64_t msg_ref = 0;
3224                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3225                         msg_ref = tag_ptr(msg_var.inner, false);
3226         return msg_ref;
3227 }
3228 int64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id"))) TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id(uint64_t ptr) {
3229         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3230         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
3231                         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
3232         return short_channel_id_conv;
3233 }
3234 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent"))) TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent(uint64_t ptr) {
3235         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3236         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
3237                         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
3238         return is_permanent_conv;
3239 }
3240 int8_tArray __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_node_id"))) TS_LDKNetworkUpdate_NodeFailure_get_node_id(uint64_t ptr) {
3241         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3242         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
3243                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3244                         memcpy(node_id_arr->elems, obj->node_failure.node_id.compressed_form, 33);
3245         return node_id_arr;
3246 }
3247 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_is_permanent"))) TS_LDKNetworkUpdate_NodeFailure_get_is_permanent(uint64_t ptr) {
3248         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3249         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
3250                         jboolean is_permanent_conv = obj->node_failure.is_permanent;
3251         return is_permanent_conv;
3252 }
3253 uint32_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_ty_from_ptr"))) TS_LDKCOption_NetworkUpdateZ_ty_from_ptr(uint64_t ptr) {
3254         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
3255         switch(obj->tag) {
3256                 case LDKCOption_NetworkUpdateZ_Some: return 0;
3257                 case LDKCOption_NetworkUpdateZ_None: return 1;
3258                 default: abort();
3259         }
3260 }
3261 uint64_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_Some_get_some"))) TS_LDKCOption_NetworkUpdateZ_Some_get_some(uint64_t ptr) {
3262         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
3263         assert(obj->tag == LDKCOption_NetworkUpdateZ_Some);
3264                         uint64_t some_ref = tag_ptr(&obj->some, false);
3265         return some_ref;
3266 }
3267 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3268 CHECK(owner->result_ok);
3269         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
3270 }
3271 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(uint64_t owner) {
3272         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
3273         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
3274         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
3275         uint64_t ret_ref = tag_ptr(ret_copy, true);
3276         return ret_ref;
3277 }
3278
3279 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3280 CHECK(!owner->result_ok);
3281         return DecodeError_clone(&*owner->contents.err);
3282 }
3283 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(uint64_t owner) {
3284         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
3285         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3286         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
3287         uint64_t ret_ref = tag_ptr(ret_copy, true);
3288         return ret_ref;
3289 }
3290
3291 static inline struct LDKTxOut CResult_TxOutUtxoLookupErrorZ_get_ok(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
3292 CHECK(owner->result_ok);
3293         return TxOut_clone(&*owner->contents.result);
3294 }
3295 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_get_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_get_ok(uint64_t owner) {
3296         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
3297         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
3298         *ret_ref = CResult_TxOutUtxoLookupErrorZ_get_ok(owner_conv);
3299         return tag_ptr(ret_ref, true);
3300 }
3301
3302 static inline enum LDKUtxoLookupError CResult_TxOutUtxoLookupErrorZ_get_err(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
3303 CHECK(!owner->result_ok);
3304         return UtxoLookupError_clone(&*owner->contents.err);
3305 }
3306 uint32_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_get_err"))) TS_CResult_TxOutUtxoLookupErrorZ_get_err(uint64_t owner) {
3307         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
3308         uint32_t ret_conv = LDKUtxoLookupError_to_js(CResult_TxOutUtxoLookupErrorZ_get_err(owner_conv));
3309         return ret_conv;
3310 }
3311
3312 uint32_t __attribute__((export_name("TS_LDKUtxoResult_ty_from_ptr"))) TS_LDKUtxoResult_ty_from_ptr(uint64_t ptr) {
3313         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
3314         switch(obj->tag) {
3315                 case LDKUtxoResult_Sync: return 0;
3316                 case LDKUtxoResult_Async: return 1;
3317                 default: abort();
3318         }
3319 }
3320 uint64_t __attribute__((export_name("TS_LDKUtxoResult_Sync_get_sync"))) TS_LDKUtxoResult_Sync_get_sync(uint64_t ptr) {
3321         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
3322         assert(obj->tag == LDKUtxoResult_Sync);
3323                         LDKCResult_TxOutUtxoLookupErrorZ* sync_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
3324                         *sync_conv = obj->sync;
3325                         *sync_conv = CResult_TxOutUtxoLookupErrorZ_clone(sync_conv);
3326         return tag_ptr(sync_conv, true);
3327 }
3328 uint64_t __attribute__((export_name("TS_LDKUtxoResult_Async_get_async"))) TS_LDKUtxoResult_Async_get_async(uint64_t ptr) {
3329         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
3330         assert(obj->tag == LDKUtxoResult_Async);
3331                         LDKUtxoFuture async_var = obj->async;
3332                         uint64_t async_ref = 0;
3333                         CHECK_INNER_FIELD_ACCESS_OR_NULL(async_var);
3334                         async_ref = tag_ptr(async_var.inner, false);
3335         return async_ref;
3336 }
3337 typedef struct LDKUtxoLookup_JCalls {
3338         atomic_size_t refcnt;
3339         uint32_t instance_ptr;
3340 } LDKUtxoLookup_JCalls;
3341 static void LDKUtxoLookup_JCalls_free(void* this_arg) {
3342         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
3343         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3344                 FREE(j_calls);
3345         }
3346 }
3347 LDKUtxoResult get_utxo_LDKUtxoLookup_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
3348         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
3349         int8_tArray genesis_hash_arr = init_int8_tArray(32, __LINE__);
3350         memcpy(genesis_hash_arr->elems, *genesis_hash, 32);
3351         int64_t short_channel_id_conv = short_channel_id;
3352         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);
3353         void* ret_ptr = untag_ptr(ret);
3354         CHECK_ACCESS(ret_ptr);
3355         LDKUtxoResult ret_conv = *(LDKUtxoResult*)(ret_ptr);
3356         FREE(untag_ptr(ret));
3357         return ret_conv;
3358 }
3359 static void LDKUtxoLookup_JCalls_cloned(LDKUtxoLookup* new_obj) {
3360         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) new_obj->this_arg;
3361         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3362 }
3363 static inline LDKUtxoLookup LDKUtxoLookup_init (JSValue o) {
3364         LDKUtxoLookup_JCalls *calls = MALLOC(sizeof(LDKUtxoLookup_JCalls), "LDKUtxoLookup_JCalls");
3365         atomic_init(&calls->refcnt, 1);
3366         calls->instance_ptr = o;
3367
3368         LDKUtxoLookup ret = {
3369                 .this_arg = (void*) calls,
3370                 .get_utxo = get_utxo_LDKUtxoLookup_jcall,
3371                 .free = LDKUtxoLookup_JCalls_free,
3372         };
3373         return ret;
3374 }
3375 uint64_t  __attribute__((export_name("TS_LDKUtxoLookup_new"))) TS_LDKUtxoLookup_new(JSValue o) {
3376         LDKUtxoLookup *res_ptr = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
3377         *res_ptr = LDKUtxoLookup_init(o);
3378         return tag_ptr(res_ptr, true);
3379 }
3380 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) {
3381         void* this_arg_ptr = untag_ptr(this_arg);
3382         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3383         LDKUtxoLookup* this_arg_conv = (LDKUtxoLookup*)this_arg_ptr;
3384         uint8_t genesis_hash_arr[32];
3385         CHECK(genesis_hash->arr_len == 32);
3386         memcpy(genesis_hash_arr, genesis_hash->elems, 32); FREE(genesis_hash);
3387         uint8_t (*genesis_hash_ref)[32] = &genesis_hash_arr;
3388         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
3389         *ret_copy = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
3390         uint64_t ret_ref = tag_ptr(ret_copy, true);
3391         return ret_ref;
3392 }
3393
3394 uint32_t __attribute__((export_name("TS_LDKCOption_UtxoLookupZ_ty_from_ptr"))) TS_LDKCOption_UtxoLookupZ_ty_from_ptr(uint64_t ptr) {
3395         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
3396         switch(obj->tag) {
3397                 case LDKCOption_UtxoLookupZ_Some: return 0;
3398                 case LDKCOption_UtxoLookupZ_None: return 1;
3399                 default: abort();
3400         }
3401 }
3402 uint64_t __attribute__((export_name("TS_LDKCOption_UtxoLookupZ_Some_get_some"))) TS_LDKCOption_UtxoLookupZ_Some_get_some(uint64_t ptr) {
3403         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
3404         assert(obj->tag == LDKCOption_UtxoLookupZ_Some);
3405                         LDKUtxoLookup* some_ret = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
3406                         *some_ret = obj->some;
3407                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
3408                         if ((*some_ret).free == LDKUtxoLookup_JCalls_free) {
3409                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3410                                 LDKUtxoLookup_JCalls_cloned(&(*some_ret));
3411                         }
3412         return tag_ptr(some_ret, true);
3413 }
3414 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3415 CHECK(owner->result_ok);
3416         return *owner->contents.result;
3417 }
3418 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_ok"))) TS_CResult_NoneLightningErrorZ_get_ok(uint64_t owner) {
3419         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3420         CResult_NoneLightningErrorZ_get_ok(owner_conv);
3421 }
3422
3423 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3424         LDKLightningError ret = *owner->contents.err;
3425         ret.is_owned = false;
3426         return ret;
3427 }
3428 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_err"))) TS_CResult_NoneLightningErrorZ_get_err(uint64_t owner) {
3429         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3430         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
3431         uint64_t ret_ref = 0;
3432         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3433         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3434         return ret_ref;
3435 }
3436
3437 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3438 CHECK(owner->result_ok);
3439         return *owner->contents.result;
3440 }
3441 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_ok"))) TS_CResult_boolLightningErrorZ_get_ok(uint64_t owner) {
3442         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
3443         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
3444         return ret_conv;
3445 }
3446
3447 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3448         LDKLightningError ret = *owner->contents.err;
3449         ret.is_owned = false;
3450         return ret;
3451 }
3452 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_err"))) TS_CResult_boolLightningErrorZ_get_err(uint64_t owner) {
3453         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
3454         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
3455         uint64_t ret_ref = 0;
3456         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3457         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3458         return ret_ref;
3459 }
3460
3461 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3462         LDKChannelAnnouncement ret = owner->a;
3463         ret.is_owned = false;
3464         return ret;
3465 }
3466 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint64_t owner) {
3467         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3468         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
3469         uint64_t ret_ref = 0;
3470         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3471         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3472         return ret_ref;
3473 }
3474
3475 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3476         LDKChannelUpdate ret = owner->b;
3477         ret.is_owned = false;
3478         return ret;
3479 }
3480 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint64_t owner) {
3481         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3482         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
3483         uint64_t ret_ref = 0;
3484         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3485         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3486         return ret_ref;
3487 }
3488
3489 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3490         LDKChannelUpdate ret = owner->c;
3491         ret.is_owned = false;
3492         return ret;
3493 }
3494 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint64_t owner) {
3495         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3496         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
3497         uint64_t ret_ref = 0;
3498         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3499         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3500         return ret_ref;
3501 }
3502
3503 uint32_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr(uint64_t ptr) {
3504         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
3505         switch(obj->tag) {
3506                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some: return 0;
3507                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None: return 1;
3508                 default: abort();
3509         }
3510 }
3511 uint64_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some(uint64_t ptr) {
3512         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
3513         assert(obj->tag == LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some);
3514                         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* some_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
3515                         *some_conv = obj->some;
3516                         *some_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(some_conv);
3517         return tag_ptr(some_conv, true);
3518 }
3519 uint32_t __attribute__((export_name("TS_LDKErrorAction_ty_from_ptr"))) TS_LDKErrorAction_ty_from_ptr(uint64_t ptr) {
3520         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3521         switch(obj->tag) {
3522                 case LDKErrorAction_DisconnectPeer: return 0;
3523                 case LDKErrorAction_DisconnectPeerWithWarning: return 1;
3524                 case LDKErrorAction_IgnoreError: return 2;
3525                 case LDKErrorAction_IgnoreAndLog: return 3;
3526                 case LDKErrorAction_IgnoreDuplicateGossip: return 4;
3527                 case LDKErrorAction_SendErrorMessage: return 5;
3528                 case LDKErrorAction_SendWarningMessage: return 6;
3529                 default: abort();
3530         }
3531 }
3532 uint64_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeer_get_msg"))) TS_LDKErrorAction_DisconnectPeer_get_msg(uint64_t ptr) {
3533         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3534         assert(obj->tag == LDKErrorAction_DisconnectPeer);
3535                         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
3536                         uint64_t msg_ref = 0;
3537                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3538                         msg_ref = tag_ptr(msg_var.inner, false);
3539         return msg_ref;
3540 }
3541 uint64_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeerWithWarning_get_msg"))) TS_LDKErrorAction_DisconnectPeerWithWarning_get_msg(uint64_t ptr) {
3542         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3543         assert(obj->tag == LDKErrorAction_DisconnectPeerWithWarning);
3544                         LDKWarningMessage msg_var = obj->disconnect_peer_with_warning.msg;
3545                         uint64_t msg_ref = 0;
3546                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3547                         msg_ref = tag_ptr(msg_var.inner, false);
3548         return msg_ref;
3549 }
3550 uint32_t __attribute__((export_name("TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log"))) TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log(uint64_t ptr) {
3551         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3552         assert(obj->tag == LDKErrorAction_IgnoreAndLog);
3553                         uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
3554         return ignore_and_log_conv;
3555 }
3556 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendErrorMessage_get_msg"))) TS_LDKErrorAction_SendErrorMessage_get_msg(uint64_t ptr) {
3557         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3558         assert(obj->tag == LDKErrorAction_SendErrorMessage);
3559                         LDKErrorMessage msg_var = obj->send_error_message.msg;
3560                         uint64_t msg_ref = 0;
3561                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3562                         msg_ref = tag_ptr(msg_var.inner, false);
3563         return msg_ref;
3564 }
3565 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_msg"))) TS_LDKErrorAction_SendWarningMessage_get_msg(uint64_t ptr) {
3566         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3567         assert(obj->tag == LDKErrorAction_SendWarningMessage);
3568                         LDKWarningMessage msg_var = obj->send_warning_message.msg;
3569                         uint64_t msg_ref = 0;
3570                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3571                         msg_ref = tag_ptr(msg_var.inner, false);
3572         return msg_ref;
3573 }
3574 uint32_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_log_level"))) TS_LDKErrorAction_SendWarningMessage_get_log_level(uint64_t ptr) {
3575         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3576         assert(obj->tag == LDKErrorAction_SendWarningMessage);
3577                         uint32_t log_level_conv = LDKLevel_to_js(obj->send_warning_message.log_level);
3578         return log_level_conv;
3579 }
3580 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_ty_from_ptr"))) TS_LDKMessageSendEvent_ty_from_ptr(uint64_t ptr) {
3581         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3582         switch(obj->tag) {
3583                 case LDKMessageSendEvent_SendAcceptChannel: return 0;
3584                 case LDKMessageSendEvent_SendAcceptChannelV2: return 1;
3585                 case LDKMessageSendEvent_SendOpenChannel: return 2;
3586                 case LDKMessageSendEvent_SendOpenChannelV2: return 3;
3587                 case LDKMessageSendEvent_SendFundingCreated: return 4;
3588                 case LDKMessageSendEvent_SendFundingSigned: return 5;
3589                 case LDKMessageSendEvent_SendTxAddInput: return 6;
3590                 case LDKMessageSendEvent_SendTxAddOutput: return 7;
3591                 case LDKMessageSendEvent_SendTxRemoveInput: return 8;
3592                 case LDKMessageSendEvent_SendTxRemoveOutput: return 9;
3593                 case LDKMessageSendEvent_SendTxComplete: return 10;
3594                 case LDKMessageSendEvent_SendTxSignatures: return 11;
3595                 case LDKMessageSendEvent_SendTxInitRbf: return 12;
3596                 case LDKMessageSendEvent_SendTxAckRbf: return 13;
3597                 case LDKMessageSendEvent_SendTxAbort: return 14;
3598                 case LDKMessageSendEvent_SendChannelReady: return 15;
3599                 case LDKMessageSendEvent_SendAnnouncementSignatures: return 16;
3600                 case LDKMessageSendEvent_UpdateHTLCs: return 17;
3601                 case LDKMessageSendEvent_SendRevokeAndACK: return 18;
3602                 case LDKMessageSendEvent_SendClosingSigned: return 19;
3603                 case LDKMessageSendEvent_SendShutdown: return 20;
3604                 case LDKMessageSendEvent_SendChannelReestablish: return 21;
3605                 case LDKMessageSendEvent_SendChannelAnnouncement: return 22;
3606                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: return 23;
3607                 case LDKMessageSendEvent_BroadcastChannelUpdate: return 24;
3608                 case LDKMessageSendEvent_BroadcastNodeAnnouncement: return 25;
3609                 case LDKMessageSendEvent_SendChannelUpdate: return 26;
3610                 case LDKMessageSendEvent_HandleError: return 27;
3611                 case LDKMessageSendEvent_SendChannelRangeQuery: return 28;
3612                 case LDKMessageSendEvent_SendShortIdsQuery: return 29;
3613                 case LDKMessageSendEvent_SendReplyChannelRange: return 30;
3614                 case LDKMessageSendEvent_SendGossipTimestampFilter: return 31;
3615                 default: abort();
3616         }
3617 }
3618 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id(uint64_t ptr) {
3619         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3620         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
3621                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3622                         memcpy(node_id_arr->elems, obj->send_accept_channel.node_id.compressed_form, 33);
3623         return node_id_arr;
3624 }
3625 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_msg(uint64_t ptr) {
3626         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3627         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
3628                         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
3629                         uint64_t msg_ref = 0;
3630                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3631                         msg_ref = tag_ptr(msg_var.inner, false);
3632         return msg_ref;
3633 }
3634 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannelV2_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannelV2_get_node_id(uint64_t ptr) {
3635         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3636         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannelV2);
3637                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3638                         memcpy(node_id_arr->elems, obj->send_accept_channel_v2.node_id.compressed_form, 33);
3639         return node_id_arr;
3640 }
3641 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannelV2_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannelV2_get_msg(uint64_t ptr) {
3642         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3643         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannelV2);
3644                         LDKAcceptChannelV2 msg_var = obj->send_accept_channel_v2.msg;
3645                         uint64_t msg_ref = 0;
3646                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3647                         msg_ref = tag_ptr(msg_var.inner, false);
3648         return msg_ref;
3649 }
3650 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannel_get_node_id(uint64_t ptr) {
3651         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3652         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
3653                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3654                         memcpy(node_id_arr->elems, obj->send_open_channel.node_id.compressed_form, 33);
3655         return node_id_arr;
3656 }
3657 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannel_get_msg(uint64_t ptr) {
3658         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3659         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
3660                         LDKOpenChannel msg_var = obj->send_open_channel.msg;
3661                         uint64_t msg_ref = 0;
3662                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3663                         msg_ref = tag_ptr(msg_var.inner, false);
3664         return msg_ref;
3665 }
3666 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannelV2_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannelV2_get_node_id(uint64_t ptr) {
3667         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3668         assert(obj->tag == LDKMessageSendEvent_SendOpenChannelV2);
3669                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3670                         memcpy(node_id_arr->elems, obj->send_open_channel_v2.node_id.compressed_form, 33);
3671         return node_id_arr;
3672 }
3673 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannelV2_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannelV2_get_msg(uint64_t ptr) {
3674         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3675         assert(obj->tag == LDKMessageSendEvent_SendOpenChannelV2);
3676                         LDKOpenChannelV2 msg_var = obj->send_open_channel_v2.msg;
3677                         uint64_t msg_ref = 0;
3678                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3679                         msg_ref = tag_ptr(msg_var.inner, false);
3680         return msg_ref;
3681 }
3682 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_node_id"))) TS_LDKMessageSendEvent_SendFundingCreated_get_node_id(uint64_t ptr) {
3683         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3684         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
3685                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3686                         memcpy(node_id_arr->elems, obj->send_funding_created.node_id.compressed_form, 33);
3687         return node_id_arr;
3688 }
3689 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_msg"))) TS_LDKMessageSendEvent_SendFundingCreated_get_msg(uint64_t ptr) {
3690         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3691         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
3692                         LDKFundingCreated msg_var = obj->send_funding_created.msg;
3693                         uint64_t msg_ref = 0;
3694                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3695                         msg_ref = tag_ptr(msg_var.inner, false);
3696         return msg_ref;
3697 }
3698 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendFundingSigned_get_node_id(uint64_t ptr) {
3699         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3700         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
3701                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3702                         memcpy(node_id_arr->elems, obj->send_funding_signed.node_id.compressed_form, 33);
3703         return node_id_arr;
3704 }
3705 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_msg"))) TS_LDKMessageSendEvent_SendFundingSigned_get_msg(uint64_t ptr) {
3706         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3707         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
3708                         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
3709                         uint64_t msg_ref = 0;
3710                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3711                         msg_ref = tag_ptr(msg_var.inner, false);
3712         return msg_ref;
3713 }
3714 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddInput_get_node_id"))) TS_LDKMessageSendEvent_SendTxAddInput_get_node_id(uint64_t ptr) {
3715         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3716         assert(obj->tag == LDKMessageSendEvent_SendTxAddInput);
3717                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3718                         memcpy(node_id_arr->elems, obj->send_tx_add_input.node_id.compressed_form, 33);
3719         return node_id_arr;
3720 }
3721 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddInput_get_msg"))) TS_LDKMessageSendEvent_SendTxAddInput_get_msg(uint64_t ptr) {
3722         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3723         assert(obj->tag == LDKMessageSendEvent_SendTxAddInput);
3724                         LDKTxAddInput msg_var = obj->send_tx_add_input.msg;
3725                         uint64_t msg_ref = 0;
3726                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3727                         msg_ref = tag_ptr(msg_var.inner, false);
3728         return msg_ref;
3729 }
3730 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddOutput_get_node_id"))) TS_LDKMessageSendEvent_SendTxAddOutput_get_node_id(uint64_t ptr) {
3731         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3732         assert(obj->tag == LDKMessageSendEvent_SendTxAddOutput);
3733                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3734                         memcpy(node_id_arr->elems, obj->send_tx_add_output.node_id.compressed_form, 33);
3735         return node_id_arr;
3736 }
3737 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddOutput_get_msg"))) TS_LDKMessageSendEvent_SendTxAddOutput_get_msg(uint64_t ptr) {
3738         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3739         assert(obj->tag == LDKMessageSendEvent_SendTxAddOutput);
3740                         LDKTxAddOutput msg_var = obj->send_tx_add_output.msg;
3741                         uint64_t msg_ref = 0;
3742                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3743                         msg_ref = tag_ptr(msg_var.inner, false);
3744         return msg_ref;
3745 }
3746 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveInput_get_node_id"))) TS_LDKMessageSendEvent_SendTxRemoveInput_get_node_id(uint64_t ptr) {
3747         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3748         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveInput);
3749                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3750                         memcpy(node_id_arr->elems, obj->send_tx_remove_input.node_id.compressed_form, 33);
3751         return node_id_arr;
3752 }
3753 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveInput_get_msg"))) TS_LDKMessageSendEvent_SendTxRemoveInput_get_msg(uint64_t ptr) {
3754         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3755         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveInput);
3756                         LDKTxRemoveInput msg_var = obj->send_tx_remove_input.msg;
3757                         uint64_t msg_ref = 0;
3758                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3759                         msg_ref = tag_ptr(msg_var.inner, false);
3760         return msg_ref;
3761 }
3762 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveOutput_get_node_id"))) TS_LDKMessageSendEvent_SendTxRemoveOutput_get_node_id(uint64_t ptr) {
3763         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3764         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveOutput);
3765                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3766                         memcpy(node_id_arr->elems, obj->send_tx_remove_output.node_id.compressed_form, 33);
3767         return node_id_arr;
3768 }
3769 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveOutput_get_msg"))) TS_LDKMessageSendEvent_SendTxRemoveOutput_get_msg(uint64_t ptr) {
3770         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3771         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveOutput);
3772                         LDKTxRemoveOutput msg_var = obj->send_tx_remove_output.msg;
3773                         uint64_t msg_ref = 0;
3774                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3775                         msg_ref = tag_ptr(msg_var.inner, false);
3776         return msg_ref;
3777 }
3778 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxComplete_get_node_id"))) TS_LDKMessageSendEvent_SendTxComplete_get_node_id(uint64_t ptr) {
3779         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3780         assert(obj->tag == LDKMessageSendEvent_SendTxComplete);
3781                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3782                         memcpy(node_id_arr->elems, obj->send_tx_complete.node_id.compressed_form, 33);
3783         return node_id_arr;
3784 }
3785 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxComplete_get_msg"))) TS_LDKMessageSendEvent_SendTxComplete_get_msg(uint64_t ptr) {
3786         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3787         assert(obj->tag == LDKMessageSendEvent_SendTxComplete);
3788                         LDKTxComplete msg_var = obj->send_tx_complete.msg;
3789                         uint64_t msg_ref = 0;
3790                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3791                         msg_ref = tag_ptr(msg_var.inner, false);
3792         return msg_ref;
3793 }
3794 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendTxSignatures_get_node_id(uint64_t ptr) {
3795         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3796         assert(obj->tag == LDKMessageSendEvent_SendTxSignatures);
3797                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3798                         memcpy(node_id_arr->elems, obj->send_tx_signatures.node_id.compressed_form, 33);
3799         return node_id_arr;
3800 }
3801 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxSignatures_get_msg"))) TS_LDKMessageSendEvent_SendTxSignatures_get_msg(uint64_t ptr) {
3802         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3803         assert(obj->tag == LDKMessageSendEvent_SendTxSignatures);
3804                         LDKTxSignatures msg_var = obj->send_tx_signatures.msg;
3805                         uint64_t msg_ref = 0;
3806                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3807                         msg_ref = tag_ptr(msg_var.inner, false);
3808         return msg_ref;
3809 }
3810 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxInitRbf_get_node_id"))) TS_LDKMessageSendEvent_SendTxInitRbf_get_node_id(uint64_t ptr) {
3811         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3812         assert(obj->tag == LDKMessageSendEvent_SendTxInitRbf);
3813                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3814                         memcpy(node_id_arr->elems, obj->send_tx_init_rbf.node_id.compressed_form, 33);
3815         return node_id_arr;
3816 }
3817 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxInitRbf_get_msg"))) TS_LDKMessageSendEvent_SendTxInitRbf_get_msg(uint64_t ptr) {
3818         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3819         assert(obj->tag == LDKMessageSendEvent_SendTxInitRbf);
3820                         LDKTxInitRbf msg_var = obj->send_tx_init_rbf.msg;
3821                         uint64_t msg_ref = 0;
3822                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3823                         msg_ref = tag_ptr(msg_var.inner, false);
3824         return msg_ref;
3825 }
3826 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAckRbf_get_node_id"))) TS_LDKMessageSendEvent_SendTxAckRbf_get_node_id(uint64_t ptr) {
3827         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3828         assert(obj->tag == LDKMessageSendEvent_SendTxAckRbf);
3829                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3830                         memcpy(node_id_arr->elems, obj->send_tx_ack_rbf.node_id.compressed_form, 33);
3831         return node_id_arr;
3832 }
3833 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAckRbf_get_msg"))) TS_LDKMessageSendEvent_SendTxAckRbf_get_msg(uint64_t ptr) {
3834         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3835         assert(obj->tag == LDKMessageSendEvent_SendTxAckRbf);
3836                         LDKTxAckRbf msg_var = obj->send_tx_ack_rbf.msg;
3837                         uint64_t msg_ref = 0;
3838                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3839                         msg_ref = tag_ptr(msg_var.inner, false);
3840         return msg_ref;
3841 }
3842 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAbort_get_node_id"))) TS_LDKMessageSendEvent_SendTxAbort_get_node_id(uint64_t ptr) {
3843         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3844         assert(obj->tag == LDKMessageSendEvent_SendTxAbort);
3845                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3846                         memcpy(node_id_arr->elems, obj->send_tx_abort.node_id.compressed_form, 33);
3847         return node_id_arr;
3848 }
3849 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAbort_get_msg"))) TS_LDKMessageSendEvent_SendTxAbort_get_msg(uint64_t ptr) {
3850         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3851         assert(obj->tag == LDKMessageSendEvent_SendTxAbort);
3852                         LDKTxAbort msg_var = obj->send_tx_abort.msg;
3853                         uint64_t msg_ref = 0;
3854                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3855                         msg_ref = tag_ptr(msg_var.inner, false);
3856         return msg_ref;
3857 }
3858 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReady_get_node_id(uint64_t ptr) {
3859         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3860         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
3861                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3862                         memcpy(node_id_arr->elems, obj->send_channel_ready.node_id.compressed_form, 33);
3863         return node_id_arr;
3864 }
3865 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_msg"))) TS_LDKMessageSendEvent_SendChannelReady_get_msg(uint64_t ptr) {
3866         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3867         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
3868                         LDKChannelReady msg_var = obj->send_channel_ready.msg;
3869                         uint64_t msg_ref = 0;
3870                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3871                         msg_ref = tag_ptr(msg_var.inner, false);
3872         return msg_ref;
3873 }
3874 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id(uint64_t ptr) {
3875         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3876         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
3877                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3878                         memcpy(node_id_arr->elems, obj->send_announcement_signatures.node_id.compressed_form, 33);
3879         return node_id_arr;
3880 }
3881 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg(uint64_t ptr) {
3882         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3883         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
3884                         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
3885                         uint64_t msg_ref = 0;
3886                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3887                         msg_ref = tag_ptr(msg_var.inner, false);
3888         return msg_ref;
3889 }
3890 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id(uint64_t ptr) {
3891         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3892         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
3893                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3894                         memcpy(node_id_arr->elems, obj->update_htl_cs.node_id.compressed_form, 33);
3895         return node_id_arr;
3896 }
3897 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_updates"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_updates(uint64_t ptr) {
3898         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3899         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
3900                         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
3901                         uint64_t updates_ref = 0;
3902                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
3903                         updates_ref = tag_ptr(updates_var.inner, false);
3904         return updates_ref;
3905 }
3906 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id(uint64_t ptr) {
3907         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3908         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
3909                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3910                         memcpy(node_id_arr->elems, obj->send_revoke_and_ack.node_id.compressed_form, 33);
3911         return node_id_arr;
3912 }
3913 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg(uint64_t ptr) {
3914         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3915         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
3916                         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
3917                         uint64_t msg_ref = 0;
3918                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3919                         msg_ref = tag_ptr(msg_var.inner, false);
3920         return msg_ref;
3921 }
3922 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendClosingSigned_get_node_id(uint64_t ptr) {
3923         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3924         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
3925                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3926                         memcpy(node_id_arr->elems, obj->send_closing_signed.node_id.compressed_form, 33);
3927         return node_id_arr;
3928 }
3929 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_msg"))) TS_LDKMessageSendEvent_SendClosingSigned_get_msg(uint64_t ptr) {
3930         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3931         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
3932                         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
3933                         uint64_t msg_ref = 0;
3934                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3935                         msg_ref = tag_ptr(msg_var.inner, false);
3936         return msg_ref;
3937 }
3938 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_node_id"))) TS_LDKMessageSendEvent_SendShutdown_get_node_id(uint64_t ptr) {
3939         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3940         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
3941                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3942                         memcpy(node_id_arr->elems, obj->send_shutdown.node_id.compressed_form, 33);
3943         return node_id_arr;
3944 }
3945 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_msg"))) TS_LDKMessageSendEvent_SendShutdown_get_msg(uint64_t ptr) {
3946         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3947         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
3948                         LDKShutdown msg_var = obj->send_shutdown.msg;
3949                         uint64_t msg_ref = 0;
3950                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3951                         msg_ref = tag_ptr(msg_var.inner, false);
3952         return msg_ref;
3953 }
3954 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id(uint64_t ptr) {
3955         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3956         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
3957                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3958                         memcpy(node_id_arr->elems, obj->send_channel_reestablish.node_id.compressed_form, 33);
3959         return node_id_arr;
3960 }
3961 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_msg"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_msg(uint64_t ptr) {
3962         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3963         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
3964                         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
3965                         uint64_t msg_ref = 0;
3966                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3967                         msg_ref = tag_ptr(msg_var.inner, false);
3968         return msg_ref;
3969 }
3970 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id(uint64_t ptr) {
3971         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3972         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
3973                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3974                         memcpy(node_id_arr->elems, obj->send_channel_announcement.node_id.compressed_form, 33);
3975         return node_id_arr;
3976 }
3977 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg(uint64_t ptr) {
3978         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3979         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
3980                         LDKChannelAnnouncement msg_var = obj->send_channel_announcement.msg;
3981                         uint64_t msg_ref = 0;
3982                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3983                         msg_ref = tag_ptr(msg_var.inner, false);
3984         return msg_ref;
3985 }
3986 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg(uint64_t ptr) {
3987         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3988         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
3989                         LDKChannelUpdate update_msg_var = obj->send_channel_announcement.update_msg;
3990                         uint64_t update_msg_ref = 0;
3991                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
3992                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
3993         return update_msg_ref;
3994 }
3995 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg(uint64_t ptr) {
3996         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3997         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
3998                         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
3999                         uint64_t msg_ref = 0;
4000                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4001                         msg_ref = tag_ptr(msg_var.inner, false);
4002         return msg_ref;
4003 }
4004 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg(uint64_t ptr) {
4005         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4006         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
4007                         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
4008                         uint64_t update_msg_ref = 0;
4009                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
4010                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
4011         return update_msg_ref;
4012 }
4013 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg(uint64_t ptr) {
4014         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4015         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelUpdate);
4016                         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
4017                         uint64_t msg_ref = 0;
4018                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4019                         msg_ref = tag_ptr(msg_var.inner, false);
4020         return msg_ref;
4021 }
4022 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg(uint64_t ptr) {
4023         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4024         assert(obj->tag == LDKMessageSendEvent_BroadcastNodeAnnouncement);
4025                         LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
4026                         uint64_t msg_ref = 0;
4027                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4028                         msg_ref = tag_ptr(msg_var.inner, false);
4029         return msg_ref;
4030 }
4031 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id(uint64_t ptr) {
4032         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4033         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
4034                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4035                         memcpy(node_id_arr->elems, obj->send_channel_update.node_id.compressed_form, 33);
4036         return node_id_arr;
4037 }
4038 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_msg(uint64_t ptr) {
4039         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4040         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
4041                         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
4042                         uint64_t msg_ref = 0;
4043                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4044                         msg_ref = tag_ptr(msg_var.inner, false);
4045         return msg_ref;
4046 }
4047 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_node_id"))) TS_LDKMessageSendEvent_HandleError_get_node_id(uint64_t ptr) {
4048         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4049         assert(obj->tag == LDKMessageSendEvent_HandleError);
4050                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4051                         memcpy(node_id_arr->elems, obj->handle_error.node_id.compressed_form, 33);
4052         return node_id_arr;
4053 }
4054 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_action"))) TS_LDKMessageSendEvent_HandleError_get_action(uint64_t ptr) {
4055         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4056         assert(obj->tag == LDKMessageSendEvent_HandleError);
4057                         uint64_t action_ref = tag_ptr(&obj->handle_error.action, false);
4058         return action_ref;
4059 }
4060 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id(uint64_t ptr) {
4061         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4062         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
4063                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4064                         memcpy(node_id_arr->elems, obj->send_channel_range_query.node_id.compressed_form, 33);
4065         return node_id_arr;
4066 }
4067 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg(uint64_t ptr) {
4068         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4069         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
4070                         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
4071                         uint64_t msg_ref = 0;
4072                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4073                         msg_ref = tag_ptr(msg_var.inner, false);
4074         return msg_ref;
4075 }
4076 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id(uint64_t ptr) {
4077         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4078         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
4079                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4080                         memcpy(node_id_arr->elems, obj->send_short_ids_query.node_id.compressed_form, 33);
4081         return node_id_arr;
4082 }
4083 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg(uint64_t ptr) {
4084         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4085         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
4086                         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
4087                         uint64_t msg_ref = 0;
4088                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4089                         msg_ref = tag_ptr(msg_var.inner, false);
4090         return msg_ref;
4091 }
4092 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id(uint64_t ptr) {
4093         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4094         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
4095                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4096                         memcpy(node_id_arr->elems, obj->send_reply_channel_range.node_id.compressed_form, 33);
4097         return node_id_arr;
4098 }
4099 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg(uint64_t ptr) {
4100         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4101         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
4102                         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
4103                         uint64_t msg_ref = 0;
4104                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4105                         msg_ref = tag_ptr(msg_var.inner, false);
4106         return msg_ref;
4107 }
4108 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id(uint64_t ptr) {
4109         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4110         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
4111                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4112                         memcpy(node_id_arr->elems, obj->send_gossip_timestamp_filter.node_id.compressed_form, 33);
4113         return node_id_arr;
4114 }
4115 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg(uint64_t ptr) {
4116         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4117         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
4118                         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
4119                         uint64_t msg_ref = 0;
4120                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4121                         msg_ref = tag_ptr(msg_var.inner, false);
4122         return msg_ref;
4123 }
4124 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
4125         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
4126         for (size_t i = 0; i < ret.datalen; i++) {
4127                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
4128         }
4129         return ret;
4130 }
4131 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
4132         LDKChannelUpdateInfo ret = *owner->contents.result;
4133         ret.is_owned = false;
4134         return ret;
4135 }
4136 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(uint64_t owner) {
4137         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
4138         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
4139         uint64_t ret_ref = 0;
4140         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4141         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4142         return ret_ref;
4143 }
4144
4145 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
4146 CHECK(!owner->result_ok);
4147         return DecodeError_clone(&*owner->contents.err);
4148 }
4149 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err(uint64_t owner) {
4150         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
4151         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4152         *ret_copy = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
4153         uint64_t ret_ref = tag_ptr(ret_copy, true);
4154         return ret_ref;
4155 }
4156
4157 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
4158         LDKChannelInfo ret = *owner->contents.result;
4159         ret.is_owned = false;
4160         return ret;
4161 }
4162 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_get_ok(uint64_t owner) {
4163         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
4164         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
4165         uint64_t ret_ref = 0;
4166         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4167         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4168         return ret_ref;
4169 }
4170
4171 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
4172 CHECK(!owner->result_ok);
4173         return DecodeError_clone(&*owner->contents.err);
4174 }
4175 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelInfoDecodeErrorZ_get_err(uint64_t owner) {
4176         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
4177         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4178         *ret_copy = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
4179         uint64_t ret_ref = tag_ptr(ret_copy, true);
4180         return ret_ref;
4181 }
4182
4183 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
4184         LDKRoutingFees ret = *owner->contents.result;
4185         ret.is_owned = false;
4186         return ret;
4187 }
4188 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_get_ok(uint64_t owner) {
4189         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
4190         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
4191         uint64_t ret_ref = 0;
4192         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4193         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4194         return ret_ref;
4195 }
4196
4197 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
4198 CHECK(!owner->result_ok);
4199         return DecodeError_clone(&*owner->contents.err);
4200 }
4201 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_err"))) TS_CResult_RoutingFeesDecodeErrorZ_get_err(uint64_t owner) {
4202         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
4203         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4204         *ret_copy = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
4205         uint64_t ret_ref = tag_ptr(ret_copy, true);
4206         return ret_ref;
4207 }
4208
4209 uint32_t __attribute__((export_name("TS_LDKSocketAddress_ty_from_ptr"))) TS_LDKSocketAddress_ty_from_ptr(uint64_t ptr) {
4210         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4211         switch(obj->tag) {
4212                 case LDKSocketAddress_TcpIpV4: return 0;
4213                 case LDKSocketAddress_TcpIpV6: return 1;
4214                 case LDKSocketAddress_OnionV2: return 2;
4215                 case LDKSocketAddress_OnionV3: return 3;
4216                 case LDKSocketAddress_Hostname: return 4;
4217                 default: abort();
4218         }
4219 }
4220 int8_tArray __attribute__((export_name("TS_LDKSocketAddress_TcpIpV4_get_addr"))) TS_LDKSocketAddress_TcpIpV4_get_addr(uint64_t ptr) {
4221         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4222         assert(obj->tag == LDKSocketAddress_TcpIpV4);
4223                         int8_tArray addr_arr = init_int8_tArray(4, __LINE__);
4224                         memcpy(addr_arr->elems, obj->tcp_ip_v4.addr.data, 4);
4225         return addr_arr;
4226 }
4227 int16_t __attribute__((export_name("TS_LDKSocketAddress_TcpIpV4_get_port"))) TS_LDKSocketAddress_TcpIpV4_get_port(uint64_t ptr) {
4228         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4229         assert(obj->tag == LDKSocketAddress_TcpIpV4);
4230                         int16_t port_conv = obj->tcp_ip_v4.port;
4231         return port_conv;
4232 }
4233 int8_tArray __attribute__((export_name("TS_LDKSocketAddress_TcpIpV6_get_addr"))) TS_LDKSocketAddress_TcpIpV6_get_addr(uint64_t ptr) {
4234         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4235         assert(obj->tag == LDKSocketAddress_TcpIpV6);
4236                         int8_tArray addr_arr = init_int8_tArray(16, __LINE__);
4237                         memcpy(addr_arr->elems, obj->tcp_ip_v6.addr.data, 16);
4238         return addr_arr;
4239 }
4240 int16_t __attribute__((export_name("TS_LDKSocketAddress_TcpIpV6_get_port"))) TS_LDKSocketAddress_TcpIpV6_get_port(uint64_t ptr) {
4241         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4242         assert(obj->tag == LDKSocketAddress_TcpIpV6);
4243                         int16_t port_conv = obj->tcp_ip_v6.port;
4244         return port_conv;
4245 }
4246 int8_tArray __attribute__((export_name("TS_LDKSocketAddress_OnionV2_get_onion_v2"))) TS_LDKSocketAddress_OnionV2_get_onion_v2(uint64_t ptr) {
4247         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4248         assert(obj->tag == LDKSocketAddress_OnionV2);
4249                         int8_tArray onion_v2_arr = init_int8_tArray(12, __LINE__);
4250                         memcpy(onion_v2_arr->elems, obj->onion_v2.data, 12);
4251         return onion_v2_arr;
4252 }
4253 int8_tArray __attribute__((export_name("TS_LDKSocketAddress_OnionV3_get_ed25519_pubkey"))) TS_LDKSocketAddress_OnionV3_get_ed25519_pubkey(uint64_t ptr) {
4254         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4255         assert(obj->tag == LDKSocketAddress_OnionV3);
4256                         int8_tArray ed25519_pubkey_arr = init_int8_tArray(32, __LINE__);
4257                         memcpy(ed25519_pubkey_arr->elems, obj->onion_v3.ed25519_pubkey.data, 32);
4258         return ed25519_pubkey_arr;
4259 }
4260 int16_t __attribute__((export_name("TS_LDKSocketAddress_OnionV3_get_checksum"))) TS_LDKSocketAddress_OnionV3_get_checksum(uint64_t ptr) {
4261         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4262         assert(obj->tag == LDKSocketAddress_OnionV3);
4263                         int16_t checksum_conv = obj->onion_v3.checksum;
4264         return checksum_conv;
4265 }
4266 int8_t __attribute__((export_name("TS_LDKSocketAddress_OnionV3_get_version"))) TS_LDKSocketAddress_OnionV3_get_version(uint64_t ptr) {
4267         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4268         assert(obj->tag == LDKSocketAddress_OnionV3);
4269                         int8_t version_conv = obj->onion_v3.version;
4270         return version_conv;
4271 }
4272 int16_t __attribute__((export_name("TS_LDKSocketAddress_OnionV3_get_port"))) TS_LDKSocketAddress_OnionV3_get_port(uint64_t ptr) {
4273         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4274         assert(obj->tag == LDKSocketAddress_OnionV3);
4275                         int16_t port_conv = obj->onion_v3.port;
4276         return port_conv;
4277 }
4278 uint64_t __attribute__((export_name("TS_LDKSocketAddress_Hostname_get_hostname"))) TS_LDKSocketAddress_Hostname_get_hostname(uint64_t ptr) {
4279         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4280         assert(obj->tag == LDKSocketAddress_Hostname);
4281                         LDKHostname hostname_var = obj->hostname.hostname;
4282                         uint64_t hostname_ref = 0;
4283                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
4284                         hostname_ref = tag_ptr(hostname_var.inner, false);
4285         return hostname_ref;
4286 }
4287 int16_t __attribute__((export_name("TS_LDKSocketAddress_Hostname_get_port"))) TS_LDKSocketAddress_Hostname_get_port(uint64_t ptr) {
4288         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4289         assert(obj->tag == LDKSocketAddress_Hostname);
4290                         int16_t port_conv = obj->hostname.port;
4291         return port_conv;
4292 }
4293 static inline LDKCVec_SocketAddressZ CVec_SocketAddressZ_clone(const LDKCVec_SocketAddressZ *orig) {
4294         LDKCVec_SocketAddressZ ret = { .data = MALLOC(sizeof(LDKSocketAddress) * orig->datalen, "LDKCVec_SocketAddressZ clone bytes"), .datalen = orig->datalen };
4295         for (size_t i = 0; i < ret.datalen; i++) {
4296                 ret.data[i] = SocketAddress_clone(&orig->data[i]);
4297         }
4298         return ret;
4299 }
4300 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
4301         LDKNodeAnnouncementInfo ret = *owner->contents.result;
4302         ret.is_owned = false;
4303         return ret;
4304 }
4305 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint64_t owner) {
4306         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
4307         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
4308         uint64_t ret_ref = 0;
4309         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4310         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4311         return ret_ref;
4312 }
4313
4314 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
4315 CHECK(!owner->result_ok);
4316         return DecodeError_clone(&*owner->contents.err);
4317 }
4318 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint64_t owner) {
4319         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
4320         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4321         *ret_copy = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
4322         uint64_t ret_ref = tag_ptr(ret_copy, true);
4323         return ret_ref;
4324 }
4325
4326 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
4327         LDKNodeAlias ret = *owner->contents.result;
4328         ret.is_owned = false;
4329         return ret;
4330 }
4331 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_ok"))) TS_CResult_NodeAliasDecodeErrorZ_get_ok(uint64_t owner) {
4332         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
4333         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
4334         uint64_t ret_ref = 0;
4335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4337         return ret_ref;
4338 }
4339
4340 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
4341 CHECK(!owner->result_ok);
4342         return DecodeError_clone(&*owner->contents.err);
4343 }
4344 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_err"))) TS_CResult_NodeAliasDecodeErrorZ_get_err(uint64_t owner) {
4345         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
4346         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4347         *ret_copy = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
4348         uint64_t ret_ref = tag_ptr(ret_copy, true);
4349         return ret_ref;
4350 }
4351
4352 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
4353         LDKNodeInfo ret = *owner->contents.result;
4354         ret.is_owned = false;
4355         return ret;
4356 }
4357 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeInfoDecodeErrorZ_get_ok(uint64_t owner) {
4358         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
4359         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
4360         uint64_t ret_ref = 0;
4361         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4362         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4363         return ret_ref;
4364 }
4365
4366 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
4367 CHECK(!owner->result_ok);
4368         return DecodeError_clone(&*owner->contents.err);
4369 }
4370 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_err"))) TS_CResult_NodeInfoDecodeErrorZ_get_err(uint64_t owner) {
4371         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
4372         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4373         *ret_copy = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
4374         uint64_t ret_ref = tag_ptr(ret_copy, true);
4375         return ret_ref;
4376 }
4377
4378 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
4379         LDKNetworkGraph ret = *owner->contents.result;
4380         ret.is_owned = false;
4381         return ret;
4382 }
4383 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_get_ok(uint64_t owner) {
4384         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
4385         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
4386         uint64_t ret_ref = 0;
4387         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4388         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4389         return ret_ref;
4390 }
4391
4392 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
4393 CHECK(!owner->result_ok);
4394         return DecodeError_clone(&*owner->contents.err);
4395 }
4396 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_err"))) TS_CResult_NetworkGraphDecodeErrorZ_get_err(uint64_t owner) {
4397         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
4398         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4399         *ret_copy = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
4400         uint64_t ret_ref = tag_ptr(ret_copy, true);
4401         return ret_ref;
4402 }
4403
4404 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_SocketAddressZZ_ty_from_ptr"))) TS_LDKCOption_CVec_SocketAddressZZ_ty_from_ptr(uint64_t ptr) {
4405         LDKCOption_CVec_SocketAddressZZ *obj = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(ptr);
4406         switch(obj->tag) {
4407                 case LDKCOption_CVec_SocketAddressZZ_Some: return 0;
4408                 case LDKCOption_CVec_SocketAddressZZ_None: return 1;
4409                 default: abort();
4410         }
4411 }
4412 uint64_tArray __attribute__((export_name("TS_LDKCOption_CVec_SocketAddressZZ_Some_get_some"))) TS_LDKCOption_CVec_SocketAddressZZ_Some_get_some(uint64_t ptr) {
4413         LDKCOption_CVec_SocketAddressZZ *obj = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(ptr);
4414         assert(obj->tag == LDKCOption_CVec_SocketAddressZZ_Some);
4415                         LDKCVec_SocketAddressZ some_var = obj->some;
4416                         uint64_tArray some_arr = NULL;
4417                         some_arr = init_uint64_tArray(some_var.datalen, __LINE__);
4418                         uint64_t *some_arr_ptr = (uint64_t*)(((uint8_t*)some_arr) + 8);
4419                         for (size_t p = 0; p < some_var.datalen; p++) {
4420                                 uint64_t some_conv_15_ref = tag_ptr(&some_var.data[p], false);
4421                                 some_arr_ptr[p] = some_conv_15_ref;
4422                         }
4423                         
4424         return some_arr;
4425 }
4426 static inline struct LDKChannelDerivationParameters CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
4427         LDKChannelDerivationParameters ret = *owner->contents.result;
4428         ret.is_owned = false;
4429         return ret;
4430 }
4431 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_get_ok"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(uint64_t owner) {
4432         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
4433         LDKChannelDerivationParameters ret_var = CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(owner_conv);
4434         uint64_t ret_ref = 0;
4435         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4436         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4437         return ret_ref;
4438 }
4439
4440 static inline struct LDKDecodeError CResult_ChannelDerivationParametersDecodeErrorZ_get_err(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
4441 CHECK(!owner->result_ok);
4442         return DecodeError_clone(&*owner->contents.err);
4443 }
4444 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_get_err"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_get_err(uint64_t owner) {
4445         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
4446         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4447         *ret_copy = CResult_ChannelDerivationParametersDecodeErrorZ_get_err(owner_conv);
4448         uint64_t ret_ref = tag_ptr(ret_copy, true);
4449         return ret_ref;
4450 }
4451
4452 static inline struct LDKHTLCDescriptor CResult_HTLCDescriptorDecodeErrorZ_get_ok(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
4453         LDKHTLCDescriptor ret = *owner->contents.result;
4454         ret.is_owned = false;
4455         return ret;
4456 }
4457 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_get_ok"))) TS_CResult_HTLCDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
4458         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
4459         LDKHTLCDescriptor ret_var = CResult_HTLCDescriptorDecodeErrorZ_get_ok(owner_conv);
4460         uint64_t ret_ref = 0;
4461         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4462         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4463         return ret_ref;
4464 }
4465
4466 static inline struct LDKDecodeError CResult_HTLCDescriptorDecodeErrorZ_get_err(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
4467 CHECK(!owner->result_ok);
4468         return DecodeError_clone(&*owner->contents.err);
4469 }
4470 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_get_err"))) TS_CResult_HTLCDescriptorDecodeErrorZ_get_err(uint64_t owner) {
4471         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
4472         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4473         *ret_copy = CResult_HTLCDescriptorDecodeErrorZ_get_err(owner_conv);
4474         uint64_t ret_ref = tag_ptr(ret_copy, true);
4475         return ret_ref;
4476 }
4477
4478 static inline LDKCVec_HTLCOutputInCommitmentZ CVec_HTLCOutputInCommitmentZ_clone(const LDKCVec_HTLCOutputInCommitmentZ *orig) {
4479         LDKCVec_HTLCOutputInCommitmentZ ret = { .data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * orig->datalen, "LDKCVec_HTLCOutputInCommitmentZ clone bytes"), .datalen = orig->datalen };
4480         for (size_t i = 0; i < ret.datalen; i++) {
4481                 ret.data[i] = HTLCOutputInCommitment_clone(&orig->data[i]);
4482         }
4483         return ret;
4484 }
4485 static inline LDKCVec_HTLCDescriptorZ CVec_HTLCDescriptorZ_clone(const LDKCVec_HTLCDescriptorZ *orig) {
4486         LDKCVec_HTLCDescriptorZ ret = { .data = MALLOC(sizeof(LDKHTLCDescriptor) * orig->datalen, "LDKCVec_HTLCDescriptorZ clone bytes"), .datalen = orig->datalen };
4487         for (size_t i = 0; i < ret.datalen; i++) {
4488                 ret.data[i] = HTLCDescriptor_clone(&orig->data[i]);
4489         }
4490         return ret;
4491 }
4492 static inline LDKCVec_UtxoZ CVec_UtxoZ_clone(const LDKCVec_UtxoZ *orig) {
4493         LDKCVec_UtxoZ ret = { .data = MALLOC(sizeof(LDKUtxo) * orig->datalen, "LDKCVec_UtxoZ clone bytes"), .datalen = orig->datalen };
4494         for (size_t i = 0; i < ret.datalen; i++) {
4495                 ret.data[i] = Utxo_clone(&orig->data[i]);
4496         }
4497         return ret;
4498 }
4499 uint32_t __attribute__((export_name("TS_LDKCOption_TxOutZ_ty_from_ptr"))) TS_LDKCOption_TxOutZ_ty_from_ptr(uint64_t ptr) {
4500         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
4501         switch(obj->tag) {
4502                 case LDKCOption_TxOutZ_Some: return 0;
4503                 case LDKCOption_TxOutZ_None: return 1;
4504                 default: abort();
4505         }
4506 }
4507 uint64_t __attribute__((export_name("TS_LDKCOption_TxOutZ_Some_get_some"))) TS_LDKCOption_TxOutZ_Some_get_some(uint64_t ptr) {
4508         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
4509         assert(obj->tag == LDKCOption_TxOutZ_Some);
4510                         LDKTxOut* some_ref = &obj->some;
4511         return tag_ptr(some_ref, false);
4512 }
4513 static inline LDKCVec_InputZ CVec_InputZ_clone(const LDKCVec_InputZ *orig) {
4514         LDKCVec_InputZ ret = { .data = MALLOC(sizeof(LDKInput) * orig->datalen, "LDKCVec_InputZ clone bytes"), .datalen = orig->datalen };
4515         for (size_t i = 0; i < ret.datalen; i++) {
4516                 ret.data[i] = Input_clone(&orig->data[i]);
4517         }
4518         return ret;
4519 }
4520 static inline struct LDKCoinSelection CResult_CoinSelectionNoneZ_get_ok(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
4521         LDKCoinSelection ret = *owner->contents.result;
4522         ret.is_owned = false;
4523         return ret;
4524 }
4525 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_get_ok"))) TS_CResult_CoinSelectionNoneZ_get_ok(uint64_t owner) {
4526         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
4527         LDKCoinSelection ret_var = CResult_CoinSelectionNoneZ_get_ok(owner_conv);
4528         uint64_t ret_ref = 0;
4529         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4530         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4531         return ret_ref;
4532 }
4533
4534 static inline void CResult_CoinSelectionNoneZ_get_err(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
4535 CHECK(!owner->result_ok);
4536         return *owner->contents.err;
4537 }
4538 void  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_get_err"))) TS_CResult_CoinSelectionNoneZ_get_err(uint64_t owner) {
4539         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
4540         CResult_CoinSelectionNoneZ_get_err(owner_conv);
4541 }
4542
4543 static inline struct LDKCVec_UtxoZ CResult_CVec_UtxoZNoneZ_get_ok(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
4544 CHECK(owner->result_ok);
4545         return CVec_UtxoZ_clone(&*owner->contents.result);
4546 }
4547 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_get_ok"))) TS_CResult_CVec_UtxoZNoneZ_get_ok(uint64_t owner) {
4548         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
4549         LDKCVec_UtxoZ ret_var = CResult_CVec_UtxoZNoneZ_get_ok(owner_conv);
4550         uint64_tArray ret_arr = NULL;
4551         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
4552         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
4553         for (size_t g = 0; g < ret_var.datalen; g++) {
4554                 LDKUtxo ret_conv_6_var = ret_var.data[g];
4555                 uint64_t ret_conv_6_ref = 0;
4556                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
4557                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
4558                 ret_arr_ptr[g] = ret_conv_6_ref;
4559         }
4560         
4561         FREE(ret_var.data);
4562         return ret_arr;
4563 }
4564
4565 static inline void CResult_CVec_UtxoZNoneZ_get_err(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
4566 CHECK(!owner->result_ok);
4567         return *owner->contents.err;
4568 }
4569 void  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_get_err"))) TS_CResult_CVec_UtxoZNoneZ_get_err(uint64_t owner) {
4570         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
4571         CResult_CVec_UtxoZNoneZ_get_err(owner_conv);
4572 }
4573
4574 static inline uint64_t C2Tuple_u64u16Z_get_a(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
4575         return owner->a;
4576 }
4577 int64_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_get_a"))) TS_C2Tuple_u64u16Z_get_a(uint64_t owner) {
4578         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
4579         int64_t ret_conv = C2Tuple_u64u16Z_get_a(owner_conv);
4580         return ret_conv;
4581 }
4582
4583 static inline uint16_t C2Tuple_u64u16Z_get_b(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
4584         return owner->b;
4585 }
4586 int16_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_get_b"))) TS_C2Tuple_u64u16Z_get_b(uint64_t owner) {
4587         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
4588         int16_t ret_conv = C2Tuple_u64u16Z_get_b(owner_conv);
4589         return ret_conv;
4590 }
4591
4592 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u16ZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_u64u16ZZ_ty_from_ptr(uint64_t ptr) {
4593         LDKCOption_C2Tuple_u64u16ZZ *obj = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(ptr);
4594         switch(obj->tag) {
4595                 case LDKCOption_C2Tuple_u64u16ZZ_Some: return 0;
4596                 case LDKCOption_C2Tuple_u64u16ZZ_None: return 1;
4597                 default: abort();
4598         }
4599 }
4600 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u16ZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_u64u16ZZ_Some_get_some(uint64_t ptr) {
4601         LDKCOption_C2Tuple_u64u16ZZ *obj = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(ptr);
4602         assert(obj->tag == LDKCOption_C2Tuple_u64u16ZZ_Some);
4603                         LDKC2Tuple_u64u16Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
4604                         *some_conv = obj->some;
4605                         *some_conv = C2Tuple_u64u16Z_clone(some_conv);
4606         return tag_ptr(some_conv, true);
4607 }
4608 uint32_t __attribute__((export_name("TS_LDKCOption_ChannelShutdownStateZ_ty_from_ptr"))) TS_LDKCOption_ChannelShutdownStateZ_ty_from_ptr(uint64_t ptr) {
4609         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
4610         switch(obj->tag) {
4611                 case LDKCOption_ChannelShutdownStateZ_Some: return 0;
4612                 case LDKCOption_ChannelShutdownStateZ_None: return 1;
4613                 default: abort();
4614         }
4615 }
4616 uint32_t __attribute__((export_name("TS_LDKCOption_ChannelShutdownStateZ_Some_get_some"))) TS_LDKCOption_ChannelShutdownStateZ_Some_get_some(uint64_t ptr) {
4617         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
4618         assert(obj->tag == LDKCOption_ChannelShutdownStateZ_Some);
4619                         uint32_t some_conv = LDKChannelShutdownState_to_js(obj->some);
4620         return some_conv;
4621 }
4622 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesAPIErrorZ_get_ok(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
4623 CHECK(owner->result_ok);
4624         return ThirtyTwoBytes_clone(&*owner->contents.result);
4625 }
4626 int8_tArray  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_get_ok"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_get_ok(uint64_t owner) {
4627         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
4628         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4629         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesAPIErrorZ_get_ok(owner_conv).data, 32);
4630         return ret_arr;
4631 }
4632
4633 static inline struct LDKAPIError CResult_ThirtyTwoBytesAPIErrorZ_get_err(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
4634 CHECK(!owner->result_ok);
4635         return APIError_clone(&*owner->contents.err);
4636 }
4637 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_get_err"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_get_err(uint64_t owner) {
4638         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
4639         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4640         *ret_copy = CResult_ThirtyTwoBytesAPIErrorZ_get_err(owner_conv);
4641         uint64_t ret_ref = tag_ptr(ret_copy, true);
4642         return ret_ref;
4643 }
4644
4645 uint32_t __attribute__((export_name("TS_LDKRecentPaymentDetails_ty_from_ptr"))) TS_LDKRecentPaymentDetails_ty_from_ptr(uint64_t ptr) {
4646         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4647         switch(obj->tag) {
4648                 case LDKRecentPaymentDetails_AwaitingInvoice: return 0;
4649                 case LDKRecentPaymentDetails_Pending: return 1;
4650                 case LDKRecentPaymentDetails_Fulfilled: return 2;
4651                 case LDKRecentPaymentDetails_Abandoned: return 3;
4652                 default: abort();
4653         }
4654 }
4655 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_AwaitingInvoice_get_payment_id"))) TS_LDKRecentPaymentDetails_AwaitingInvoice_get_payment_id(uint64_t ptr) {
4656         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4657         assert(obj->tag == LDKRecentPaymentDetails_AwaitingInvoice);
4658                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4659                         memcpy(payment_id_arr->elems, obj->awaiting_invoice.payment_id.data, 32);
4660         return payment_id_arr;
4661 }
4662 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_payment_id"))) TS_LDKRecentPaymentDetails_Pending_get_payment_id(uint64_t ptr) {
4663         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4664         assert(obj->tag == LDKRecentPaymentDetails_Pending);
4665                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4666                         memcpy(payment_id_arr->elems, obj->pending.payment_id.data, 32);
4667         return payment_id_arr;
4668 }
4669 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_payment_hash"))) TS_LDKRecentPaymentDetails_Pending_get_payment_hash(uint64_t ptr) {
4670         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4671         assert(obj->tag == LDKRecentPaymentDetails_Pending);
4672                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
4673                         memcpy(payment_hash_arr->elems, obj->pending.payment_hash.data, 32);
4674         return payment_hash_arr;
4675 }
4676 int64_t __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_total_msat"))) TS_LDKRecentPaymentDetails_Pending_get_total_msat(uint64_t ptr) {
4677         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4678         assert(obj->tag == LDKRecentPaymentDetails_Pending);
4679                         int64_t total_msat_conv = obj->pending.total_msat;
4680         return total_msat_conv;
4681 }
4682 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Fulfilled_get_payment_id"))) TS_LDKRecentPaymentDetails_Fulfilled_get_payment_id(uint64_t ptr) {
4683         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4684         assert(obj->tag == LDKRecentPaymentDetails_Fulfilled);
4685                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4686                         memcpy(payment_id_arr->elems, obj->fulfilled.payment_id.data, 32);
4687         return payment_id_arr;
4688 }
4689 uint64_t __attribute__((export_name("TS_LDKRecentPaymentDetails_Fulfilled_get_payment_hash"))) TS_LDKRecentPaymentDetails_Fulfilled_get_payment_hash(uint64_t ptr) {
4690         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4691         assert(obj->tag == LDKRecentPaymentDetails_Fulfilled);
4692                         uint64_t payment_hash_ref = tag_ptr(&obj->fulfilled.payment_hash, false);
4693         return payment_hash_ref;
4694 }
4695 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Abandoned_get_payment_id"))) TS_LDKRecentPaymentDetails_Abandoned_get_payment_id(uint64_t ptr) {
4696         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4697         assert(obj->tag == LDKRecentPaymentDetails_Abandoned);
4698                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4699                         memcpy(payment_id_arr->elems, obj->abandoned.payment_id.data, 32);
4700         return payment_id_arr;
4701 }
4702 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Abandoned_get_payment_hash"))) TS_LDKRecentPaymentDetails_Abandoned_get_payment_hash(uint64_t ptr) {
4703         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
4704         assert(obj->tag == LDKRecentPaymentDetails_Abandoned);
4705                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
4706                         memcpy(payment_hash_arr->elems, obj->abandoned.payment_hash.data, 32);
4707         return payment_hash_arr;
4708 }
4709 static inline LDKCVec_RecentPaymentDetailsZ CVec_RecentPaymentDetailsZ_clone(const LDKCVec_RecentPaymentDetailsZ *orig) {
4710         LDKCVec_RecentPaymentDetailsZ ret = { .data = MALLOC(sizeof(LDKRecentPaymentDetails) * orig->datalen, "LDKCVec_RecentPaymentDetailsZ clone bytes"), .datalen = orig->datalen };
4711         for (size_t i = 0; i < ret.datalen; i++) {
4712                 ret.data[i] = RecentPaymentDetails_clone(&orig->data[i]);
4713         }
4714         return ret;
4715 }
4716 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_ty_from_ptr"))) TS_LDKPaymentSendFailure_ty_from_ptr(uint64_t ptr) {
4717         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4718         switch(obj->tag) {
4719                 case LDKPaymentSendFailure_ParameterError: return 0;
4720                 case LDKPaymentSendFailure_PathParameterError: return 1;
4721                 case LDKPaymentSendFailure_AllFailedResendSafe: return 2;
4722                 case LDKPaymentSendFailure_DuplicatePayment: return 3;
4723                 case LDKPaymentSendFailure_PartialFailure: return 4;
4724                 default: abort();
4725         }
4726 }
4727 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_ParameterError_get_parameter_error"))) TS_LDKPaymentSendFailure_ParameterError_get_parameter_error(uint64_t ptr) {
4728         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4729         assert(obj->tag == LDKPaymentSendFailure_ParameterError);
4730                         uint64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
4731         return parameter_error_ref;
4732 }
4733 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error"))) TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error(uint64_t ptr) {
4734         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4735         assert(obj->tag == LDKPaymentSendFailure_PathParameterError);
4736                         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
4737                         uint64_tArray path_parameter_error_arr = NULL;
4738                         path_parameter_error_arr = init_uint64_tArray(path_parameter_error_var.datalen, __LINE__);
4739                         uint64_t *path_parameter_error_arr_ptr = (uint64_t*)(((uint8_t*)path_parameter_error_arr) + 8);
4740                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
4741                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4742                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
4743                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
4744                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
4745                         }
4746                         
4747         return path_parameter_error_arr;
4748 }
4749 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_AllFailedResendSafe_get_all_failed_resend_safe"))) TS_LDKPaymentSendFailure_AllFailedResendSafe_get_all_failed_resend_safe(uint64_t ptr) {
4750         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4751         assert(obj->tag == LDKPaymentSendFailure_AllFailedResendSafe);
4752                         LDKCVec_APIErrorZ all_failed_resend_safe_var = obj->all_failed_resend_safe;
4753                         uint64_tArray all_failed_resend_safe_arr = NULL;
4754                         all_failed_resend_safe_arr = init_uint64_tArray(all_failed_resend_safe_var.datalen, __LINE__);
4755                         uint64_t *all_failed_resend_safe_arr_ptr = (uint64_t*)(((uint8_t*)all_failed_resend_safe_arr) + 8);
4756                         for (size_t k = 0; k < all_failed_resend_safe_var.datalen; k++) {
4757                                 uint64_t all_failed_resend_safe_conv_10_ref = tag_ptr(&all_failed_resend_safe_var.data[k], false);
4758                                 all_failed_resend_safe_arr_ptr[k] = all_failed_resend_safe_conv_10_ref;
4759                         }
4760                         
4761         return all_failed_resend_safe_arr;
4762 }
4763 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_results"))) TS_LDKPaymentSendFailure_PartialFailure_get_results(uint64_t ptr) {
4764         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4765         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4766                         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
4767                         uint64_tArray results_arr = NULL;
4768                         results_arr = init_uint64_tArray(results_var.datalen, __LINE__);
4769                         uint64_t *results_arr_ptr = (uint64_t*)(((uint8_t*)results_arr) + 8);
4770                         for (size_t w = 0; w < results_var.datalen; w++) {
4771                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4772                                 *results_conv_22_conv = results_var.data[w];
4773                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
4774                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
4775                         }
4776                         
4777         return results_arr;
4778 }
4779 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry"))) TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry(uint64_t ptr) {
4780         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4781         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4782                         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
4783                         uint64_t failed_paths_retry_ref = 0;
4784                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
4785                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
4786         return failed_paths_retry_ref;
4787 }
4788 int8_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_payment_id"))) TS_LDKPaymentSendFailure_PartialFailure_get_payment_id(uint64_t ptr) {
4789         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4790         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4791                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4792                         memcpy(payment_id_arr->elems, obj->partial_failure.payment_id.data, 32);
4793         return payment_id_arr;
4794 }
4795 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4796 CHECK(owner->result_ok);
4797         return *owner->contents.result;
4798 }
4799 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_ok"))) TS_CResult_NonePaymentSendFailureZ_get_ok(uint64_t owner) {
4800         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
4801         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
4802 }
4803
4804 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4805 CHECK(!owner->result_ok);
4806         return PaymentSendFailure_clone(&*owner->contents.err);
4807 }
4808 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_err"))) TS_CResult_NonePaymentSendFailureZ_get_err(uint64_t owner) {
4809         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
4810         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4811         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
4812         uint64_t ret_ref = tag_ptr(ret_copy, true);
4813         return ret_ref;
4814 }
4815
4816 static inline void CResult_NoneRetryableSendFailureZ_get_ok(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
4817 CHECK(owner->result_ok);
4818         return *owner->contents.result;
4819 }
4820 void  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_get_ok"))) TS_CResult_NoneRetryableSendFailureZ_get_ok(uint64_t owner) {
4821         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
4822         CResult_NoneRetryableSendFailureZ_get_ok(owner_conv);
4823 }
4824
4825 static inline enum LDKRetryableSendFailure CResult_NoneRetryableSendFailureZ_get_err(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
4826 CHECK(!owner->result_ok);
4827         return RetryableSendFailure_clone(&*owner->contents.err);
4828 }
4829 uint32_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_get_err"))) TS_CResult_NoneRetryableSendFailureZ_get_err(uint64_t owner) {
4830         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
4831         uint32_t ret_conv = LDKRetryableSendFailure_to_js(CResult_NoneRetryableSendFailureZ_get_err(owner_conv));
4832         return ret_conv;
4833 }
4834
4835 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
4836 CHECK(owner->result_ok);
4837         return ThirtyTwoBytes_clone(&*owner->contents.result);
4838 }
4839 int8_tArray  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(uint64_t owner) {
4840         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
4841         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4842         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(owner_conv).data, 32);
4843         return ret_arr;
4844 }
4845
4846 static inline struct LDKPaymentSendFailure CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
4847 CHECK(!owner->result_ok);
4848         return PaymentSendFailure_clone(&*owner->contents.err);
4849 }
4850 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(uint64_t owner) {
4851         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
4852         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4853         *ret_copy = CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(owner_conv);
4854         uint64_t ret_ref = tag_ptr(ret_copy, true);
4855         return ret_ref;
4856 }
4857
4858 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
4859 CHECK(owner->result_ok);
4860         return ThirtyTwoBytes_clone(&*owner->contents.result);
4861 }
4862 int8_tArray  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(uint64_t owner) {
4863         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
4864         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4865         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(owner_conv).data, 32);
4866         return ret_arr;
4867 }
4868
4869 static inline enum LDKRetryableSendFailure CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
4870 CHECK(!owner->result_ok);
4871         return RetryableSendFailure_clone(&*owner->contents.err);
4872 }
4873 uint32_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(uint64_t owner) {
4874         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
4875         uint32_t ret_conv = LDKRetryableSendFailure_to_js(CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(owner_conv));
4876         return ret_conv;
4877 }
4878
4879 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
4880         return ThirtyTwoBytes_clone(&owner->a);
4881 }
4882 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(uint64_t owner) {
4883         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
4884         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4885         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(owner_conv).data, 32);
4886         return ret_arr;
4887 }
4888
4889 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
4890         return ThirtyTwoBytes_clone(&owner->b);
4891 }
4892 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(uint64_t owner) {
4893         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
4894         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4895         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(owner_conv).data, 32);
4896         return ret_arr;
4897 }
4898
4899 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
4900 CHECK(owner->result_ok);
4901         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
4902 }
4903 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(uint64_t owner) {
4904         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
4905         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
4906         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(owner_conv);
4907         return tag_ptr(ret_conv, true);
4908 }
4909
4910 static inline struct LDKPaymentSendFailure CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
4911 CHECK(!owner->result_ok);
4912         return PaymentSendFailure_clone(&*owner->contents.err);
4913 }
4914 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(uint64_t owner) {
4915         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
4916         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4917         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(owner_conv);
4918         uint64_t ret_ref = tag_ptr(ret_copy, true);
4919         return ret_ref;
4920 }
4921
4922 static inline LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ *orig) {
4923         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ clone bytes"), .datalen = orig->datalen };
4924         for (size_t i = 0; i < ret.datalen; i++) {
4925                 ret.data[i] = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&orig->data[i]);
4926         }
4927         return ret;
4928 }
4929 uint32_t __attribute__((export_name("TS_LDKProbeSendFailure_ty_from_ptr"))) TS_LDKProbeSendFailure_ty_from_ptr(uint64_t ptr) {
4930         LDKProbeSendFailure *obj = (LDKProbeSendFailure*)untag_ptr(ptr);
4931         switch(obj->tag) {
4932                 case LDKProbeSendFailure_RouteNotFound: return 0;
4933                 case LDKProbeSendFailure_SendingFailed: return 1;
4934                 default: abort();
4935         }
4936 }
4937 uint64_t __attribute__((export_name("TS_LDKProbeSendFailure_SendingFailed_get_sending_failed"))) TS_LDKProbeSendFailure_SendingFailed_get_sending_failed(uint64_t ptr) {
4938         LDKProbeSendFailure *obj = (LDKProbeSendFailure*)untag_ptr(ptr);
4939         assert(obj->tag == LDKProbeSendFailure_SendingFailed);
4940                         uint64_t sending_failed_ref = tag_ptr(&obj->sending_failed, false);
4941         return sending_failed_ref;
4942 }
4943 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
4944 CHECK(owner->result_ok);
4945         return CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(&*owner->contents.result);
4946 }
4947 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(uint64_t owner) {
4948         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
4949         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(owner_conv);
4950         uint64_tArray ret_arr = NULL;
4951         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
4952         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
4953         for (size_t o = 0; o < ret_var.datalen; o++) {
4954                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
4955                 *ret_conv_40_conv = ret_var.data[o];
4956                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
4957         }
4958         
4959         FREE(ret_var.data);
4960         return ret_arr;
4961 }
4962
4963 static inline struct LDKProbeSendFailure CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
4964 CHECK(!owner->result_ok);
4965         return ProbeSendFailure_clone(&*owner->contents.err);
4966 }
4967 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(uint64_t owner) {
4968         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
4969         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
4970         *ret_copy = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(owner_conv);
4971         uint64_t ret_ref = tag_ptr(ret_copy, true);
4972         return ret_ref;
4973 }
4974
4975 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR owner){
4976         return ThirtyTwoBytes_clone(&owner->a);
4977 }
4978 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a(uint64_t owner) {
4979         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(owner);
4980         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4981         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a(owner_conv).data, 32);
4982         return ret_arr;
4983 }
4984
4985 static inline struct LDKPublicKey C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR owner){
4986         return owner->b;
4987 }
4988 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b(uint64_t owner) {
4989         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(owner);
4990         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
4991         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b(owner_conv).compressed_form, 33);
4992         return ret_arr;
4993 }
4994
4995 static inline LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ *orig) {
4996         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ clone bytes"), .datalen = orig->datalen };
4997         for (size_t i = 0; i < ret.datalen; i++) {
4998                 ret.data[i] = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(&orig->data[i]);
4999         }
5000         return ret;
5001 }
5002 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
5003 CHECK(owner->result_ok);
5004         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
5005 }
5006 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(uint64_t owner) {
5007         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
5008         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
5009         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(owner_conv);
5010         return tag_ptr(ret_conv, true);
5011 }
5012
5013 static inline void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
5014 CHECK(!owner->result_ok);
5015         return *owner->contents.err;
5016 }
5017 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(uint64_t owner) {
5018         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
5019         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(owner_conv);
5020 }
5021
5022 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5023         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
5024         ret.is_owned = false;
5025         return ret;
5026 }
5027 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(uint64_t owner) {
5028         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
5029         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
5030         uint64_t ret_ref = 0;
5031         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5032         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5033         return ret_ref;
5034 }
5035
5036 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5037 CHECK(!owner->result_ok);
5038         return DecodeError_clone(&*owner->contents.err);
5039 }
5040 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(uint64_t owner) {
5041         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
5042         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5043         *ret_copy = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
5044         uint64_t ret_ref = tag_ptr(ret_copy, true);
5045         return ret_ref;
5046 }
5047
5048 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5049         LDKChannelCounterparty ret = *owner->contents.result;
5050         ret.is_owned = false;
5051         return ret;
5052 }
5053 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok(uint64_t owner) {
5054         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
5055         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
5056         uint64_t ret_ref = 0;
5057         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5058         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5059         return ret_ref;
5060 }
5061
5062 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5063 CHECK(!owner->result_ok);
5064         return DecodeError_clone(&*owner->contents.err);
5065 }
5066 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err(uint64_t owner) {
5067         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
5068         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5069         *ret_copy = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
5070         uint64_t ret_ref = tag_ptr(ret_copy, true);
5071         return ret_ref;
5072 }
5073
5074 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5075         LDKChannelDetails ret = *owner->contents.result;
5076         ret.is_owned = false;
5077         return ret;
5078 }
5079 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_ok(uint64_t owner) {
5080         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
5081         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
5082         uint64_t ret_ref = 0;
5083         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5084         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5085         return ret_ref;
5086 }
5087
5088 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5089 CHECK(!owner->result_ok);
5090         return DecodeError_clone(&*owner->contents.err);
5091 }
5092 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_err(uint64_t owner) {
5093         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
5094         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5095         *ret_copy = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
5096         uint64_t ret_ref = tag_ptr(ret_copy, true);
5097         return ret_ref;
5098 }
5099
5100 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5101         LDKPhantomRouteHints ret = *owner->contents.result;
5102         ret.is_owned = false;
5103         return ret;
5104 }
5105 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok(uint64_t owner) {
5106         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
5107         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
5108         uint64_t ret_ref = 0;
5109         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5110         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5111         return ret_ref;
5112 }
5113
5114 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5115 CHECK(!owner->result_ok);
5116         return DecodeError_clone(&*owner->contents.err);
5117 }
5118 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err(uint64_t owner) {
5119         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
5120         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5121         *ret_copy = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
5122         uint64_t ret_ref = tag_ptr(ret_copy, true);
5123         return ret_ref;
5124 }
5125
5126 static inline enum LDKChannelShutdownState CResult_ChannelShutdownStateDecodeErrorZ_get_ok(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
5127 CHECK(owner->result_ok);
5128         return ChannelShutdownState_clone(&*owner->contents.result);
5129 }
5130 uint32_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_get_ok"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_get_ok(uint64_t owner) {
5131         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
5132         uint32_t ret_conv = LDKChannelShutdownState_to_js(CResult_ChannelShutdownStateDecodeErrorZ_get_ok(owner_conv));
5133         return ret_conv;
5134 }
5135
5136 static inline struct LDKDecodeError CResult_ChannelShutdownStateDecodeErrorZ_get_err(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
5137 CHECK(!owner->result_ok);
5138         return DecodeError_clone(&*owner->contents.err);
5139 }
5140 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_get_err"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_get_err(uint64_t owner) {
5141         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
5142         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5143         *ret_copy = CResult_ChannelShutdownStateDecodeErrorZ_get_err(owner_conv);
5144         uint64_t ret_ref = tag_ptr(ret_copy, true);
5145         return ret_ref;
5146 }
5147
5148 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
5149         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
5150         for (size_t i = 0; i < ret.datalen; i++) {
5151                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
5152         }
5153         return ret;
5154 }
5155 typedef struct LDKWatch_JCalls {
5156         atomic_size_t refcnt;
5157         uint32_t instance_ptr;
5158 } LDKWatch_JCalls;
5159 static void LDKWatch_JCalls_free(void* this_arg) {
5160         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5161         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5162                 FREE(j_calls);
5163         }
5164 }
5165 LDKCResult_ChannelMonitorUpdateStatusNoneZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
5166         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5167         LDKOutPoint funding_txo_var = funding_txo;
5168         uint64_t funding_txo_ref = 0;
5169         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5170         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
5171         LDKChannelMonitor monitor_var = monitor;
5172         uint64_t monitor_ref = 0;
5173         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
5174         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
5175         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 18, funding_txo_ref, monitor_ref, 0, 0, 0, 0);
5176         void* ret_ptr = untag_ptr(ret);
5177         CHECK_ACCESS(ret_ptr);
5178         LDKCResult_ChannelMonitorUpdateStatusNoneZ ret_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(ret_ptr);
5179         FREE(untag_ptr(ret));
5180         return ret_conv;
5181 }
5182 LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, const LDKChannelMonitorUpdate * update) {
5183         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5184         LDKOutPoint funding_txo_var = funding_txo;
5185         uint64_t funding_txo_ref = 0;
5186         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5187         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
5188         LDKChannelMonitorUpdate update_var = *update;
5189         uint64_t update_ref = 0;
5190         update_var = ChannelMonitorUpdate_clone(&update_var);
5191         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
5192         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
5193         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 19, funding_txo_ref, update_ref, 0, 0, 0, 0);
5194         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
5195         return ret_conv;
5196 }
5197 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
5198         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5199         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 20, 0, 0, 0, 0, 0, 0);
5200         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_constr;
5201         ret_constr.datalen = ret->arr_len;
5202         if (ret_constr.datalen > 0)
5203                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
5204         else
5205                 ret_constr.data = NULL;
5206         uint64_t* ret_vals = ret->elems;
5207         for (size_t x = 0; x < ret_constr.datalen; x++) {
5208                 uint64_t ret_conv_49 = ret_vals[x];
5209                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
5210                 CHECK_ACCESS(ret_conv_49_ptr);
5211                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(ret_conv_49_ptr);
5212                 FREE(untag_ptr(ret_conv_49));
5213                 ret_constr.data[x] = ret_conv_49_conv;
5214         }
5215         FREE(ret);
5216         return ret_constr;
5217 }
5218 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
5219         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
5220         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5221 }
5222 static inline LDKWatch LDKWatch_init (JSValue o) {
5223         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
5224         atomic_init(&calls->refcnt, 1);
5225         calls->instance_ptr = o;
5226
5227         LDKWatch ret = {
5228                 .this_arg = (void*) calls,
5229                 .watch_channel = watch_channel_LDKWatch_jcall,
5230                 .update_channel = update_channel_LDKWatch_jcall,
5231                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
5232                 .free = LDKWatch_JCalls_free,
5233         };
5234         return ret;
5235 }
5236 uint64_t  __attribute__((export_name("TS_LDKWatch_new"))) TS_LDKWatch_new(JSValue o) {
5237         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
5238         *res_ptr = LDKWatch_init(o);
5239         return tag_ptr(res_ptr, true);
5240 }
5241 uint64_t  __attribute__((export_name("TS_Watch_watch_channel"))) TS_Watch_watch_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t monitor) {
5242         void* this_arg_ptr = untag_ptr(this_arg);
5243         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5244         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5245         LDKOutPoint funding_txo_conv;
5246         funding_txo_conv.inner = untag_ptr(funding_txo);
5247         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
5248         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5249         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5250         LDKChannelMonitor monitor_conv;
5251         monitor_conv.inner = untag_ptr(monitor);
5252         monitor_conv.is_owned = ptr_is_owned(monitor);
5253         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
5254         monitor_conv = ChannelMonitor_clone(&monitor_conv);
5255         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
5256         *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
5257         return tag_ptr(ret_conv, true);
5258 }
5259
5260 uint32_t  __attribute__((export_name("TS_Watch_update_channel"))) TS_Watch_update_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t update) {
5261         void* this_arg_ptr = untag_ptr(this_arg);
5262         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5263         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5264         LDKOutPoint funding_txo_conv;
5265         funding_txo_conv.inner = untag_ptr(funding_txo);
5266         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
5267         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5268         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5269         LDKChannelMonitorUpdate update_conv;
5270         update_conv.inner = untag_ptr(update);
5271         update_conv.is_owned = ptr_is_owned(update);
5272         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
5273         update_conv.is_owned = false;
5274         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js((this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, &update_conv));
5275         return ret_conv;
5276 }
5277
5278 uint64_tArray  __attribute__((export_name("TS_Watch_release_pending_monitor_events"))) TS_Watch_release_pending_monitor_events(uint64_t this_arg) {
5279         void* this_arg_ptr = untag_ptr(this_arg);
5280         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5281         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5282         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
5283         uint64_tArray ret_arr = NULL;
5284         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
5285         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
5286         for (size_t x = 0; x < ret_var.datalen; x++) {
5287                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
5288                 *ret_conv_49_conv = ret_var.data[x];
5289                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
5290         }
5291         
5292         FREE(ret_var.data);
5293         return ret_arr;
5294 }
5295
5296 typedef struct LDKBroadcasterInterface_JCalls {
5297         atomic_size_t refcnt;
5298         uint32_t instance_ptr;
5299 } LDKBroadcasterInterface_JCalls;
5300 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
5301         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5302         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5303                 FREE(j_calls);
5304         }
5305 }
5306 void broadcast_transactions_LDKBroadcasterInterface_jcall(const void* this_arg, LDKCVec_TransactionZ txs) {
5307         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5308         LDKCVec_TransactionZ txs_var = txs;
5309         ptrArray txs_arr = NULL;
5310         txs_arr = init_ptrArray(txs_var.datalen, __LINE__);
5311         int8_tArray *txs_arr_ptr = (int8_tArray*)(((uint8_t*)txs_arr) + 8);
5312         for (size_t m = 0; m < txs_var.datalen; m++) {
5313                 LDKTransaction txs_conv_12_var = txs_var.data[m];
5314                 int8_tArray txs_conv_12_arr = init_int8_tArray(txs_conv_12_var.datalen, __LINE__);
5315                 memcpy(txs_conv_12_arr->elems, txs_conv_12_var.data, txs_conv_12_var.datalen);
5316                 Transaction_free(txs_conv_12_var);
5317                 txs_arr_ptr[m] = txs_conv_12_arr;
5318         }
5319         
5320         FREE(txs_var.data);
5321         js_invoke_function_uuuuuu(j_calls->instance_ptr, 21, (uint32_t)txs_arr, 0, 0, 0, 0, 0);
5322 }
5323 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
5324         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
5325         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5326 }
5327 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JSValue o) {
5328         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
5329         atomic_init(&calls->refcnt, 1);
5330         calls->instance_ptr = o;
5331
5332         LDKBroadcasterInterface ret = {
5333                 .this_arg = (void*) calls,
5334                 .broadcast_transactions = broadcast_transactions_LDKBroadcasterInterface_jcall,
5335                 .free = LDKBroadcasterInterface_JCalls_free,
5336         };
5337         return ret;
5338 }
5339 uint64_t  __attribute__((export_name("TS_LDKBroadcasterInterface_new"))) TS_LDKBroadcasterInterface_new(JSValue o) {
5340         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
5341         *res_ptr = LDKBroadcasterInterface_init(o);
5342         return tag_ptr(res_ptr, true);
5343 }
5344 void  __attribute__((export_name("TS_BroadcasterInterface_broadcast_transactions"))) TS_BroadcasterInterface_broadcast_transactions(uint64_t this_arg, ptrArray txs) {
5345         void* this_arg_ptr = untag_ptr(this_arg);
5346         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5347         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
5348         LDKCVec_TransactionZ txs_constr;
5349         txs_constr.datalen = txs->arr_len;
5350         if (txs_constr.datalen > 0)
5351                 txs_constr.data = MALLOC(txs_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
5352         else
5353                 txs_constr.data = NULL;
5354         int8_tArray* txs_vals = (void*) txs->elems;
5355         for (size_t m = 0; m < txs_constr.datalen; m++) {
5356                 int8_tArray txs_conv_12 = txs_vals[m];
5357                 LDKTransaction txs_conv_12_ref;
5358                 txs_conv_12_ref.datalen = txs_conv_12->arr_len;
5359                 txs_conv_12_ref.data = MALLOC(txs_conv_12_ref.datalen, "LDKTransaction Bytes");
5360                 memcpy(txs_conv_12_ref.data, txs_conv_12->elems, txs_conv_12_ref.datalen); FREE(txs_conv_12);
5361                 txs_conv_12_ref.data_is_owned = true;
5362                 txs_constr.data[m] = txs_conv_12_ref;
5363         }
5364         FREE(txs);
5365         (this_arg_conv->broadcast_transactions)(this_arg_conv->this_arg, txs_constr);
5366 }
5367
5368 typedef struct LDKEntropySource_JCalls {
5369         atomic_size_t refcnt;
5370         uint32_t instance_ptr;
5371 } LDKEntropySource_JCalls;
5372 static void LDKEntropySource_JCalls_free(void* this_arg) {
5373         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
5374         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5375                 FREE(j_calls);
5376         }
5377 }
5378 LDKThirtyTwoBytes get_secure_random_bytes_LDKEntropySource_jcall(const void* this_arg) {
5379         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
5380         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 22, 0, 0, 0, 0, 0, 0);
5381         LDKThirtyTwoBytes ret_ref;
5382         CHECK(ret->arr_len == 32);
5383         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5384         return ret_ref;
5385 }
5386 static void LDKEntropySource_JCalls_cloned(LDKEntropySource* new_obj) {
5387         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) new_obj->this_arg;
5388         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5389 }
5390 static inline LDKEntropySource LDKEntropySource_init (JSValue o) {
5391         LDKEntropySource_JCalls *calls = MALLOC(sizeof(LDKEntropySource_JCalls), "LDKEntropySource_JCalls");
5392         atomic_init(&calls->refcnt, 1);
5393         calls->instance_ptr = o;
5394
5395         LDKEntropySource ret = {
5396                 .this_arg = (void*) calls,
5397                 .get_secure_random_bytes = get_secure_random_bytes_LDKEntropySource_jcall,
5398                 .free = LDKEntropySource_JCalls_free,
5399         };
5400         return ret;
5401 }
5402 uint64_t  __attribute__((export_name("TS_LDKEntropySource_new"))) TS_LDKEntropySource_new(JSValue o) {
5403         LDKEntropySource *res_ptr = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
5404         *res_ptr = LDKEntropySource_init(o);
5405         return tag_ptr(res_ptr, true);
5406 }
5407 int8_tArray  __attribute__((export_name("TS_EntropySource_get_secure_random_bytes"))) TS_EntropySource_get_secure_random_bytes(uint64_t this_arg) {
5408         void* this_arg_ptr = untag_ptr(this_arg);
5409         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5410         LDKEntropySource* this_arg_conv = (LDKEntropySource*)this_arg_ptr;
5411         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5412         memcpy(ret_arr->elems, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
5413         return ret_arr;
5414 }
5415
5416 uint32_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ty_from_ptr"))) TS_LDKUnsignedGossipMessage_ty_from_ptr(uint64_t ptr) {
5417         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
5418         switch(obj->tag) {
5419                 case LDKUnsignedGossipMessage_ChannelAnnouncement: return 0;
5420                 case LDKUnsignedGossipMessage_ChannelUpdate: return 1;
5421                 case LDKUnsignedGossipMessage_NodeAnnouncement: return 2;
5422                 default: abort();
5423         }
5424 }
5425 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ChannelAnnouncement_get_channel_announcement"))) TS_LDKUnsignedGossipMessage_ChannelAnnouncement_get_channel_announcement(uint64_t ptr) {
5426         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
5427         assert(obj->tag == LDKUnsignedGossipMessage_ChannelAnnouncement);
5428                         LDKUnsignedChannelAnnouncement channel_announcement_var = obj->channel_announcement;
5429                         uint64_t channel_announcement_ref = 0;
5430                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_announcement_var);
5431                         channel_announcement_ref = tag_ptr(channel_announcement_var.inner, false);
5432         return channel_announcement_ref;
5433 }
5434 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ChannelUpdate_get_channel_update"))) TS_LDKUnsignedGossipMessage_ChannelUpdate_get_channel_update(uint64_t ptr) {
5435         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
5436         assert(obj->tag == LDKUnsignedGossipMessage_ChannelUpdate);
5437                         LDKUnsignedChannelUpdate channel_update_var = obj->channel_update;
5438                         uint64_t channel_update_ref = 0;
5439                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_update_var);
5440                         channel_update_ref = tag_ptr(channel_update_var.inner, false);
5441         return channel_update_ref;
5442 }
5443 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_NodeAnnouncement_get_node_announcement"))) TS_LDKUnsignedGossipMessage_NodeAnnouncement_get_node_announcement(uint64_t ptr) {
5444         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
5445         assert(obj->tag == LDKUnsignedGossipMessage_NodeAnnouncement);
5446                         LDKUnsignedNodeAnnouncement node_announcement_var = obj->node_announcement;
5447                         uint64_t node_announcement_ref = 0;
5448                         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_announcement_var);
5449                         node_announcement_ref = tag_ptr(node_announcement_var.inner, false);
5450         return node_announcement_ref;
5451 }
5452 typedef struct LDKNodeSigner_JCalls {
5453         atomic_size_t refcnt;
5454         uint32_t instance_ptr;
5455 } LDKNodeSigner_JCalls;
5456 static void LDKNodeSigner_JCalls_free(void* this_arg) {
5457         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5458         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5459                 FREE(j_calls);
5460         }
5461 }
5462 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKNodeSigner_jcall(const void* this_arg) {
5463         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5464         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 23, 0, 0, 0, 0, 0, 0);
5465         LDKThirtyTwoBytes ret_ref;
5466         CHECK(ret->arr_len == 32);
5467         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5468         return ret_ref;
5469 }
5470 LDKCResult_PublicKeyNoneZ get_node_id_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient) {
5471         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5472         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5473         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 24, recipient_conv, 0, 0, 0, 0, 0);
5474         void* ret_ptr = untag_ptr(ret);
5475         CHECK_ACCESS(ret_ptr);
5476         LDKCResult_PublicKeyNoneZ ret_conv = *(LDKCResult_PublicKeyNoneZ*)(ret_ptr);
5477         FREE(untag_ptr(ret));
5478         return ret_conv;
5479 }
5480 LDKCResult_ThirtyTwoBytesNoneZ ecdh_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_BigEndianScalarZ tweak) {
5481         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5482         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5483         int8_tArray other_key_arr = init_int8_tArray(33, __LINE__);
5484         memcpy(other_key_arr->elems, other_key.compressed_form, 33);
5485         LDKCOption_BigEndianScalarZ *tweak_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
5486         *tweak_copy = tweak;
5487         uint64_t tweak_ref = tag_ptr(tweak_copy, true);
5488         uint64_t ret = js_invoke_function_uubuuu(j_calls->instance_ptr, 25, recipient_conv, (uint32_t)other_key_arr, tweak_ref, 0, 0, 0);
5489         void* ret_ptr = untag_ptr(ret);
5490         CHECK_ACCESS(ret_ptr);
5491         LDKCResult_ThirtyTwoBytesNoneZ ret_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(ret_ptr);
5492         FREE(untag_ptr(ret));
5493         return ret_conv;
5494 }
5495 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKNodeSigner_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_U5Z invoice_data, LDKRecipient recipient) {
5496         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5497         LDKu8slice hrp_bytes_var = hrp_bytes;
5498         int8_tArray hrp_bytes_arr = init_int8_tArray(hrp_bytes_var.datalen, __LINE__);
5499         memcpy(hrp_bytes_arr->elems, hrp_bytes_var.data, hrp_bytes_var.datalen);
5500         LDKCVec_U5Z invoice_data_var = invoice_data;
5501         ptrArray invoice_data_arr = NULL;
5502         invoice_data_arr = init_ptrArray(invoice_data_var.datalen, __LINE__);
5503         int8_t *invoice_data_arr_ptr = (int8_t*)(((uint8_t*)invoice_data_arr) + 8);
5504         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
5505                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
5506                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
5507         }
5508         
5509         FREE(invoice_data_var.data);
5510         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5511         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);
5512         void* ret_ptr = untag_ptr(ret);
5513         CHECK_ACCESS(ret_ptr);
5514         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
5515         FREE(untag_ptr(ret));
5516         return ret_conv;
5517 }
5518 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_request_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedInvoiceRequest * invoice_request) {
5519         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5520         LDKUnsignedInvoiceRequest invoice_request_var = *invoice_request;
5521         uint64_t invoice_request_ref = 0;
5522         // WARNING: we may need a move here but no clone is available for LDKUnsignedInvoiceRequest
5523         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
5524         invoice_request_ref = tag_ptr(invoice_request_var.inner, invoice_request_var.is_owned);
5525         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 27, invoice_request_ref, 0, 0, 0, 0, 0);
5526         void* ret_ptr = untag_ptr(ret);
5527         CHECK_ACCESS(ret_ptr);
5528         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
5529         FREE(untag_ptr(ret));
5530         return ret_conv;
5531 }
5532 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedBolt12Invoice * invoice) {
5533         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5534         LDKUnsignedBolt12Invoice invoice_var = *invoice;
5535         uint64_t invoice_ref = 0;
5536         // WARNING: we may need a move here but no clone is available for LDKUnsignedBolt12Invoice
5537         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
5538         invoice_ref = tag_ptr(invoice_var.inner, invoice_var.is_owned);
5539         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 28, invoice_ref, 0, 0, 0, 0, 0);
5540         void* ret_ptr = untag_ptr(ret);
5541         CHECK_ACCESS(ret_ptr);
5542         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
5543         FREE(untag_ptr(ret));
5544         return ret_conv;
5545 }
5546 LDKCResult_ECDSASignatureNoneZ sign_gossip_message_LDKNodeSigner_jcall(const void* this_arg, LDKUnsignedGossipMessage msg) {
5547         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
5548         LDKUnsignedGossipMessage *msg_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
5549         *msg_copy = msg;
5550         uint64_t msg_ref = tag_ptr(msg_copy, true);
5551         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 29, msg_ref, 0, 0, 0, 0, 0);
5552         void* ret_ptr = untag_ptr(ret);
5553         CHECK_ACCESS(ret_ptr);
5554         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
5555         FREE(untag_ptr(ret));
5556         return ret_conv;
5557 }
5558 static void LDKNodeSigner_JCalls_cloned(LDKNodeSigner* new_obj) {
5559         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) new_obj->this_arg;
5560         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5561 }
5562 static inline LDKNodeSigner LDKNodeSigner_init (JSValue o) {
5563         LDKNodeSigner_JCalls *calls = MALLOC(sizeof(LDKNodeSigner_JCalls), "LDKNodeSigner_JCalls");
5564         atomic_init(&calls->refcnt, 1);
5565         calls->instance_ptr = o;
5566
5567         LDKNodeSigner ret = {
5568                 .this_arg = (void*) calls,
5569                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKNodeSigner_jcall,
5570                 .get_node_id = get_node_id_LDKNodeSigner_jcall,
5571                 .ecdh = ecdh_LDKNodeSigner_jcall,
5572                 .sign_invoice = sign_invoice_LDKNodeSigner_jcall,
5573                 .sign_bolt12_invoice_request = sign_bolt12_invoice_request_LDKNodeSigner_jcall,
5574                 .sign_bolt12_invoice = sign_bolt12_invoice_LDKNodeSigner_jcall,
5575                 .sign_gossip_message = sign_gossip_message_LDKNodeSigner_jcall,
5576                 .free = LDKNodeSigner_JCalls_free,
5577         };
5578         return ret;
5579 }
5580 uint64_t  __attribute__((export_name("TS_LDKNodeSigner_new"))) TS_LDKNodeSigner_new(JSValue o) {
5581         LDKNodeSigner *res_ptr = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
5582         *res_ptr = LDKNodeSigner_init(o);
5583         return tag_ptr(res_ptr, true);
5584 }
5585 int8_tArray  __attribute__((export_name("TS_NodeSigner_get_inbound_payment_key_material"))) TS_NodeSigner_get_inbound_payment_key_material(uint64_t this_arg) {
5586         void* this_arg_ptr = untag_ptr(this_arg);
5587         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5588         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5589         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5590         memcpy(ret_arr->elems, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32);
5591         return ret_arr;
5592 }
5593
5594 uint64_t  __attribute__((export_name("TS_NodeSigner_get_node_id"))) TS_NodeSigner_get_node_id(uint64_t this_arg, uint32_t recipient) {
5595         void* this_arg_ptr = untag_ptr(this_arg);
5596         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5597         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5598         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5599         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
5600         *ret_conv = (this_arg_conv->get_node_id)(this_arg_conv->this_arg, recipient_conv);
5601         return tag_ptr(ret_conv, true);
5602 }
5603
5604 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) {
5605         void* this_arg_ptr = untag_ptr(this_arg);
5606         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5607         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5608         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5609         LDKPublicKey other_key_ref;
5610         CHECK(other_key->arr_len == 33);
5611         memcpy(other_key_ref.compressed_form, other_key->elems, 33); FREE(other_key);
5612         void* tweak_ptr = untag_ptr(tweak);
5613         CHECK_ACCESS(tweak_ptr);
5614         LDKCOption_BigEndianScalarZ tweak_conv = *(LDKCOption_BigEndianScalarZ*)(tweak_ptr);
5615         tweak_conv = COption_BigEndianScalarZ_clone((LDKCOption_BigEndianScalarZ*)untag_ptr(tweak));
5616         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
5617         *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv);
5618         return tag_ptr(ret_conv, true);
5619 }
5620
5621 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) {
5622         void* this_arg_ptr = untag_ptr(this_arg);
5623         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5624         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5625         LDKu8slice hrp_bytes_ref;
5626         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
5627         hrp_bytes_ref.data = hrp_bytes->elems;
5628         LDKCVec_U5Z invoice_data_constr;
5629         invoice_data_constr.datalen = invoice_data->arr_len;
5630         if (invoice_data_constr.datalen > 0)
5631                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
5632         else
5633                 invoice_data_constr.data = NULL;
5634         int8_t* invoice_data_vals = (void*) invoice_data->elems;
5635         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
5636                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
5637                 
5638                 invoice_data_constr.data[h] = (LDKU5){ ._0 = invoice_data_conv_7 };
5639         }
5640         FREE(invoice_data);
5641         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5642         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
5643         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, recipient_conv);
5644         FREE(hrp_bytes);
5645         return tag_ptr(ret_conv, true);
5646 }
5647
5648 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) {
5649         void* this_arg_ptr = untag_ptr(this_arg);
5650         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5651         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5652         LDKUnsignedInvoiceRequest invoice_request_conv;
5653         invoice_request_conv.inner = untag_ptr(invoice_request);
5654         invoice_request_conv.is_owned = ptr_is_owned(invoice_request);
5655         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_conv);
5656         invoice_request_conv.is_owned = false;
5657         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
5658         *ret_conv = (this_arg_conv->sign_bolt12_invoice_request)(this_arg_conv->this_arg, &invoice_request_conv);
5659         return tag_ptr(ret_conv, true);
5660 }
5661
5662 uint64_t  __attribute__((export_name("TS_NodeSigner_sign_bolt12_invoice"))) TS_NodeSigner_sign_bolt12_invoice(uint64_t this_arg, uint64_t invoice) {
5663         void* this_arg_ptr = untag_ptr(this_arg);
5664         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5665         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5666         LDKUnsignedBolt12Invoice invoice_conv;
5667         invoice_conv.inner = untag_ptr(invoice);
5668         invoice_conv.is_owned = ptr_is_owned(invoice);
5669         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
5670         invoice_conv.is_owned = false;
5671         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
5672         *ret_conv = (this_arg_conv->sign_bolt12_invoice)(this_arg_conv->this_arg, &invoice_conv);
5673         return tag_ptr(ret_conv, true);
5674 }
5675
5676 uint64_t  __attribute__((export_name("TS_NodeSigner_sign_gossip_message"))) TS_NodeSigner_sign_gossip_message(uint64_t this_arg, uint64_t msg) {
5677         void* this_arg_ptr = untag_ptr(this_arg);
5678         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5679         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
5680         void* msg_ptr = untag_ptr(msg);
5681         CHECK_ACCESS(msg_ptr);
5682         LDKUnsignedGossipMessage msg_conv = *(LDKUnsignedGossipMessage*)(msg_ptr);
5683         msg_conv = UnsignedGossipMessage_clone((LDKUnsignedGossipMessage*)untag_ptr(msg));
5684         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
5685         *ret_conv = (this_arg_conv->sign_gossip_message)(this_arg_conv->this_arg, msg_conv);
5686         return tag_ptr(ret_conv, true);
5687 }
5688
5689 typedef struct LDKSignerProvider_JCalls {
5690         atomic_size_t refcnt;
5691         uint32_t instance_ptr;
5692 } LDKSignerProvider_JCalls;
5693 static void LDKSignerProvider_JCalls_free(void* this_arg) {
5694         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5695         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5696                 FREE(j_calls);
5697         }
5698 }
5699 LDKThirtyTwoBytes generate_channel_keys_id_LDKSignerProvider_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis, LDKU128 user_channel_id) {
5700         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5701         jboolean inbound_conv = inbound;
5702         int64_t channel_value_satoshis_conv = channel_value_satoshis;
5703         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
5704         memcpy(user_channel_id_arr->elems, user_channel_id.le_bytes, 16);
5705         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);
5706         LDKThirtyTwoBytes ret_ref;
5707         CHECK(ret->arr_len == 32);
5708         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5709         return ret_ref;
5710 }
5711 LDKWriteableEcdsaChannelSigner derive_channel_signer_LDKSignerProvider_jcall(const void* this_arg, uint64_t channel_value_satoshis, LDKThirtyTwoBytes channel_keys_id) {
5712         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5713         int64_t channel_value_satoshis_conv = channel_value_satoshis;
5714         int8_tArray channel_keys_id_arr = init_int8_tArray(32, __LINE__);
5715         memcpy(channel_keys_id_arr->elems, channel_keys_id.data, 32);
5716         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);
5717         void* ret_ptr = untag_ptr(ret);
5718         CHECK_ACCESS(ret_ptr);
5719         LDKWriteableEcdsaChannelSigner ret_conv = *(LDKWriteableEcdsaChannelSigner*)(ret_ptr);
5720         FREE(untag_ptr(ret));
5721         return ret_conv;
5722 }
5723 LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ read_chan_signer_LDKSignerProvider_jcall(const void* this_arg, LDKu8slice reader) {
5724         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5725         LDKu8slice reader_var = reader;
5726         int8_tArray reader_arr = init_int8_tArray(reader_var.datalen, __LINE__);
5727         memcpy(reader_arr->elems, reader_var.data, reader_var.datalen);
5728         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 32, (uint32_t)reader_arr, 0, 0, 0, 0, 0);
5729         void* ret_ptr = untag_ptr(ret);
5730         CHECK_ACCESS(ret_ptr);
5731         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ ret_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(ret_ptr);
5732         FREE(untag_ptr(ret));
5733         return ret_conv;
5734 }
5735 LDKCResult_CVec_u8ZNoneZ get_destination_script_LDKSignerProvider_jcall(const void* this_arg) {
5736         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5737         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 33, 0, 0, 0, 0, 0, 0);
5738         void* ret_ptr = untag_ptr(ret);
5739         CHECK_ACCESS(ret_ptr);
5740         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
5741         FREE(untag_ptr(ret));
5742         return ret_conv;
5743 }
5744 LDKCResult_ShutdownScriptNoneZ get_shutdown_scriptpubkey_LDKSignerProvider_jcall(const void* this_arg) {
5745         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
5746         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 34, 0, 0, 0, 0, 0, 0);
5747         void* ret_ptr = untag_ptr(ret);
5748         CHECK_ACCESS(ret_ptr);
5749         LDKCResult_ShutdownScriptNoneZ ret_conv = *(LDKCResult_ShutdownScriptNoneZ*)(ret_ptr);
5750         FREE(untag_ptr(ret));
5751         return ret_conv;
5752 }
5753 static void LDKSignerProvider_JCalls_cloned(LDKSignerProvider* new_obj) {
5754         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) new_obj->this_arg;
5755         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5756 }
5757 static inline LDKSignerProvider LDKSignerProvider_init (JSValue o) {
5758         LDKSignerProvider_JCalls *calls = MALLOC(sizeof(LDKSignerProvider_JCalls), "LDKSignerProvider_JCalls");
5759         atomic_init(&calls->refcnt, 1);
5760         calls->instance_ptr = o;
5761
5762         LDKSignerProvider ret = {
5763                 .this_arg = (void*) calls,
5764                 .generate_channel_keys_id = generate_channel_keys_id_LDKSignerProvider_jcall,
5765                 .derive_channel_signer = derive_channel_signer_LDKSignerProvider_jcall,
5766                 .read_chan_signer = read_chan_signer_LDKSignerProvider_jcall,
5767                 .get_destination_script = get_destination_script_LDKSignerProvider_jcall,
5768                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKSignerProvider_jcall,
5769                 .free = LDKSignerProvider_JCalls_free,
5770         };
5771         return ret;
5772 }
5773 uint64_t  __attribute__((export_name("TS_LDKSignerProvider_new"))) TS_LDKSignerProvider_new(JSValue o) {
5774         LDKSignerProvider *res_ptr = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
5775         *res_ptr = LDKSignerProvider_init(o);
5776         return tag_ptr(res_ptr, true);
5777 }
5778 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) {
5779         void* this_arg_ptr = untag_ptr(this_arg);
5780         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5781         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
5782         LDKU128 user_channel_id_ref;
5783         CHECK(user_channel_id->arr_len == 16);
5784         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
5785         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5786         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);
5787         return ret_arr;
5788 }
5789
5790 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) {
5791         void* this_arg_ptr = untag_ptr(this_arg);
5792         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5793         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
5794         LDKThirtyTwoBytes channel_keys_id_ref;
5795         CHECK(channel_keys_id->arr_len == 32);
5796         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
5797         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
5798         *ret_ret = (this_arg_conv->derive_channel_signer)(this_arg_conv->this_arg, channel_value_satoshis, channel_keys_id_ref);
5799         return tag_ptr(ret_ret, true);
5800 }
5801
5802 uint64_t  __attribute__((export_name("TS_SignerProvider_read_chan_signer"))) TS_SignerProvider_read_chan_signer(uint64_t this_arg, int8_tArray reader) {
5803         void* this_arg_ptr = untag_ptr(this_arg);
5804         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5805         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
5806         LDKu8slice reader_ref;
5807         reader_ref.datalen = reader->arr_len;
5808         reader_ref.data = reader->elems;
5809         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
5810         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
5811         FREE(reader);
5812         return tag_ptr(ret_conv, true);
5813 }
5814
5815 uint64_t  __attribute__((export_name("TS_SignerProvider_get_destination_script"))) TS_SignerProvider_get_destination_script(uint64_t this_arg) {
5816         void* this_arg_ptr = untag_ptr(this_arg);
5817         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5818         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
5819         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
5820         *ret_conv = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
5821         return tag_ptr(ret_conv, true);
5822 }
5823
5824 uint64_t  __attribute__((export_name("TS_SignerProvider_get_shutdown_scriptpubkey"))) TS_SignerProvider_get_shutdown_scriptpubkey(uint64_t this_arg) {
5825         void* this_arg_ptr = untag_ptr(this_arg);
5826         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5827         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
5828         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
5829         *ret_conv = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
5830         return tag_ptr(ret_conv, true);
5831 }
5832
5833 typedef struct LDKFeeEstimator_JCalls {
5834         atomic_size_t refcnt;
5835         uint32_t instance_ptr;
5836 } LDKFeeEstimator_JCalls;
5837 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
5838         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
5839         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5840                 FREE(j_calls);
5841         }
5842 }
5843 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
5844         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
5845         uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
5846         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 35, confirmation_target_conv, 0, 0, 0, 0, 0);
5847 }
5848 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
5849         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
5850         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5851 }
5852 static inline LDKFeeEstimator LDKFeeEstimator_init (JSValue o) {
5853         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
5854         atomic_init(&calls->refcnt, 1);
5855         calls->instance_ptr = o;
5856
5857         LDKFeeEstimator ret = {
5858                 .this_arg = (void*) calls,
5859                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
5860                 .free = LDKFeeEstimator_JCalls_free,
5861         };
5862         return ret;
5863 }
5864 uint64_t  __attribute__((export_name("TS_LDKFeeEstimator_new"))) TS_LDKFeeEstimator_new(JSValue o) {
5865         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
5866         *res_ptr = LDKFeeEstimator_init(o);
5867         return tag_ptr(res_ptr, true);
5868 }
5869 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) {
5870         void* this_arg_ptr = untag_ptr(this_arg);
5871         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5872         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
5873         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
5874         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
5875         return ret_conv;
5876 }
5877
5878 typedef struct LDKRouter_JCalls {
5879         atomic_size_t refcnt;
5880         uint32_t instance_ptr;
5881 } LDKRouter_JCalls;
5882 static void LDKRouter_JCalls_free(void* this_arg) {
5883         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
5884         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5885                 FREE(j_calls);
5886         }
5887 }
5888 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs) {
5889         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
5890         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
5891         memcpy(payer_arr->elems, payer.compressed_form, 33);
5892         LDKRouteParameters route_params_var = *route_params;
5893         uint64_t route_params_ref = 0;
5894         route_params_var = RouteParameters_clone(&route_params_var);
5895         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
5896         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
5897         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
5898         uint64_tArray first_hops_arr = NULL;
5899         if (first_hops != NULL) {
5900                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
5901                 first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
5902                 uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
5903                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
5904                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
5905                         uint64_t first_hops_conv_16_ref = 0;
5906                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
5907                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
5908                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
5909                 }
5910         
5911         }
5912         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
5913         uint64_t inflight_htlcs_ref = 0;
5914         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
5915         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
5916         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);
5917         void* ret_ptr = untag_ptr(ret);
5918         CHECK_ACCESS(ret_ptr);
5919         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
5920         FREE(untag_ptr(ret));
5921         return ret_conv;
5922 }
5923 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) {
5924         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
5925         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
5926         memcpy(payer_arr->elems, payer.compressed_form, 33);
5927         LDKRouteParameters route_params_var = *route_params;
5928         uint64_t route_params_ref = 0;
5929         route_params_var = RouteParameters_clone(&route_params_var);
5930         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
5931         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
5932         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
5933         uint64_tArray first_hops_arr = NULL;
5934         if (first_hops != NULL) {
5935                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
5936                 first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
5937                 uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
5938                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
5939                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
5940                         uint64_t first_hops_conv_16_ref = 0;
5941                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
5942                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
5943                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
5944                 }
5945         
5946         }
5947         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
5948         uint64_t inflight_htlcs_ref = 0;
5949         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
5950         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
5951         int8_tArray _payment_hash_arr = init_int8_tArray(32, __LINE__);
5952         memcpy(_payment_hash_arr->elems, _payment_hash.data, 32);
5953         int8_tArray _payment_id_arr = init_int8_tArray(32, __LINE__);
5954         memcpy(_payment_id_arr->elems, _payment_id.data, 32);
5955         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);
5956         void* ret_ptr = untag_ptr(ret);
5957         CHECK_ACCESS(ret_ptr);
5958         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
5959         FREE(untag_ptr(ret));
5960         return ret_conv;
5961 }
5962 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
5963         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
5964         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5965 }
5966 static inline LDKRouter LDKRouter_init (JSValue o) {
5967         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
5968         atomic_init(&calls->refcnt, 1);
5969         calls->instance_ptr = o;
5970
5971         LDKRouter ret = {
5972                 .this_arg = (void*) calls,
5973                 .find_route = find_route_LDKRouter_jcall,
5974                 .find_route_with_id = find_route_with_id_LDKRouter_jcall,
5975                 .free = LDKRouter_JCalls_free,
5976         };
5977         return ret;
5978 }
5979 uint64_t  __attribute__((export_name("TS_LDKRouter_new"))) TS_LDKRouter_new(JSValue o) {
5980         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
5981         *res_ptr = LDKRouter_init(o);
5982         return tag_ptr(res_ptr, true);
5983 }
5984 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) {
5985         void* this_arg_ptr = untag_ptr(this_arg);
5986         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5987         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
5988         LDKPublicKey payer_ref;
5989         CHECK(payer->arr_len == 33);
5990         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
5991         LDKRouteParameters route_params_conv;
5992         route_params_conv.inner = untag_ptr(route_params);
5993         route_params_conv.is_owned = ptr_is_owned(route_params);
5994         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
5995         route_params_conv.is_owned = false;
5996         LDKCVec_ChannelDetailsZ first_hops_constr;
5997         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
5998         if (first_hops != 0) {
5999                 first_hops_constr.datalen = first_hops->arr_len;
6000                 if (first_hops_constr.datalen > 0)
6001                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
6002                 else
6003                         first_hops_constr.data = NULL;
6004                 uint64_t* first_hops_vals = first_hops->elems;
6005                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
6006                         uint64_t first_hops_conv_16 = first_hops_vals[q];
6007                         LDKChannelDetails first_hops_conv_16_conv;
6008                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
6009                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
6010                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
6011                         first_hops_conv_16_conv.is_owned = false;
6012                         first_hops_constr.data[q] = first_hops_conv_16_conv;
6013                 }
6014                 FREE(first_hops);
6015                 first_hops_ptr = &first_hops_constr;
6016         }
6017         LDKInFlightHtlcs inflight_htlcs_conv;
6018         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
6019         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
6020         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
6021         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
6022         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
6023         *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, inflight_htlcs_conv);
6024         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
6025         return tag_ptr(ret_conv, true);
6026 }
6027
6028 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) {
6029         void* this_arg_ptr = untag_ptr(this_arg);
6030         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6031         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
6032         LDKPublicKey payer_ref;
6033         CHECK(payer->arr_len == 33);
6034         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
6035         LDKRouteParameters route_params_conv;
6036         route_params_conv.inner = untag_ptr(route_params);
6037         route_params_conv.is_owned = ptr_is_owned(route_params);
6038         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
6039         route_params_conv.is_owned = false;
6040         LDKCVec_ChannelDetailsZ first_hops_constr;
6041         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
6042         if (first_hops != 0) {
6043                 first_hops_constr.datalen = first_hops->arr_len;
6044                 if (first_hops_constr.datalen > 0)
6045                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
6046                 else
6047                         first_hops_constr.data = NULL;
6048                 uint64_t* first_hops_vals = first_hops->elems;
6049                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
6050                         uint64_t first_hops_conv_16 = first_hops_vals[q];
6051                         LDKChannelDetails first_hops_conv_16_conv;
6052                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
6053                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
6054                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
6055                         first_hops_conv_16_conv.is_owned = false;
6056                         first_hops_constr.data[q] = first_hops_conv_16_conv;
6057                 }
6058                 FREE(first_hops);
6059                 first_hops_ptr = &first_hops_constr;
6060         }
6061         LDKInFlightHtlcs inflight_htlcs_conv;
6062         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
6063         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
6064         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
6065         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
6066         LDKThirtyTwoBytes _payment_hash_ref;
6067         CHECK(_payment_hash->arr_len == 32);
6068         memcpy(_payment_hash_ref.data, _payment_hash->elems, 32); FREE(_payment_hash);
6069         LDKThirtyTwoBytes _payment_id_ref;
6070         CHECK(_payment_id->arr_len == 32);
6071         memcpy(_payment_id_ref.data, _payment_id->elems, 32); FREE(_payment_id);
6072         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
6073         *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);
6074         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
6075         return tag_ptr(ret_conv, true);
6076 }
6077
6078 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
6079         return ThirtyTwoBytes_clone(&owner->a);
6080 }
6081 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(uint64_t owner) {
6082         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
6083         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6084         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(owner_conv).data, 32);
6085         return ret_arr;
6086 }
6087
6088 static inline struct LDKChannelManager C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
6089         LDKChannelManager ret = owner->b;
6090         ret.is_owned = false;
6091         return ret;
6092 }
6093 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(uint64_t owner) {
6094         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
6095         LDKChannelManager ret_var = C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(owner_conv);
6096         uint64_t ret_ref = 0;
6097         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6098         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6099         return ret_ref;
6100 }
6101
6102 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6103 CHECK(owner->result_ok);
6104         return &*owner->contents.result;
6105 }
6106 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(uint64_t owner) {
6107         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
6108         uint64_t ret_ret = tag_ptr(CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
6109         return ret_ret;
6110 }
6111
6112 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6113 CHECK(!owner->result_ok);
6114         return DecodeError_clone(&*owner->contents.err);
6115 }
6116 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(uint64_t owner) {
6117         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
6118         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6119         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(owner_conv);
6120         uint64_t ret_ref = tag_ptr(ret_copy, true);
6121         return ret_ref;
6122 }
6123
6124 uint32_t __attribute__((export_name("TS_LDKMaxDustHTLCExposure_ty_from_ptr"))) TS_LDKMaxDustHTLCExposure_ty_from_ptr(uint64_t ptr) {
6125         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
6126         switch(obj->tag) {
6127                 case LDKMaxDustHTLCExposure_FixedLimitMsat: return 0;
6128                 case LDKMaxDustHTLCExposure_FeeRateMultiplier: return 1;
6129                 default: abort();
6130         }
6131 }
6132 int64_t __attribute__((export_name("TS_LDKMaxDustHTLCExposure_FixedLimitMsat_get_fixed_limit_msat"))) TS_LDKMaxDustHTLCExposure_FixedLimitMsat_get_fixed_limit_msat(uint64_t ptr) {
6133         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
6134         assert(obj->tag == LDKMaxDustHTLCExposure_FixedLimitMsat);
6135                         int64_t fixed_limit_msat_conv = obj->fixed_limit_msat;
6136         return fixed_limit_msat_conv;
6137 }
6138 int64_t __attribute__((export_name("TS_LDKMaxDustHTLCExposure_FeeRateMultiplier_get_fee_rate_multiplier"))) TS_LDKMaxDustHTLCExposure_FeeRateMultiplier_get_fee_rate_multiplier(uint64_t ptr) {
6139         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
6140         assert(obj->tag == LDKMaxDustHTLCExposure_FeeRateMultiplier);
6141                         int64_t fee_rate_multiplier_conv = obj->fee_rate_multiplier;
6142         return fee_rate_multiplier_conv;
6143 }
6144 static inline struct LDKMaxDustHTLCExposure CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
6145 CHECK(owner->result_ok);
6146         return MaxDustHTLCExposure_clone(&*owner->contents.result);
6147 }
6148 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(uint64_t owner) {
6149         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
6150         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
6151         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(owner_conv);
6152         uint64_t ret_ref = tag_ptr(ret_copy, true);
6153         return ret_ref;
6154 }
6155
6156 static inline struct LDKDecodeError CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
6157 CHECK(!owner->result_ok);
6158         return DecodeError_clone(&*owner->contents.err);
6159 }
6160 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_err"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(uint64_t owner) {
6161         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
6162         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6163         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(owner_conv);
6164         uint64_t ret_ref = tag_ptr(ret_copy, true);
6165         return ret_ref;
6166 }
6167
6168 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
6169         LDKChannelConfig ret = *owner->contents.result;
6170         ret.is_owned = false;
6171         return ret;
6172 }
6173 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_get_ok(uint64_t owner) {
6174         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
6175         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
6176         uint64_t ret_ref = 0;
6177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6178         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6179         return ret_ref;
6180 }
6181
6182 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
6183 CHECK(!owner->result_ok);
6184         return DecodeError_clone(&*owner->contents.err);
6185 }
6186 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_err"))) TS_CResult_ChannelConfigDecodeErrorZ_get_err(uint64_t owner) {
6187         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
6188         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6189         *ret_copy = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
6190         uint64_t ret_ref = tag_ptr(ret_copy, true);
6191         return ret_ref;
6192 }
6193
6194 uint32_t __attribute__((export_name("TS_LDKCOption_MaxDustHTLCExposureZ_ty_from_ptr"))) TS_LDKCOption_MaxDustHTLCExposureZ_ty_from_ptr(uint64_t ptr) {
6195         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
6196         switch(obj->tag) {
6197                 case LDKCOption_MaxDustHTLCExposureZ_Some: return 0;
6198                 case LDKCOption_MaxDustHTLCExposureZ_None: return 1;
6199                 default: abort();
6200         }
6201 }
6202 uint64_t __attribute__((export_name("TS_LDKCOption_MaxDustHTLCExposureZ_Some_get_some"))) TS_LDKCOption_MaxDustHTLCExposureZ_Some_get_some(uint64_t ptr) {
6203         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
6204         assert(obj->tag == LDKCOption_MaxDustHTLCExposureZ_Some);
6205                         uint64_t some_ref = tag_ptr(&obj->some, false);
6206         return some_ref;
6207 }
6208 uint32_t __attribute__((export_name("TS_LDKCOption_APIErrorZ_ty_from_ptr"))) TS_LDKCOption_APIErrorZ_ty_from_ptr(uint64_t ptr) {
6209         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
6210         switch(obj->tag) {
6211                 case LDKCOption_APIErrorZ_Some: return 0;
6212                 case LDKCOption_APIErrorZ_None: return 1;
6213                 default: abort();
6214         }
6215 }
6216 uint64_t __attribute__((export_name("TS_LDKCOption_APIErrorZ_Some_get_some"))) TS_LDKCOption_APIErrorZ_Some_get_some(uint64_t ptr) {
6217         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
6218         assert(obj->tag == LDKCOption_APIErrorZ_Some);
6219                         uint64_t some_ref = tag_ptr(&obj->some, false);
6220         return some_ref;
6221 }
6222 static inline struct LDKCOption_APIErrorZ CResult_COption_APIErrorZDecodeErrorZ_get_ok(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
6223 CHECK(owner->result_ok);
6224         return COption_APIErrorZ_clone(&*owner->contents.result);
6225 }
6226 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_get_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_get_ok(uint64_t owner) {
6227         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
6228         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
6229         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_ok(owner_conv);
6230         uint64_t ret_ref = tag_ptr(ret_copy, true);
6231         return ret_ref;
6232 }
6233
6234 static inline struct LDKDecodeError CResult_COption_APIErrorZDecodeErrorZ_get_err(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
6235 CHECK(!owner->result_ok);
6236         return DecodeError_clone(&*owner->contents.err);
6237 }
6238 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_get_err"))) TS_CResult_COption_APIErrorZDecodeErrorZ_get_err(uint64_t owner) {
6239         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
6240         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6241         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_err(owner_conv);
6242         uint64_t ret_ref = tag_ptr(ret_copy, true);
6243         return ret_ref;
6244 }
6245
6246 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
6247         LDKChannelMonitorUpdate ret = *owner->contents.result;
6248         ret.is_owned = false;
6249         return ret;
6250 }
6251 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint64_t owner) {
6252         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
6253         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
6254         uint64_t ret_ref = 0;
6255         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6256         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6257         return ret_ref;
6258 }
6259
6260 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
6261 CHECK(!owner->result_ok);
6262         return DecodeError_clone(&*owner->contents.err);
6263 }
6264 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint64_t owner) {
6265         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
6266         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6267         *ret_copy = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
6268         uint64_t ret_ref = tag_ptr(ret_copy, true);
6269         return ret_ref;
6270 }
6271
6272 uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_ty_from_ptr"))) TS_LDKCOption_MonitorEventZ_ty_from_ptr(uint64_t ptr) {
6273         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
6274         switch(obj->tag) {
6275                 case LDKCOption_MonitorEventZ_Some: return 0;
6276                 case LDKCOption_MonitorEventZ_None: return 1;
6277                 default: abort();
6278         }
6279 }
6280 uint64_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_Some_get_some"))) TS_LDKCOption_MonitorEventZ_Some_get_some(uint64_t ptr) {
6281         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
6282         assert(obj->tag == LDKCOption_MonitorEventZ_Some);
6283                         uint64_t some_ref = tag_ptr(&obj->some, false);
6284         return some_ref;
6285 }
6286 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
6287 CHECK(owner->result_ok);
6288         return COption_MonitorEventZ_clone(&*owner->contents.result);
6289 }
6290 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok(uint64_t owner) {
6291         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
6292         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
6293         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
6294         uint64_t ret_ref = tag_ptr(ret_copy, true);
6295         return ret_ref;
6296 }
6297
6298 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
6299 CHECK(!owner->result_ok);
6300         return DecodeError_clone(&*owner->contents.err);
6301 }
6302 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err(uint64_t owner) {
6303         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
6304         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6305         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
6306         uint64_t ret_ref = tag_ptr(ret_copy, true);
6307         return ret_ref;
6308 }
6309
6310 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
6311         LDKHTLCUpdate ret = *owner->contents.result;
6312         ret.is_owned = false;
6313         return ret;
6314 }
6315 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_ok(uint64_t owner) {
6316         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
6317         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
6318         uint64_t ret_ref = 0;
6319         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6320         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6321         return ret_ref;
6322 }
6323
6324 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
6325 CHECK(!owner->result_ok);
6326         return DecodeError_clone(&*owner->contents.err);
6327 }
6328 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_err(uint64_t owner) {
6329         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
6330         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6331         *ret_copy = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
6332         uint64_t ret_ref = tag_ptr(ret_copy, true);
6333         return ret_ref;
6334 }
6335
6336 static inline struct LDKOutPoint C2Tuple_OutPointCVec_u8ZZ_get_a(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
6337         LDKOutPoint ret = owner->a;
6338         ret.is_owned = false;
6339         return ret;
6340 }
6341 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_get_a"))) TS_C2Tuple_OutPointCVec_u8ZZ_get_a(uint64_t owner) {
6342         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
6343         LDKOutPoint ret_var = C2Tuple_OutPointCVec_u8ZZ_get_a(owner_conv);
6344         uint64_t ret_ref = 0;
6345         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6346         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6347         return ret_ref;
6348 }
6349
6350 static inline struct LDKCVec_u8Z C2Tuple_OutPointCVec_u8ZZ_get_b(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
6351         return CVec_u8Z_clone(&owner->b);
6352 }
6353 int8_tArray  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_get_b"))) TS_C2Tuple_OutPointCVec_u8ZZ_get_b(uint64_t owner) {
6354         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
6355         LDKCVec_u8Z ret_var = C2Tuple_OutPointCVec_u8ZZ_get_b(owner_conv);
6356         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6357         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6358         CVec_u8Z_free(ret_var);
6359         return ret_arr;
6360 }
6361
6362 static inline uint32_t C2Tuple_u32CVec_u8ZZ_get_a(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
6363         return owner->a;
6364 }
6365 int32_t  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_get_a"))) TS_C2Tuple_u32CVec_u8ZZ_get_a(uint64_t owner) {
6366         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
6367         int32_t ret_conv = C2Tuple_u32CVec_u8ZZ_get_a(owner_conv);
6368         return ret_conv;
6369 }
6370
6371 static inline struct LDKCVec_u8Z C2Tuple_u32CVec_u8ZZ_get_b(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
6372         return CVec_u8Z_clone(&owner->b);
6373 }
6374 int8_tArray  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_get_b"))) TS_C2Tuple_u32CVec_u8ZZ_get_b(uint64_t owner) {
6375         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
6376         LDKCVec_u8Z ret_var = C2Tuple_u32CVec_u8ZZ_get_b(owner_conv);
6377         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6378         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6379         CVec_u8Z_free(ret_var);
6380         return ret_arr;
6381 }
6382
6383 static inline LDKCVec_C2Tuple_u32CVec_u8ZZZ CVec_C2Tuple_u32CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u32CVec_u8ZZZ *orig) {
6384         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u32CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
6385         for (size_t i = 0; i < ret.datalen; i++) {
6386                 ret.data[i] = C2Tuple_u32CVec_u8ZZ_clone(&orig->data[i]);
6387         }
6388         return ret;
6389 }
6390 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
6391         return ThirtyTwoBytes_clone(&owner->a);
6392 }
6393 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(uint64_t owner) {
6394         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
6395         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6396         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(owner_conv).data, 32);
6397         return ret_arr;
6398 }
6399
6400 static inline struct LDKCVec_C2Tuple_u32CVec_u8ZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
6401         return CVec_C2Tuple_u32CVec_u8ZZZ_clone(&owner->b);
6402 }
6403 uint64_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(uint64_t owner) {
6404         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
6405         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(owner_conv);
6406         uint64_tArray ret_arr = NULL;
6407         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
6408         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
6409         for (size_t x = 0; x < ret_var.datalen; x++) {
6410                 LDKC2Tuple_u32CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
6411                 *ret_conv_23_conv = ret_var.data[x];
6412                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
6413         }
6414         
6415         FREE(ret_var.data);
6416         return ret_arr;
6417 }
6418
6419 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ *orig) {
6420         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 };
6421         for (size_t i = 0; i < ret.datalen; i++) {
6422                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(&orig->data[i]);
6423         }
6424         return ret;
6425 }
6426 static inline LDKCVec_CommitmentTransactionZ CVec_CommitmentTransactionZ_clone(const LDKCVec_CommitmentTransactionZ *orig) {
6427         LDKCVec_CommitmentTransactionZ ret = { .data = MALLOC(sizeof(LDKCommitmentTransaction) * orig->datalen, "LDKCVec_CommitmentTransactionZ clone bytes"), .datalen = orig->datalen };
6428         for (size_t i = 0; i < ret.datalen; i++) {
6429                 ret.data[i] = CommitmentTransaction_clone(&orig->data[i]);
6430         }
6431         return ret;
6432 }
6433 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6434         return owner->a;
6435 }
6436 int32_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_a"))) TS_C2Tuple_u32TxOutZ_get_a(uint64_t owner) {
6437         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
6438         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
6439         return ret_conv;
6440 }
6441
6442 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6443         return TxOut_clone(&owner->b);
6444 }
6445 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_b"))) TS_C2Tuple_u32TxOutZ_get_b(uint64_t owner) {
6446         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
6447         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
6448         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
6449         return tag_ptr(ret_ref, true);
6450 }
6451
6452 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
6453         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
6454         for (size_t i = 0; i < ret.datalen; i++) {
6455                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
6456         }
6457         return ret;
6458 }
6459 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6460         return ThirtyTwoBytes_clone(&owner->a);
6461 }
6462 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(uint64_t owner) {
6463         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
6464         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6465         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data, 32);
6466         return ret_arr;
6467 }
6468
6469 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6470         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
6471 }
6472 uint64_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(uint64_t owner) {
6473         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
6474         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
6475         uint64_tArray ret_arr = NULL;
6476         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
6477         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
6478         for (size_t u = 0; u < ret_var.datalen; u++) {
6479                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
6480                 *ret_conv_20_conv = ret_var.data[u];
6481                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
6482         }
6483         
6484         FREE(ret_var.data);
6485         return ret_arr;
6486 }
6487
6488 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ *orig) {
6489         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 };
6490         for (size_t i = 0; i < ret.datalen; i++) {
6491                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
6492         }
6493         return ret;
6494 }
6495 uint32_t __attribute__((export_name("TS_LDKBalance_ty_from_ptr"))) TS_LDKBalance_ty_from_ptr(uint64_t ptr) {
6496         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6497         switch(obj->tag) {
6498                 case LDKBalance_ClaimableOnChannelClose: return 0;
6499                 case LDKBalance_ClaimableAwaitingConfirmations: return 1;
6500                 case LDKBalance_ContentiousClaimable: return 2;
6501                 case LDKBalance_MaybeTimeoutClaimableHTLC: return 3;
6502                 case LDKBalance_MaybePreimageClaimableHTLC: return 4;
6503                 case LDKBalance_CounterpartyRevokedOutputClaimable: return 5;
6504                 default: abort();
6505         }
6506 }
6507 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableOnChannelClose_get_amount_satoshis"))) TS_LDKBalance_ClaimableOnChannelClose_get_amount_satoshis(uint64_t ptr) {
6508         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6509         assert(obj->tag == LDKBalance_ClaimableOnChannelClose);
6510                         int64_t amount_satoshis_conv = obj->claimable_on_channel_close.amount_satoshis;
6511         return amount_satoshis_conv;
6512 }
6513 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_amount_satoshis"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_amount_satoshis(uint64_t ptr) {
6514         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6515         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
6516                         int64_t amount_satoshis_conv = obj->claimable_awaiting_confirmations.amount_satoshis;
6517         return amount_satoshis_conv;
6518 }
6519 int32_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height(uint64_t ptr) {
6520         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6521         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
6522                         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
6523         return confirmation_height_conv;
6524 }
6525 int64_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_amount_satoshis"))) TS_LDKBalance_ContentiousClaimable_get_amount_satoshis(uint64_t ptr) {
6526         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6527         assert(obj->tag == LDKBalance_ContentiousClaimable);
6528                         int64_t amount_satoshis_conv = obj->contentious_claimable.amount_satoshis;
6529         return amount_satoshis_conv;
6530 }
6531 int32_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_timeout_height"))) TS_LDKBalance_ContentiousClaimable_get_timeout_height(uint64_t ptr) {
6532         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6533         assert(obj->tag == LDKBalance_ContentiousClaimable);
6534                         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
6535         return timeout_height_conv;
6536 }
6537 int8_tArray __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_payment_hash"))) TS_LDKBalance_ContentiousClaimable_get_payment_hash(uint64_t ptr) {
6538         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6539         assert(obj->tag == LDKBalance_ContentiousClaimable);
6540                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
6541                         memcpy(payment_hash_arr->elems, obj->contentious_claimable.payment_hash.data, 32);
6542         return payment_hash_arr;
6543 }
6544 int8_tArray __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_payment_preimage"))) TS_LDKBalance_ContentiousClaimable_get_payment_preimage(uint64_t ptr) {
6545         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6546         assert(obj->tag == LDKBalance_ContentiousClaimable);
6547                         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
6548                         memcpy(payment_preimage_arr->elems, obj->contentious_claimable.payment_preimage.data, 32);
6549         return payment_preimage_arr;
6550 }
6551 int64_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_amount_satoshis"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_amount_satoshis(uint64_t ptr) {
6552         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6553         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
6554                         int64_t amount_satoshis_conv = obj->maybe_timeout_claimable_htlc.amount_satoshis;
6555         return amount_satoshis_conv;
6556 }
6557 int32_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height(uint64_t ptr) {
6558         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6559         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
6560                         int32_t claimable_height_conv = obj->maybe_timeout_claimable_htlc.claimable_height;
6561         return claimable_height_conv;
6562 }
6563 int8_tArray __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_payment_hash"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_payment_hash(uint64_t ptr) {
6564         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6565         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
6566                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
6567                         memcpy(payment_hash_arr->elems, obj->maybe_timeout_claimable_htlc.payment_hash.data, 32);
6568         return payment_hash_arr;
6569 }
6570 int64_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_amount_satoshis"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_amount_satoshis(uint64_t ptr) {
6571         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6572         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
6573                         int64_t amount_satoshis_conv = obj->maybe_preimage_claimable_htlc.amount_satoshis;
6574         return amount_satoshis_conv;
6575 }
6576 int32_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height(uint64_t ptr) {
6577         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6578         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
6579                         int32_t expiry_height_conv = obj->maybe_preimage_claimable_htlc.expiry_height;
6580         return expiry_height_conv;
6581 }
6582 int8_tArray __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_payment_hash"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_payment_hash(uint64_t ptr) {
6583         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6584         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
6585                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
6586                         memcpy(payment_hash_arr->elems, obj->maybe_preimage_claimable_htlc.payment_hash.data, 32);
6587         return payment_hash_arr;
6588 }
6589 int64_t __attribute__((export_name("TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_amount_satoshis"))) TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_amount_satoshis(uint64_t ptr) {
6590         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6591         assert(obj->tag == LDKBalance_CounterpartyRevokedOutputClaimable);
6592                         int64_t amount_satoshis_conv = obj->counterparty_revoked_output_claimable.amount_satoshis;
6593         return amount_satoshis_conv;
6594 }
6595 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
6596         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
6597         for (size_t i = 0; i < ret.datalen; i++) {
6598                 ret.data[i] = Balance_clone(&orig->data[i]);
6599         }
6600         return ret;
6601 }
6602 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
6603         return ThirtyTwoBytes_clone(&owner->a);
6604 }
6605 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(uint64_t owner) {
6606         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
6607         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6608         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(owner_conv).data, 32);
6609         return ret_arr;
6610 }
6611
6612 static inline struct LDKChannelMonitor C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
6613         LDKChannelMonitor ret = owner->b;
6614         ret.is_owned = false;
6615         return ret;
6616 }
6617 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(uint64_t owner) {
6618         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
6619         LDKChannelMonitor ret_var = C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(owner_conv);
6620         uint64_t ret_ref = 0;
6621         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6622         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6623         return ret_ref;
6624 }
6625
6626 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
6627 CHECK(owner->result_ok);
6628         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
6629 }
6630 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(uint64_t owner) {
6631         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
6632         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
6633         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
6634         return tag_ptr(ret_conv, true);
6635 }
6636
6637 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
6638 CHECK(!owner->result_ok);
6639         return DecodeError_clone(&*owner->contents.err);
6640 }
6641 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(uint64_t owner) {
6642         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
6643         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6644         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(owner_conv);
6645         uint64_t ret_ref = tag_ptr(ret_copy, true);
6646         return ret_ref;
6647 }
6648
6649 typedef struct LDKType_JCalls {
6650         atomic_size_t refcnt;
6651         uint32_t instance_ptr;
6652 } LDKType_JCalls;
6653 static void LDKType_JCalls_free(void* this_arg) {
6654         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6655         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6656                 FREE(j_calls);
6657         }
6658 }
6659 uint16_t type_id_LDKType_jcall(const void* this_arg) {
6660         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6661         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 38, 0, 0, 0, 0, 0, 0);
6662 }
6663 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
6664         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6665         jstring ret = (jstring)js_invoke_function_uuuuuu(j_calls->instance_ptr, 39, 0, 0, 0, 0, 0, 0);
6666         LDKStr ret_conv = str_ref_to_owned_c(ret);
6667         return ret_conv;
6668 }
6669 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
6670         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6671         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 40, 0, 0, 0, 0, 0, 0);
6672         LDKCVec_u8Z ret_ref;
6673         ret_ref.datalen = ret->arr_len;
6674         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
6675         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
6676         return ret_ref;
6677 }
6678 static void LDKType_JCalls_cloned(LDKType* new_obj) {
6679         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
6680         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6681 }
6682 static inline LDKType LDKType_init (JSValue o) {
6683         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
6684         atomic_init(&calls->refcnt, 1);
6685         calls->instance_ptr = o;
6686
6687         LDKType ret = {
6688                 .this_arg = (void*) calls,
6689                 .type_id = type_id_LDKType_jcall,
6690                 .debug_str = debug_str_LDKType_jcall,
6691                 .write = write_LDKType_jcall,
6692                 .cloned = LDKType_JCalls_cloned,
6693                 .free = LDKType_JCalls_free,
6694         };
6695         return ret;
6696 }
6697 uint64_t  __attribute__((export_name("TS_LDKType_new"))) TS_LDKType_new(JSValue o) {
6698         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
6699         *res_ptr = LDKType_init(o);
6700         return tag_ptr(res_ptr, true);
6701 }
6702 int16_t  __attribute__((export_name("TS_Type_type_id"))) TS_Type_type_id(uint64_t this_arg) {
6703         void* this_arg_ptr = untag_ptr(this_arg);
6704         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6705         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6706         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
6707         return ret_conv;
6708 }
6709
6710 jstring  __attribute__((export_name("TS_Type_debug_str"))) TS_Type_debug_str(uint64_t this_arg) {
6711         void* this_arg_ptr = untag_ptr(this_arg);
6712         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6713         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6714         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
6715         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
6716         Str_free(ret_str);
6717         return ret_conv;
6718 }
6719
6720 int8_tArray  __attribute__((export_name("TS_Type_write"))) TS_Type_write(uint64_t this_arg) {
6721         void* this_arg_ptr = untag_ptr(this_arg);
6722         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6723         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6724         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
6725         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6726         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6727         CVec_u8Z_free(ret_var);
6728         return ret_arr;
6729 }
6730
6731 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
6732         return owner->a;
6733 }
6734 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_a"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint64_t owner) {
6735         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
6736         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
6737         memcpy(ret_arr->elems, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form, 33);
6738         return ret_arr;
6739 }
6740
6741 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
6742         return Type_clone(&owner->b);
6743 }
6744 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_b"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint64_t owner) {
6745         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
6746         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
6747         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
6748         return tag_ptr(ret_ret, true);
6749 }
6750
6751 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
6752         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
6753         for (size_t i = 0; i < ret.datalen; i++) {
6754                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
6755         }
6756         return ret;
6757 }
6758 uint32_t __attribute__((export_name("TS_LDKOffersMessage_ty_from_ptr"))) TS_LDKOffersMessage_ty_from_ptr(uint64_t ptr) {
6759         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
6760         switch(obj->tag) {
6761                 case LDKOffersMessage_InvoiceRequest: return 0;
6762                 case LDKOffersMessage_Invoice: return 1;
6763                 case LDKOffersMessage_InvoiceError: return 2;
6764                 default: abort();
6765         }
6766 }
6767 uint64_t __attribute__((export_name("TS_LDKOffersMessage_InvoiceRequest_get_invoice_request"))) TS_LDKOffersMessage_InvoiceRequest_get_invoice_request(uint64_t ptr) {
6768         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
6769         assert(obj->tag == LDKOffersMessage_InvoiceRequest);
6770                         LDKInvoiceRequest invoice_request_var = obj->invoice_request;
6771                         uint64_t invoice_request_ref = 0;
6772                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
6773                         invoice_request_ref = tag_ptr(invoice_request_var.inner, false);
6774         return invoice_request_ref;
6775 }
6776 uint64_t __attribute__((export_name("TS_LDKOffersMessage_Invoice_get_invoice"))) TS_LDKOffersMessage_Invoice_get_invoice(uint64_t ptr) {
6777         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
6778         assert(obj->tag == LDKOffersMessage_Invoice);
6779                         LDKBolt12Invoice invoice_var = obj->invoice;
6780                         uint64_t invoice_ref = 0;
6781                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
6782                         invoice_ref = tag_ptr(invoice_var.inner, false);
6783         return invoice_ref;
6784 }
6785 uint64_t __attribute__((export_name("TS_LDKOffersMessage_InvoiceError_get_invoice_error"))) TS_LDKOffersMessage_InvoiceError_get_invoice_error(uint64_t ptr) {
6786         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
6787         assert(obj->tag == LDKOffersMessage_InvoiceError);
6788                         LDKInvoiceError invoice_error_var = obj->invoice_error;
6789                         uint64_t invoice_error_ref = 0;
6790                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_error_var);
6791                         invoice_error_ref = tag_ptr(invoice_error_var.inner, false);
6792         return invoice_error_ref;
6793 }
6794 uint32_t __attribute__((export_name("TS_LDKCOption_OffersMessageZ_ty_from_ptr"))) TS_LDKCOption_OffersMessageZ_ty_from_ptr(uint64_t ptr) {
6795         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
6796         switch(obj->tag) {
6797                 case LDKCOption_OffersMessageZ_Some: return 0;
6798                 case LDKCOption_OffersMessageZ_None: return 1;
6799                 default: abort();
6800         }
6801 }
6802 uint64_t __attribute__((export_name("TS_LDKCOption_OffersMessageZ_Some_get_some"))) TS_LDKCOption_OffersMessageZ_Some_get_some(uint64_t ptr) {
6803         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
6804         assert(obj->tag == LDKCOption_OffersMessageZ_Some);
6805                         uint64_t some_ref = tag_ptr(&obj->some, false);
6806         return some_ref;
6807 }
6808 typedef struct LDKCustomOnionMessageContents_JCalls {
6809         atomic_size_t refcnt;
6810         uint32_t instance_ptr;
6811 } LDKCustomOnionMessageContents_JCalls;
6812 static void LDKCustomOnionMessageContents_JCalls_free(void* this_arg) {
6813         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
6814         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6815                 FREE(j_calls);
6816         }
6817 }
6818 uint64_t tlv_type_LDKCustomOnionMessageContents_jcall(const void* this_arg) {
6819         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
6820         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 41, 0, 0, 0, 0, 0, 0);
6821 }
6822 LDKCVec_u8Z write_LDKCustomOnionMessageContents_jcall(const void* this_arg) {
6823         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
6824         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 42, 0, 0, 0, 0, 0, 0);
6825         LDKCVec_u8Z ret_ref;
6826         ret_ref.datalen = ret->arr_len;
6827         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
6828         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
6829         return ret_ref;
6830 }
6831 static void LDKCustomOnionMessageContents_JCalls_cloned(LDKCustomOnionMessageContents* new_obj) {
6832         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) new_obj->this_arg;
6833         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6834 }
6835 static inline LDKCustomOnionMessageContents LDKCustomOnionMessageContents_init (JSValue o) {
6836         LDKCustomOnionMessageContents_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageContents_JCalls), "LDKCustomOnionMessageContents_JCalls");
6837         atomic_init(&calls->refcnt, 1);
6838         calls->instance_ptr = o;
6839
6840         LDKCustomOnionMessageContents ret = {
6841                 .this_arg = (void*) calls,
6842                 .tlv_type = tlv_type_LDKCustomOnionMessageContents_jcall,
6843                 .write = write_LDKCustomOnionMessageContents_jcall,
6844                 .cloned = LDKCustomOnionMessageContents_JCalls_cloned,
6845                 .free = LDKCustomOnionMessageContents_JCalls_free,
6846         };
6847         return ret;
6848 }
6849 uint64_t  __attribute__((export_name("TS_LDKCustomOnionMessageContents_new"))) TS_LDKCustomOnionMessageContents_new(JSValue o) {
6850         LDKCustomOnionMessageContents *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
6851         *res_ptr = LDKCustomOnionMessageContents_init(o);
6852         return tag_ptr(res_ptr, true);
6853 }
6854 int64_t  __attribute__((export_name("TS_CustomOnionMessageContents_tlv_type"))) TS_CustomOnionMessageContents_tlv_type(uint64_t this_arg) {
6855         void* this_arg_ptr = untag_ptr(this_arg);
6856         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6857         LDKCustomOnionMessageContents* this_arg_conv = (LDKCustomOnionMessageContents*)this_arg_ptr;
6858         int64_t ret_conv = (this_arg_conv->tlv_type)(this_arg_conv->this_arg);
6859         return ret_conv;
6860 }
6861
6862 int8_tArray  __attribute__((export_name("TS_CustomOnionMessageContents_write"))) TS_CustomOnionMessageContents_write(uint64_t this_arg) {
6863         void* this_arg_ptr = untag_ptr(this_arg);
6864         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6865         LDKCustomOnionMessageContents* this_arg_conv = (LDKCustomOnionMessageContents*)this_arg_ptr;
6866         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
6867         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6868         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6869         CVec_u8Z_free(ret_var);
6870         return ret_arr;
6871 }
6872
6873 uint32_t __attribute__((export_name("TS_LDKCOption_CustomOnionMessageContentsZ_ty_from_ptr"))) TS_LDKCOption_CustomOnionMessageContentsZ_ty_from_ptr(uint64_t ptr) {
6874         LDKCOption_CustomOnionMessageContentsZ *obj = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(ptr);
6875         switch(obj->tag) {
6876                 case LDKCOption_CustomOnionMessageContentsZ_Some: return 0;
6877                 case LDKCOption_CustomOnionMessageContentsZ_None: return 1;
6878                 default: abort();
6879         }
6880 }
6881 uint64_t __attribute__((export_name("TS_LDKCOption_CustomOnionMessageContentsZ_Some_get_some"))) TS_LDKCOption_CustomOnionMessageContentsZ_Some_get_some(uint64_t ptr) {
6882         LDKCOption_CustomOnionMessageContentsZ *obj = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(ptr);
6883         assert(obj->tag == LDKCOption_CustomOnionMessageContentsZ_Some);
6884                         LDKCustomOnionMessageContents* some_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
6885                         *some_ret = CustomOnionMessageContents_clone(&obj->some);
6886         return tag_ptr(some_ret, true);
6887 }
6888 static inline struct LDKCOption_CustomOnionMessageContentsZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
6889 CHECK(owner->result_ok);
6890         return COption_CustomOnionMessageContentsZ_clone(&*owner->contents.result);
6891 }
6892 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(uint64_t owner) {
6893         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
6894         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
6895         *ret_copy = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(owner_conv);
6896         uint64_t ret_ref = tag_ptr(ret_copy, true);
6897         return ret_ref;
6898 }
6899
6900 static inline struct LDKDecodeError CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
6901 CHECK(!owner->result_ok);
6902         return DecodeError_clone(&*owner->contents.err);
6903 }
6904 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(uint64_t owner) {
6905         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
6906         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6907         *ret_copy = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(owner_conv);
6908         uint64_t ret_ref = tag_ptr(ret_copy, true);
6909         return ret_ref;
6910 }
6911
6912 uint32_t __attribute__((export_name("TS_LDKCOption_TypeZ_ty_from_ptr"))) TS_LDKCOption_TypeZ_ty_from_ptr(uint64_t ptr) {
6913         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
6914         switch(obj->tag) {
6915                 case LDKCOption_TypeZ_Some: return 0;
6916                 case LDKCOption_TypeZ_None: return 1;
6917                 default: abort();
6918         }
6919 }
6920 uint64_t __attribute__((export_name("TS_LDKCOption_TypeZ_Some_get_some"))) TS_LDKCOption_TypeZ_Some_get_some(uint64_t ptr) {
6921         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
6922         assert(obj->tag == LDKCOption_TypeZ_Some);
6923                         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
6924                         *some_ret = Type_clone(&obj->some);
6925         return tag_ptr(some_ret, true);
6926 }
6927 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
6928 CHECK(owner->result_ok);
6929         return COption_TypeZ_clone(&*owner->contents.result);
6930 }
6931 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_get_ok(uint64_t owner) {
6932         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
6933         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
6934         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
6935         uint64_t ret_ref = tag_ptr(ret_copy, true);
6936         return ret_ref;
6937 }
6938
6939 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
6940 CHECK(!owner->result_ok);
6941         return DecodeError_clone(&*owner->contents.err);
6942 }
6943 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_err"))) TS_CResult_COption_TypeZDecodeErrorZ_get_err(uint64_t owner) {
6944         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
6945         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6946         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
6947         uint64_t ret_ref = tag_ptr(ret_copy, true);
6948         return ret_ref;
6949 }
6950
6951 uint32_t __attribute__((export_name("TS_LDKCOption_SocketAddressZ_ty_from_ptr"))) TS_LDKCOption_SocketAddressZ_ty_from_ptr(uint64_t ptr) {
6952         LDKCOption_SocketAddressZ *obj = (LDKCOption_SocketAddressZ*)untag_ptr(ptr);
6953         switch(obj->tag) {
6954                 case LDKCOption_SocketAddressZ_Some: return 0;
6955                 case LDKCOption_SocketAddressZ_None: return 1;
6956                 default: abort();
6957         }
6958 }
6959 uint64_t __attribute__((export_name("TS_LDKCOption_SocketAddressZ_Some_get_some"))) TS_LDKCOption_SocketAddressZ_Some_get_some(uint64_t ptr) {
6960         LDKCOption_SocketAddressZ *obj = (LDKCOption_SocketAddressZ*)untag_ptr(ptr);
6961         assert(obj->tag == LDKCOption_SocketAddressZ_Some);
6962                         uint64_t some_ref = tag_ptr(&obj->some, false);
6963         return some_ref;
6964 }
6965 static inline struct LDKPublicKey C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR owner){
6966         return owner->a;
6967 }
6968 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a"))) TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a(uint64_t owner) {
6969         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(owner);
6970         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
6971         memcpy(ret_arr->elems, C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a(owner_conv).compressed_form, 33);
6972         return ret_arr;
6973 }
6974
6975 static inline struct LDKCOption_SocketAddressZ C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR owner){
6976         return COption_SocketAddressZ_clone(&owner->b);
6977 }
6978 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b"))) TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b(uint64_t owner) {
6979         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(owner);
6980         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
6981         *ret_copy = C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b(owner_conv);
6982         uint64_t ret_ref = tag_ptr(ret_copy, true);
6983         return ret_ref;
6984 }
6985
6986 static inline LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_clone(const LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ *orig) {
6987         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ clone bytes"), .datalen = orig->datalen };
6988         for (size_t i = 0; i < ret.datalen; i++) {
6989                 ret.data[i] = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(&orig->data[i]);
6990         }
6991         return ret;
6992 }
6993 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
6994 CHECK(owner->result_ok);
6995         return CVec_u8Z_clone(&*owner->contents.result);
6996 }
6997 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint64_t owner) {
6998         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
6999         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
7000         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7001         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7002         CVec_u8Z_free(ret_var);
7003         return ret_arr;
7004 }
7005
7006 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
7007         LDKPeerHandleError ret = *owner->contents.err;
7008         ret.is_owned = false;
7009         return ret;
7010 }
7011 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err(uint64_t owner) {
7012         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
7013         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
7014         uint64_t ret_ref = 0;
7015         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7016         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7017         return ret_ref;
7018 }
7019
7020 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
7021 CHECK(owner->result_ok);
7022         return *owner->contents.result;
7023 }
7024 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_ok"))) TS_CResult_NonePeerHandleErrorZ_get_ok(uint64_t owner) {
7025         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
7026         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
7027 }
7028
7029 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
7030         LDKPeerHandleError ret = *owner->contents.err;
7031         ret.is_owned = false;
7032         return ret;
7033 }
7034 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_err"))) TS_CResult_NonePeerHandleErrorZ_get_err(uint64_t owner) {
7035         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
7036         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
7037         uint64_t ret_ref = 0;
7038         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7039         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7040         return ret_ref;
7041 }
7042
7043 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
7044 CHECK(owner->result_ok);
7045         return *owner->contents.result;
7046 }
7047 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_ok"))) TS_CResult_boolPeerHandleErrorZ_get_ok(uint64_t owner) {
7048         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
7049         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
7050         return ret_conv;
7051 }
7052
7053 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
7054         LDKPeerHandleError ret = *owner->contents.err;
7055         ret.is_owned = false;
7056         return ret;
7057 }
7058 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_err"))) TS_CResult_boolPeerHandleErrorZ_get_err(uint64_t owner) {
7059         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
7060         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
7061         uint64_t ret_ref = 0;
7062         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7063         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7064         return ret_ref;
7065 }
7066
7067 uint32_t __attribute__((export_name("TS_LDKGraphSyncError_ty_from_ptr"))) TS_LDKGraphSyncError_ty_from_ptr(uint64_t ptr) {
7068         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
7069         switch(obj->tag) {
7070                 case LDKGraphSyncError_DecodeError: return 0;
7071                 case LDKGraphSyncError_LightningError: return 1;
7072                 default: abort();
7073         }
7074 }
7075 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_DecodeError_get_decode_error"))) TS_LDKGraphSyncError_DecodeError_get_decode_error(uint64_t ptr) {
7076         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
7077         assert(obj->tag == LDKGraphSyncError_DecodeError);
7078                         uint64_t decode_error_ref = tag_ptr(&obj->decode_error, false);
7079         return decode_error_ref;
7080 }
7081 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_LightningError_get_lightning_error"))) TS_LDKGraphSyncError_LightningError_get_lightning_error(uint64_t ptr) {
7082         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
7083         assert(obj->tag == LDKGraphSyncError_LightningError);
7084                         LDKLightningError lightning_error_var = obj->lightning_error;
7085                         uint64_t lightning_error_ref = 0;
7086                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
7087                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
7088         return lightning_error_ref;
7089 }
7090 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
7091 CHECK(owner->result_ok);
7092         return *owner->contents.result;
7093 }
7094 int32_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_ok"))) TS_CResult_u32GraphSyncErrorZ_get_ok(uint64_t owner) {
7095         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
7096         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
7097         return ret_conv;
7098 }
7099
7100 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
7101 CHECK(!owner->result_ok);
7102         return GraphSyncError_clone(&*owner->contents.err);
7103 }
7104 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_err"))) TS_CResult_u32GraphSyncErrorZ_get_err(uint64_t owner) {
7105         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
7106         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
7107         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
7108         uint64_t ret_ref = tag_ptr(ret_copy, true);
7109         return ret_ref;
7110 }
7111
7112 static inline struct LDKCVec_u8Z CResult_CVec_u8ZIOErrorZ_get_ok(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
7113 CHECK(owner->result_ok);
7114         return CVec_u8Z_clone(&*owner->contents.result);
7115 }
7116 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_get_ok"))) TS_CResult_CVec_u8ZIOErrorZ_get_ok(uint64_t owner) {
7117         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
7118         LDKCVec_u8Z ret_var = CResult_CVec_u8ZIOErrorZ_get_ok(owner_conv);
7119         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7120         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7121         CVec_u8Z_free(ret_var);
7122         return ret_arr;
7123 }
7124
7125 static inline enum LDKIOError CResult_CVec_u8ZIOErrorZ_get_err(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
7126 CHECK(!owner->result_ok);
7127         return *owner->contents.err;
7128 }
7129 uint32_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_get_err"))) TS_CResult_CVec_u8ZIOErrorZ_get_err(uint64_t owner) {
7130         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
7131         uint32_t ret_conv = LDKIOError_to_js(CResult_CVec_u8ZIOErrorZ_get_err(owner_conv));
7132         return ret_conv;
7133 }
7134
7135 static inline void CResult_NoneIOErrorZ_get_ok(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
7136 CHECK(owner->result_ok);
7137         return *owner->contents.result;
7138 }
7139 void  __attribute__((export_name("TS_CResult_NoneIOErrorZ_get_ok"))) TS_CResult_NoneIOErrorZ_get_ok(uint64_t owner) {
7140         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
7141         CResult_NoneIOErrorZ_get_ok(owner_conv);
7142 }
7143
7144 static inline enum LDKIOError CResult_NoneIOErrorZ_get_err(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
7145 CHECK(!owner->result_ok);
7146         return *owner->contents.err;
7147 }
7148 uint32_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_get_err"))) TS_CResult_NoneIOErrorZ_get_err(uint64_t owner) {
7149         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
7150         uint32_t ret_conv = LDKIOError_to_js(CResult_NoneIOErrorZ_get_err(owner_conv));
7151         return ret_conv;
7152 }
7153
7154 static inline struct LDKCVec_StrZ CResult_CVec_StrZIOErrorZ_get_ok(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
7155 CHECK(owner->result_ok);
7156         return *owner->contents.result;
7157 }
7158 ptrArray  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_get_ok"))) TS_CResult_CVec_StrZIOErrorZ_get_ok(uint64_t owner) {
7159         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
7160         LDKCVec_StrZ ret_var = CResult_CVec_StrZIOErrorZ_get_ok(owner_conv);
7161         ptrArray ret_arr = NULL;
7162         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
7163         jstring *ret_arr_ptr = (jstring*)(((uint8_t*)ret_arr) + 8);
7164         for (size_t i = 0; i < ret_var.datalen; i++) {
7165                 LDKStr ret_conv_8_str = ret_var.data[i];
7166                 jstring ret_conv_8_conv = str_ref_to_ts(ret_conv_8_str.chars, ret_conv_8_str.len);
7167                 ret_arr_ptr[i] = ret_conv_8_conv;
7168         }
7169         
7170         return ret_arr;
7171 }
7172
7173 static inline enum LDKIOError CResult_CVec_StrZIOErrorZ_get_err(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
7174 CHECK(!owner->result_ok);
7175         return *owner->contents.err;
7176 }
7177 uint32_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_get_err"))) TS_CResult_CVec_StrZIOErrorZ_get_err(uint64_t owner) {
7178         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
7179         uint32_t ret_conv = LDKIOError_to_js(CResult_CVec_StrZIOErrorZ_get_err(owner_conv));
7180         return ret_conv;
7181 }
7182
7183 static inline LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ *orig) {
7184         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
7185         for (size_t i = 0; i < ret.datalen; i++) {
7186                 ret.data[i] = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&orig->data[i]);
7187         }
7188         return ret;
7189 }
7190 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
7191 CHECK(owner->result_ok);
7192         return CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(&*owner->contents.result);
7193 }
7194 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(uint64_t owner) {
7195         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
7196         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(owner_conv);
7197         uint64_tArray ret_arr = NULL;
7198         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
7199         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
7200         for (size_t o = 0; o < ret_var.datalen; o++) {
7201                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
7202                 *ret_conv_40_conv = ret_var.data[o];
7203                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
7204         }
7205         
7206         FREE(ret_var.data);
7207         return ret_arr;
7208 }
7209
7210 static inline enum LDKIOError CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
7211 CHECK(!owner->result_ok);
7212         return *owner->contents.err;
7213 }
7214 uint32_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(uint64_t owner) {
7215         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
7216         uint32_t ret_conv = LDKIOError_to_js(CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(owner_conv));
7217         return ret_conv;
7218 }
7219
7220 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
7221 CHECK(owner->result_ok);
7222         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
7223 }
7224 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(uint64_t owner) {
7225         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
7226         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
7227         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(owner_conv);
7228         return tag_ptr(ret_conv, true);
7229 }
7230
7231 static inline enum LDKIOError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
7232 CHECK(!owner->result_ok);
7233         return *owner->contents.err;
7234 }
7235 uint32_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(uint64_t owner) {
7236         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
7237         uint32_t ret_conv = LDKIOError_to_js(CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(owner_conv));
7238         return ret_conv;
7239 }
7240
7241 uint32_t __attribute__((export_name("TS_LDKCOption_SecretKeyZ_ty_from_ptr"))) TS_LDKCOption_SecretKeyZ_ty_from_ptr(uint64_t ptr) {
7242         LDKCOption_SecretKeyZ *obj = (LDKCOption_SecretKeyZ*)untag_ptr(ptr);
7243         switch(obj->tag) {
7244                 case LDKCOption_SecretKeyZ_Some: return 0;
7245                 case LDKCOption_SecretKeyZ_None: return 1;
7246                 default: abort();
7247         }
7248 }
7249 int8_tArray __attribute__((export_name("TS_LDKCOption_SecretKeyZ_Some_get_some"))) TS_LDKCOption_SecretKeyZ_Some_get_some(uint64_t ptr) {
7250         LDKCOption_SecretKeyZ *obj = (LDKCOption_SecretKeyZ*)untag_ptr(ptr);
7251         assert(obj->tag == LDKCOption_SecretKeyZ_Some);
7252                         int8_tArray some_arr = init_int8_tArray(32, __LINE__);
7253                         memcpy(some_arr->elems, obj->some.bytes, 32);
7254         return some_arr;
7255 }
7256 static inline struct LDKVerifiedInvoiceRequest CResult_VerifiedInvoiceRequestNoneZ_get_ok(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
7257         LDKVerifiedInvoiceRequest ret = *owner->contents.result;
7258         ret.is_owned = false;
7259         return ret;
7260 }
7261 uint64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_get_ok"))) TS_CResult_VerifiedInvoiceRequestNoneZ_get_ok(uint64_t owner) {
7262         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
7263         LDKVerifiedInvoiceRequest ret_var = CResult_VerifiedInvoiceRequestNoneZ_get_ok(owner_conv);
7264         uint64_t ret_ref = 0;
7265         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7266         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7267         return ret_ref;
7268 }
7269
7270 static inline void CResult_VerifiedInvoiceRequestNoneZ_get_err(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
7271 CHECK(!owner->result_ok);
7272         return *owner->contents.err;
7273 }
7274 void  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_get_err"))) TS_CResult_VerifiedInvoiceRequestNoneZ_get_err(uint64_t owner) {
7275         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
7276         CResult_VerifiedInvoiceRequestNoneZ_get_err(owner_conv);
7277 }
7278
7279 static inline LDKCVec_WitnessZ CVec_WitnessZ_clone(const LDKCVec_WitnessZ *orig) {
7280         LDKCVec_WitnessZ ret = { .data = MALLOC(sizeof(LDKWitness) * orig->datalen, "LDKCVec_WitnessZ clone bytes"), .datalen = orig->datalen };
7281         for (size_t i = 0; i < ret.datalen; i++) {
7282                 ret.data[i] = Witness_clone(&orig->data[i]);
7283         }
7284         return ret;
7285 }
7286 uint32_t __attribute__((export_name("TS_LDKCOption_i64Z_ty_from_ptr"))) TS_LDKCOption_i64Z_ty_from_ptr(uint64_t ptr) {
7287         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
7288         switch(obj->tag) {
7289                 case LDKCOption_i64Z_Some: return 0;
7290                 case LDKCOption_i64Z_None: return 1;
7291                 default: abort();
7292         }
7293 }
7294 int64_t __attribute__((export_name("TS_LDKCOption_i64Z_Some_get_some"))) TS_LDKCOption_i64Z_Some_get_some(uint64_t ptr) {
7295         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
7296         assert(obj->tag == LDKCOption_i64Z_Some);
7297                         int64_t some_conv = obj->some;
7298         return some_conv;
7299 }
7300 static inline struct LDKSocketAddress CResult_SocketAddressDecodeErrorZ_get_ok(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
7301 CHECK(owner->result_ok);
7302         return SocketAddress_clone(&*owner->contents.result);
7303 }
7304 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_get_ok"))) TS_CResult_SocketAddressDecodeErrorZ_get_ok(uint64_t owner) {
7305         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
7306         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
7307         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_ok(owner_conv);
7308         uint64_t ret_ref = tag_ptr(ret_copy, true);
7309         return ret_ref;
7310 }
7311
7312 static inline struct LDKDecodeError CResult_SocketAddressDecodeErrorZ_get_err(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
7313 CHECK(!owner->result_ok);
7314         return DecodeError_clone(&*owner->contents.err);
7315 }
7316 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_get_err"))) TS_CResult_SocketAddressDecodeErrorZ_get_err(uint64_t owner) {
7317         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
7318         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7319         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_err(owner_conv);
7320         uint64_t ret_ref = tag_ptr(ret_copy, true);
7321         return ret_ref;
7322 }
7323
7324 static inline struct LDKSocketAddress CResult_SocketAddressSocketAddressParseErrorZ_get_ok(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
7325 CHECK(owner->result_ok);
7326         return SocketAddress_clone(&*owner->contents.result);
7327 }
7328 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_get_ok"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_get_ok(uint64_t owner) {
7329         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
7330         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
7331         *ret_copy = CResult_SocketAddressSocketAddressParseErrorZ_get_ok(owner_conv);
7332         uint64_t ret_ref = tag_ptr(ret_copy, true);
7333         return ret_ref;
7334 }
7335
7336 static inline enum LDKSocketAddressParseError CResult_SocketAddressSocketAddressParseErrorZ_get_err(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
7337 CHECK(!owner->result_ok);
7338         return SocketAddressParseError_clone(&*owner->contents.err);
7339 }
7340 uint32_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_get_err"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_get_err(uint64_t owner) {
7341         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
7342         uint32_t ret_conv = LDKSocketAddressParseError_to_js(CResult_SocketAddressSocketAddressParseErrorZ_get_err(owner_conv));
7343         return ret_conv;
7344 }
7345
7346 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
7347         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
7348         for (size_t i = 0; i < ret.datalen; i++) {
7349                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
7350         }
7351         return ret;
7352 }
7353 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
7354         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
7355         for (size_t i = 0; i < ret.datalen; i++) {
7356                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
7357         }
7358         return ret;
7359 }
7360 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
7361         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
7362         for (size_t i = 0; i < ret.datalen; i++) {
7363                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
7364         }
7365         return ret;
7366 }
7367 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
7368         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
7369         for (size_t i = 0; i < ret.datalen; i++) {
7370                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
7371         }
7372         return ret;
7373 }
7374 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
7375         LDKAcceptChannel ret = *owner->contents.result;
7376         ret.is_owned = false;
7377         return ret;
7378 }
7379 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_get_ok(uint64_t owner) {
7380         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
7381         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
7382         uint64_t ret_ref = 0;
7383         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7384         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7385         return ret_ref;
7386 }
7387
7388 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
7389 CHECK(!owner->result_ok);
7390         return DecodeError_clone(&*owner->contents.err);
7391 }
7392 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_err"))) TS_CResult_AcceptChannelDecodeErrorZ_get_err(uint64_t owner) {
7393         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
7394         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7395         *ret_copy = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
7396         uint64_t ret_ref = tag_ptr(ret_copy, true);
7397         return ret_ref;
7398 }
7399
7400 static inline struct LDKAcceptChannelV2 CResult_AcceptChannelV2DecodeErrorZ_get_ok(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
7401         LDKAcceptChannelV2 ret = *owner->contents.result;
7402         ret.is_owned = false;
7403         return ret;
7404 }
7405 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelV2DecodeErrorZ_get_ok(uint64_t owner) {
7406         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
7407         LDKAcceptChannelV2 ret_var = CResult_AcceptChannelV2DecodeErrorZ_get_ok(owner_conv);
7408         uint64_t ret_ref = 0;
7409         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7410         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7411         return ret_ref;
7412 }
7413
7414 static inline struct LDKDecodeError CResult_AcceptChannelV2DecodeErrorZ_get_err(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
7415 CHECK(!owner->result_ok);
7416         return DecodeError_clone(&*owner->contents.err);
7417 }
7418 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_get_err"))) TS_CResult_AcceptChannelV2DecodeErrorZ_get_err(uint64_t owner) {
7419         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
7420         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7421         *ret_copy = CResult_AcceptChannelV2DecodeErrorZ_get_err(owner_conv);
7422         uint64_t ret_ref = tag_ptr(ret_copy, true);
7423         return ret_ref;
7424 }
7425
7426 static inline struct LDKTxAddInput CResult_TxAddInputDecodeErrorZ_get_ok(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
7427         LDKTxAddInput ret = *owner->contents.result;
7428         ret.is_owned = false;
7429         return ret;
7430 }
7431 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_get_ok"))) TS_CResult_TxAddInputDecodeErrorZ_get_ok(uint64_t owner) {
7432         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
7433         LDKTxAddInput ret_var = CResult_TxAddInputDecodeErrorZ_get_ok(owner_conv);
7434         uint64_t ret_ref = 0;
7435         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7436         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7437         return ret_ref;
7438 }
7439
7440 static inline struct LDKDecodeError CResult_TxAddInputDecodeErrorZ_get_err(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
7441 CHECK(!owner->result_ok);
7442         return DecodeError_clone(&*owner->contents.err);
7443 }
7444 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_get_err"))) TS_CResult_TxAddInputDecodeErrorZ_get_err(uint64_t owner) {
7445         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
7446         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7447         *ret_copy = CResult_TxAddInputDecodeErrorZ_get_err(owner_conv);
7448         uint64_t ret_ref = tag_ptr(ret_copy, true);
7449         return ret_ref;
7450 }
7451
7452 static inline struct LDKTxAddOutput CResult_TxAddOutputDecodeErrorZ_get_ok(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
7453         LDKTxAddOutput ret = *owner->contents.result;
7454         ret.is_owned = false;
7455         return ret;
7456 }
7457 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_get_ok"))) TS_CResult_TxAddOutputDecodeErrorZ_get_ok(uint64_t owner) {
7458         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
7459         LDKTxAddOutput ret_var = CResult_TxAddOutputDecodeErrorZ_get_ok(owner_conv);
7460         uint64_t ret_ref = 0;
7461         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7462         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7463         return ret_ref;
7464 }
7465
7466 static inline struct LDKDecodeError CResult_TxAddOutputDecodeErrorZ_get_err(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
7467 CHECK(!owner->result_ok);
7468         return DecodeError_clone(&*owner->contents.err);
7469 }
7470 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_get_err"))) TS_CResult_TxAddOutputDecodeErrorZ_get_err(uint64_t owner) {
7471         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
7472         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7473         *ret_copy = CResult_TxAddOutputDecodeErrorZ_get_err(owner_conv);
7474         uint64_t ret_ref = tag_ptr(ret_copy, true);
7475         return ret_ref;
7476 }
7477
7478 static inline struct LDKTxRemoveInput CResult_TxRemoveInputDecodeErrorZ_get_ok(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
7479         LDKTxRemoveInput ret = *owner->contents.result;
7480         ret.is_owned = false;
7481         return ret;
7482 }
7483 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_get_ok"))) TS_CResult_TxRemoveInputDecodeErrorZ_get_ok(uint64_t owner) {
7484         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
7485         LDKTxRemoveInput ret_var = CResult_TxRemoveInputDecodeErrorZ_get_ok(owner_conv);
7486         uint64_t ret_ref = 0;
7487         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7488         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7489         return ret_ref;
7490 }
7491
7492 static inline struct LDKDecodeError CResult_TxRemoveInputDecodeErrorZ_get_err(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
7493 CHECK(!owner->result_ok);
7494         return DecodeError_clone(&*owner->contents.err);
7495 }
7496 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_get_err"))) TS_CResult_TxRemoveInputDecodeErrorZ_get_err(uint64_t owner) {
7497         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
7498         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7499         *ret_copy = CResult_TxRemoveInputDecodeErrorZ_get_err(owner_conv);
7500         uint64_t ret_ref = tag_ptr(ret_copy, true);
7501         return ret_ref;
7502 }
7503
7504 static inline struct LDKTxRemoveOutput CResult_TxRemoveOutputDecodeErrorZ_get_ok(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
7505         LDKTxRemoveOutput ret = *owner->contents.result;
7506         ret.is_owned = false;
7507         return ret;
7508 }
7509 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_get_ok"))) TS_CResult_TxRemoveOutputDecodeErrorZ_get_ok(uint64_t owner) {
7510         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
7511         LDKTxRemoveOutput ret_var = CResult_TxRemoveOutputDecodeErrorZ_get_ok(owner_conv);
7512         uint64_t ret_ref = 0;
7513         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7514         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7515         return ret_ref;
7516 }
7517
7518 static inline struct LDKDecodeError CResult_TxRemoveOutputDecodeErrorZ_get_err(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
7519 CHECK(!owner->result_ok);
7520         return DecodeError_clone(&*owner->contents.err);
7521 }
7522 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_get_err"))) TS_CResult_TxRemoveOutputDecodeErrorZ_get_err(uint64_t owner) {
7523         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
7524         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7525         *ret_copy = CResult_TxRemoveOutputDecodeErrorZ_get_err(owner_conv);
7526         uint64_t ret_ref = tag_ptr(ret_copy, true);
7527         return ret_ref;
7528 }
7529
7530 static inline struct LDKTxComplete CResult_TxCompleteDecodeErrorZ_get_ok(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
7531         LDKTxComplete ret = *owner->contents.result;
7532         ret.is_owned = false;
7533         return ret;
7534 }
7535 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_get_ok"))) TS_CResult_TxCompleteDecodeErrorZ_get_ok(uint64_t owner) {
7536         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
7537         LDKTxComplete ret_var = CResult_TxCompleteDecodeErrorZ_get_ok(owner_conv);
7538         uint64_t ret_ref = 0;
7539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7541         return ret_ref;
7542 }
7543
7544 static inline struct LDKDecodeError CResult_TxCompleteDecodeErrorZ_get_err(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
7545 CHECK(!owner->result_ok);
7546         return DecodeError_clone(&*owner->contents.err);
7547 }
7548 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_get_err"))) TS_CResult_TxCompleteDecodeErrorZ_get_err(uint64_t owner) {
7549         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
7550         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7551         *ret_copy = CResult_TxCompleteDecodeErrorZ_get_err(owner_conv);
7552         uint64_t ret_ref = tag_ptr(ret_copy, true);
7553         return ret_ref;
7554 }
7555
7556 static inline struct LDKTxSignatures CResult_TxSignaturesDecodeErrorZ_get_ok(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
7557         LDKTxSignatures ret = *owner->contents.result;
7558         ret.is_owned = false;
7559         return ret;
7560 }
7561 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_get_ok"))) TS_CResult_TxSignaturesDecodeErrorZ_get_ok(uint64_t owner) {
7562         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
7563         LDKTxSignatures ret_var = CResult_TxSignaturesDecodeErrorZ_get_ok(owner_conv);
7564         uint64_t ret_ref = 0;
7565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7567         return ret_ref;
7568 }
7569
7570 static inline struct LDKDecodeError CResult_TxSignaturesDecodeErrorZ_get_err(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
7571 CHECK(!owner->result_ok);
7572         return DecodeError_clone(&*owner->contents.err);
7573 }
7574 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_get_err"))) TS_CResult_TxSignaturesDecodeErrorZ_get_err(uint64_t owner) {
7575         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
7576         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7577         *ret_copy = CResult_TxSignaturesDecodeErrorZ_get_err(owner_conv);
7578         uint64_t ret_ref = tag_ptr(ret_copy, true);
7579         return ret_ref;
7580 }
7581
7582 static inline struct LDKTxInitRbf CResult_TxInitRbfDecodeErrorZ_get_ok(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
7583         LDKTxInitRbf ret = *owner->contents.result;
7584         ret.is_owned = false;
7585         return ret;
7586 }
7587 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_get_ok"))) TS_CResult_TxInitRbfDecodeErrorZ_get_ok(uint64_t owner) {
7588         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
7589         LDKTxInitRbf ret_var = CResult_TxInitRbfDecodeErrorZ_get_ok(owner_conv);
7590         uint64_t ret_ref = 0;
7591         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7592         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7593         return ret_ref;
7594 }
7595
7596 static inline struct LDKDecodeError CResult_TxInitRbfDecodeErrorZ_get_err(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
7597 CHECK(!owner->result_ok);
7598         return DecodeError_clone(&*owner->contents.err);
7599 }
7600 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_get_err"))) TS_CResult_TxInitRbfDecodeErrorZ_get_err(uint64_t owner) {
7601         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
7602         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7603         *ret_copy = CResult_TxInitRbfDecodeErrorZ_get_err(owner_conv);
7604         uint64_t ret_ref = tag_ptr(ret_copy, true);
7605         return ret_ref;
7606 }
7607
7608 static inline struct LDKTxAckRbf CResult_TxAckRbfDecodeErrorZ_get_ok(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
7609         LDKTxAckRbf ret = *owner->contents.result;
7610         ret.is_owned = false;
7611         return ret;
7612 }
7613 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_get_ok"))) TS_CResult_TxAckRbfDecodeErrorZ_get_ok(uint64_t owner) {
7614         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
7615         LDKTxAckRbf ret_var = CResult_TxAckRbfDecodeErrorZ_get_ok(owner_conv);
7616         uint64_t ret_ref = 0;
7617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7619         return ret_ref;
7620 }
7621
7622 static inline struct LDKDecodeError CResult_TxAckRbfDecodeErrorZ_get_err(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
7623 CHECK(!owner->result_ok);
7624         return DecodeError_clone(&*owner->contents.err);
7625 }
7626 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_get_err"))) TS_CResult_TxAckRbfDecodeErrorZ_get_err(uint64_t owner) {
7627         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
7628         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7629         *ret_copy = CResult_TxAckRbfDecodeErrorZ_get_err(owner_conv);
7630         uint64_t ret_ref = tag_ptr(ret_copy, true);
7631         return ret_ref;
7632 }
7633
7634 static inline struct LDKTxAbort CResult_TxAbortDecodeErrorZ_get_ok(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
7635         LDKTxAbort ret = *owner->contents.result;
7636         ret.is_owned = false;
7637         return ret;
7638 }
7639 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_get_ok"))) TS_CResult_TxAbortDecodeErrorZ_get_ok(uint64_t owner) {
7640         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
7641         LDKTxAbort ret_var = CResult_TxAbortDecodeErrorZ_get_ok(owner_conv);
7642         uint64_t ret_ref = 0;
7643         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7644         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7645         return ret_ref;
7646 }
7647
7648 static inline struct LDKDecodeError CResult_TxAbortDecodeErrorZ_get_err(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
7649 CHECK(!owner->result_ok);
7650         return DecodeError_clone(&*owner->contents.err);
7651 }
7652 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_get_err"))) TS_CResult_TxAbortDecodeErrorZ_get_err(uint64_t owner) {
7653         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
7654         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7655         *ret_copy = CResult_TxAbortDecodeErrorZ_get_err(owner_conv);
7656         uint64_t ret_ref = tag_ptr(ret_copy, true);
7657         return ret_ref;
7658 }
7659
7660 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
7661         LDKAnnouncementSignatures ret = *owner->contents.result;
7662         ret.is_owned = false;
7663         return ret;
7664 }
7665 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint64_t owner) {
7666         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
7667         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
7668         uint64_t ret_ref = 0;
7669         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7670         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7671         return ret_ref;
7672 }
7673
7674 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
7675 CHECK(!owner->result_ok);
7676         return DecodeError_clone(&*owner->contents.err);
7677 }
7678 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint64_t owner) {
7679         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
7680         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7681         *ret_copy = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
7682         uint64_t ret_ref = tag_ptr(ret_copy, true);
7683         return ret_ref;
7684 }
7685
7686 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
7687         LDKChannelReestablish ret = *owner->contents.result;
7688         ret.is_owned = false;
7689         return ret;
7690 }
7691 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_ok(uint64_t owner) {
7692         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
7693         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
7694         uint64_t ret_ref = 0;
7695         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7696         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7697         return ret_ref;
7698 }
7699
7700 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
7701 CHECK(!owner->result_ok);
7702         return DecodeError_clone(&*owner->contents.err);
7703 }
7704 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_err(uint64_t owner) {
7705         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
7706         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7707         *ret_copy = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
7708         uint64_t ret_ref = tag_ptr(ret_copy, true);
7709         return ret_ref;
7710 }
7711
7712 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
7713         LDKClosingSigned ret = *owner->contents.result;
7714         ret.is_owned = false;
7715         return ret;
7716 }
7717 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_get_ok(uint64_t owner) {
7718         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
7719         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
7720         uint64_t ret_ref = 0;
7721         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7722         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7723         return ret_ref;
7724 }
7725
7726 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
7727 CHECK(!owner->result_ok);
7728         return DecodeError_clone(&*owner->contents.err);
7729 }
7730 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedDecodeErrorZ_get_err(uint64_t owner) {
7731         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
7732         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7733         *ret_copy = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
7734         uint64_t ret_ref = tag_ptr(ret_copy, true);
7735         return ret_ref;
7736 }
7737
7738 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
7739         LDKClosingSignedFeeRange ret = *owner->contents.result;
7740         ret.is_owned = false;
7741         return ret;
7742 }
7743 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint64_t owner) {
7744         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
7745         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
7746         uint64_t ret_ref = 0;
7747         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7748         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7749         return ret_ref;
7750 }
7751
7752 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
7753 CHECK(!owner->result_ok);
7754         return DecodeError_clone(&*owner->contents.err);
7755 }
7756 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint64_t owner) {
7757         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
7758         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7759         *ret_copy = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
7760         uint64_t ret_ref = tag_ptr(ret_copy, true);
7761         return ret_ref;
7762 }
7763
7764 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
7765         LDKCommitmentSigned ret = *owner->contents.result;
7766         ret.is_owned = false;
7767         return ret;
7768 }
7769 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_ok(uint64_t owner) {
7770         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
7771         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
7772         uint64_t ret_ref = 0;
7773         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7774         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7775         return ret_ref;
7776 }
7777
7778 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
7779 CHECK(!owner->result_ok);
7780         return DecodeError_clone(&*owner->contents.err);
7781 }
7782 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_err(uint64_t owner) {
7783         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
7784         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7785         *ret_copy = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
7786         uint64_t ret_ref = tag_ptr(ret_copy, true);
7787         return ret_ref;
7788 }
7789
7790 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
7791         LDKFundingCreated ret = *owner->contents.result;
7792         ret.is_owned = false;
7793         return ret;
7794 }
7795 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_get_ok(uint64_t owner) {
7796         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
7797         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
7798         uint64_t ret_ref = 0;
7799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7801         return ret_ref;
7802 }
7803
7804 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
7805 CHECK(!owner->result_ok);
7806         return DecodeError_clone(&*owner->contents.err);
7807 }
7808 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_err"))) TS_CResult_FundingCreatedDecodeErrorZ_get_err(uint64_t owner) {
7809         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
7810         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7811         *ret_copy = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
7812         uint64_t ret_ref = tag_ptr(ret_copy, true);
7813         return ret_ref;
7814 }
7815
7816 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
7817         LDKFundingSigned ret = *owner->contents.result;
7818         ret.is_owned = false;
7819         return ret;
7820 }
7821 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_ok"))) TS_CResult_FundingSignedDecodeErrorZ_get_ok(uint64_t owner) {
7822         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
7823         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
7824         uint64_t ret_ref = 0;
7825         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7826         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7827         return ret_ref;
7828 }
7829
7830 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
7831 CHECK(!owner->result_ok);
7832         return DecodeError_clone(&*owner->contents.err);
7833 }
7834 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_err"))) TS_CResult_FundingSignedDecodeErrorZ_get_err(uint64_t owner) {
7835         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
7836         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7837         *ret_copy = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
7838         uint64_t ret_ref = tag_ptr(ret_copy, true);
7839         return ret_ref;
7840 }
7841
7842 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
7843         LDKChannelReady ret = *owner->contents.result;
7844         ret.is_owned = false;
7845         return ret;
7846 }
7847 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_get_ok(uint64_t owner) {
7848         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
7849         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
7850         uint64_t ret_ref = 0;
7851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7853         return ret_ref;
7854 }
7855
7856 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
7857 CHECK(!owner->result_ok);
7858         return DecodeError_clone(&*owner->contents.err);
7859 }
7860 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_err"))) TS_CResult_ChannelReadyDecodeErrorZ_get_err(uint64_t owner) {
7861         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
7862         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7863         *ret_copy = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
7864         uint64_t ret_ref = tag_ptr(ret_copy, true);
7865         return ret_ref;
7866 }
7867
7868 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
7869         LDKInit ret = *owner->contents.result;
7870         ret.is_owned = false;
7871         return ret;
7872 }
7873 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_ok"))) TS_CResult_InitDecodeErrorZ_get_ok(uint64_t owner) {
7874         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
7875         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
7876         uint64_t ret_ref = 0;
7877         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7878         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7879         return ret_ref;
7880 }
7881
7882 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
7883 CHECK(!owner->result_ok);
7884         return DecodeError_clone(&*owner->contents.err);
7885 }
7886 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_err"))) TS_CResult_InitDecodeErrorZ_get_err(uint64_t owner) {
7887         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
7888         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7889         *ret_copy = CResult_InitDecodeErrorZ_get_err(owner_conv);
7890         uint64_t ret_ref = tag_ptr(ret_copy, true);
7891         return ret_ref;
7892 }
7893
7894 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
7895         LDKOpenChannel ret = *owner->contents.result;
7896         ret.is_owned = false;
7897         return ret;
7898 }
7899 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_ok"))) TS_CResult_OpenChannelDecodeErrorZ_get_ok(uint64_t owner) {
7900         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
7901         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
7902         uint64_t ret_ref = 0;
7903         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7904         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7905         return ret_ref;
7906 }
7907
7908 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
7909 CHECK(!owner->result_ok);
7910         return DecodeError_clone(&*owner->contents.err);
7911 }
7912 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_err"))) TS_CResult_OpenChannelDecodeErrorZ_get_err(uint64_t owner) {
7913         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
7914         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7915         *ret_copy = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
7916         uint64_t ret_ref = tag_ptr(ret_copy, true);
7917         return ret_ref;
7918 }
7919
7920 static inline struct LDKOpenChannelV2 CResult_OpenChannelV2DecodeErrorZ_get_ok(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
7921         LDKOpenChannelV2 ret = *owner->contents.result;
7922         ret.is_owned = false;
7923         return ret;
7924 }
7925 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_get_ok"))) TS_CResult_OpenChannelV2DecodeErrorZ_get_ok(uint64_t owner) {
7926         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
7927         LDKOpenChannelV2 ret_var = CResult_OpenChannelV2DecodeErrorZ_get_ok(owner_conv);
7928         uint64_t ret_ref = 0;
7929         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7930         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7931         return ret_ref;
7932 }
7933
7934 static inline struct LDKDecodeError CResult_OpenChannelV2DecodeErrorZ_get_err(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
7935 CHECK(!owner->result_ok);
7936         return DecodeError_clone(&*owner->contents.err);
7937 }
7938 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_get_err"))) TS_CResult_OpenChannelV2DecodeErrorZ_get_err(uint64_t owner) {
7939         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
7940         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7941         *ret_copy = CResult_OpenChannelV2DecodeErrorZ_get_err(owner_conv);
7942         uint64_t ret_ref = tag_ptr(ret_copy, true);
7943         return ret_ref;
7944 }
7945
7946 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
7947         LDKRevokeAndACK ret = *owner->contents.result;
7948         ret.is_owned = false;
7949         return ret;
7950 }
7951 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_ok(uint64_t owner) {
7952         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
7953         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
7954         uint64_t ret_ref = 0;
7955         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7956         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7957         return ret_ref;
7958 }
7959
7960 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
7961 CHECK(!owner->result_ok);
7962         return DecodeError_clone(&*owner->contents.err);
7963 }
7964 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_err(uint64_t owner) {
7965         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
7966         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7967         *ret_copy = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
7968         uint64_t ret_ref = tag_ptr(ret_copy, true);
7969         return ret_ref;
7970 }
7971
7972 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
7973         LDKShutdown ret = *owner->contents.result;
7974         ret.is_owned = false;
7975         return ret;
7976 }
7977 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_ok"))) TS_CResult_ShutdownDecodeErrorZ_get_ok(uint64_t owner) {
7978         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
7979         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
7980         uint64_t ret_ref = 0;
7981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7983         return ret_ref;
7984 }
7985
7986 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
7987 CHECK(!owner->result_ok);
7988         return DecodeError_clone(&*owner->contents.err);
7989 }
7990 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_err"))) TS_CResult_ShutdownDecodeErrorZ_get_err(uint64_t owner) {
7991         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
7992         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7993         *ret_copy = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
7994         uint64_t ret_ref = tag_ptr(ret_copy, true);
7995         return ret_ref;
7996 }
7997
7998 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
7999         LDKUpdateFailHTLC ret = *owner->contents.result;
8000         ret.is_owned = false;
8001         return ret;
8002 }
8003 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint64_t owner) {
8004         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
8005         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
8006         uint64_t ret_ref = 0;
8007         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8008         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8009         return ret_ref;
8010 }
8011
8012 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
8013 CHECK(!owner->result_ok);
8014         return DecodeError_clone(&*owner->contents.err);
8015 }
8016 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err(uint64_t owner) {
8017         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
8018         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8019         *ret_copy = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
8020         uint64_t ret_ref = tag_ptr(ret_copy, true);
8021         return ret_ref;
8022 }
8023
8024 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
8025         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
8026         ret.is_owned = false;
8027         return ret;
8028 }
8029 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint64_t owner) {
8030         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
8031         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
8032         uint64_t ret_ref = 0;
8033         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8034         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8035         return ret_ref;
8036 }
8037
8038 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
8039 CHECK(!owner->result_ok);
8040         return DecodeError_clone(&*owner->contents.err);
8041 }
8042 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint64_t owner) {
8043         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
8044         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8045         *ret_copy = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
8046         uint64_t ret_ref = tag_ptr(ret_copy, true);
8047         return ret_ref;
8048 }
8049
8050 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
8051         LDKUpdateFee ret = *owner->contents.result;
8052         ret.is_owned = false;
8053         return ret;
8054 }
8055 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_get_ok(uint64_t owner) {
8056         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
8057         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
8058         uint64_t ret_ref = 0;
8059         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8060         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8061         return ret_ref;
8062 }
8063
8064 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
8065 CHECK(!owner->result_ok);
8066         return DecodeError_clone(&*owner->contents.err);
8067 }
8068 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_err"))) TS_CResult_UpdateFeeDecodeErrorZ_get_err(uint64_t owner) {
8069         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
8070         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8071         *ret_copy = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
8072         uint64_t ret_ref = tag_ptr(ret_copy, true);
8073         return ret_ref;
8074 }
8075
8076 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
8077         LDKUpdateFulfillHTLC ret = *owner->contents.result;
8078         ret.is_owned = false;
8079         return ret;
8080 }
8081 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint64_t owner) {
8082         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
8083         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
8084         uint64_t ret_ref = 0;
8085         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8086         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8087         return ret_ref;
8088 }
8089
8090 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
8091 CHECK(!owner->result_ok);
8092         return DecodeError_clone(&*owner->contents.err);
8093 }
8094 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint64_t owner) {
8095         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
8096         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8097         *ret_copy = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
8098         uint64_t ret_ref = tag_ptr(ret_copy, true);
8099         return ret_ref;
8100 }
8101
8102 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
8103         LDKUpdateAddHTLC ret = *owner->contents.result;
8104         ret.is_owned = false;
8105         return ret;
8106 }
8107 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint64_t owner) {
8108         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
8109         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
8110         uint64_t ret_ref = 0;
8111         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8112         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8113         return ret_ref;
8114 }
8115
8116 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
8117 CHECK(!owner->result_ok);
8118         return DecodeError_clone(&*owner->contents.err);
8119 }
8120 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err(uint64_t owner) {
8121         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
8122         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8123         *ret_copy = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
8124         uint64_t ret_ref = tag_ptr(ret_copy, true);
8125         return ret_ref;
8126 }
8127
8128 static inline struct LDKOnionMessage CResult_OnionMessageDecodeErrorZ_get_ok(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
8129         LDKOnionMessage ret = *owner->contents.result;
8130         ret.is_owned = false;
8131         return ret;
8132 }
8133 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_ok"))) TS_CResult_OnionMessageDecodeErrorZ_get_ok(uint64_t owner) {
8134         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
8135         LDKOnionMessage ret_var = CResult_OnionMessageDecodeErrorZ_get_ok(owner_conv);
8136         uint64_t ret_ref = 0;
8137         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8138         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8139         return ret_ref;
8140 }
8141
8142 static inline struct LDKDecodeError CResult_OnionMessageDecodeErrorZ_get_err(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
8143 CHECK(!owner->result_ok);
8144         return DecodeError_clone(&*owner->contents.err);
8145 }
8146 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_err"))) TS_CResult_OnionMessageDecodeErrorZ_get_err(uint64_t owner) {
8147         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
8148         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8149         *ret_copy = CResult_OnionMessageDecodeErrorZ_get_err(owner_conv);
8150         uint64_t ret_ref = tag_ptr(ret_copy, true);
8151         return ret_ref;
8152 }
8153
8154 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
8155         LDKPing ret = *owner->contents.result;
8156         ret.is_owned = false;
8157         return ret;
8158 }
8159 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_ok"))) TS_CResult_PingDecodeErrorZ_get_ok(uint64_t owner) {
8160         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
8161         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
8162         uint64_t ret_ref = 0;
8163         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8164         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8165         return ret_ref;
8166 }
8167
8168 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
8169 CHECK(!owner->result_ok);
8170         return DecodeError_clone(&*owner->contents.err);
8171 }
8172 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_err"))) TS_CResult_PingDecodeErrorZ_get_err(uint64_t owner) {
8173         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
8174         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8175         *ret_copy = CResult_PingDecodeErrorZ_get_err(owner_conv);
8176         uint64_t ret_ref = tag_ptr(ret_copy, true);
8177         return ret_ref;
8178 }
8179
8180 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
8181         LDKPong ret = *owner->contents.result;
8182         ret.is_owned = false;
8183         return ret;
8184 }
8185 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_ok"))) TS_CResult_PongDecodeErrorZ_get_ok(uint64_t owner) {
8186         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
8187         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
8188         uint64_t ret_ref = 0;
8189         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8190         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8191         return ret_ref;
8192 }
8193
8194 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
8195 CHECK(!owner->result_ok);
8196         return DecodeError_clone(&*owner->contents.err);
8197 }
8198 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_err"))) TS_CResult_PongDecodeErrorZ_get_err(uint64_t owner) {
8199         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
8200         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8201         *ret_copy = CResult_PongDecodeErrorZ_get_err(owner_conv);
8202         uint64_t ret_ref = tag_ptr(ret_copy, true);
8203         return ret_ref;
8204 }
8205
8206 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8207         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
8208         ret.is_owned = false;
8209         return ret;
8210 }
8211 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
8212         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8213         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
8214         uint64_t ret_ref = 0;
8215         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8216         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8217         return ret_ref;
8218 }
8219
8220 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8221 CHECK(!owner->result_ok);
8222         return DecodeError_clone(&*owner->contents.err);
8223 }
8224 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
8225         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8226         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8227         *ret_copy = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
8228         uint64_t ret_ref = tag_ptr(ret_copy, true);
8229         return ret_ref;
8230 }
8231
8232 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8233         LDKChannelAnnouncement ret = *owner->contents.result;
8234         ret.is_owned = false;
8235         return ret;
8236 }
8237 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
8238         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8239         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
8240         uint64_t ret_ref = 0;
8241         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8242         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8243         return ret_ref;
8244 }
8245
8246 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8247 CHECK(!owner->result_ok);
8248         return DecodeError_clone(&*owner->contents.err);
8249 }
8250 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
8251         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8252         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8253         *ret_copy = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
8254         uint64_t ret_ref = tag_ptr(ret_copy, true);
8255         return ret_ref;
8256 }
8257
8258 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8259         LDKUnsignedChannelUpdate ret = *owner->contents.result;
8260         ret.is_owned = false;
8261         return ret;
8262 }
8263 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
8264         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8265         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
8266         uint64_t ret_ref = 0;
8267         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8268         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8269         return ret_ref;
8270 }
8271
8272 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8273 CHECK(!owner->result_ok);
8274         return DecodeError_clone(&*owner->contents.err);
8275 }
8276 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
8277         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8278         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8279         *ret_copy = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
8280         uint64_t ret_ref = tag_ptr(ret_copy, true);
8281         return ret_ref;
8282 }
8283
8284 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8285         LDKChannelUpdate ret = *owner->contents.result;
8286         ret.is_owned = false;
8287         return ret;
8288 }
8289 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
8290         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8291         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
8292         uint64_t ret_ref = 0;
8293         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8294         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8295         return ret_ref;
8296 }
8297
8298 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8299 CHECK(!owner->result_ok);
8300         return DecodeError_clone(&*owner->contents.err);
8301 }
8302 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
8303         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8304         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8305         *ret_copy = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
8306         uint64_t ret_ref = tag_ptr(ret_copy, true);
8307         return ret_ref;
8308 }
8309
8310 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
8311         LDKErrorMessage ret = *owner->contents.result;
8312         ret.is_owned = false;
8313         return ret;
8314 }
8315 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_get_ok(uint64_t owner) {
8316         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
8317         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
8318         uint64_t ret_ref = 0;
8319         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8320         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8321         return ret_ref;
8322 }
8323
8324 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
8325 CHECK(!owner->result_ok);
8326         return DecodeError_clone(&*owner->contents.err);
8327 }
8328 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_err"))) TS_CResult_ErrorMessageDecodeErrorZ_get_err(uint64_t owner) {
8329         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
8330         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8331         *ret_copy = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
8332         uint64_t ret_ref = tag_ptr(ret_copy, true);
8333         return ret_ref;
8334 }
8335
8336 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
8337         LDKWarningMessage ret = *owner->contents.result;
8338         ret.is_owned = false;
8339         return ret;
8340 }
8341 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_ok"))) TS_CResult_WarningMessageDecodeErrorZ_get_ok(uint64_t owner) {
8342         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
8343         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
8344         uint64_t ret_ref = 0;
8345         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8346         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8347         return ret_ref;
8348 }
8349
8350 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
8351 CHECK(!owner->result_ok);
8352         return DecodeError_clone(&*owner->contents.err);
8353 }
8354 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_err"))) TS_CResult_WarningMessageDecodeErrorZ_get_err(uint64_t owner) {
8355         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
8356         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8357         *ret_copy = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
8358         uint64_t ret_ref = tag_ptr(ret_copy, true);
8359         return ret_ref;
8360 }
8361
8362 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8363         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
8364         ret.is_owned = false;
8365         return ret;
8366 }
8367 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
8368         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
8369         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
8370         uint64_t ret_ref = 0;
8371         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8372         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8373         return ret_ref;
8374 }
8375
8376 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8377 CHECK(!owner->result_ok);
8378         return DecodeError_clone(&*owner->contents.err);
8379 }
8380 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
8381         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
8382         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8383         *ret_copy = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
8384         uint64_t ret_ref = tag_ptr(ret_copy, true);
8385         return ret_ref;
8386 }
8387
8388 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8389         LDKNodeAnnouncement ret = *owner->contents.result;
8390         ret.is_owned = false;
8391         return ret;
8392 }
8393 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
8394         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
8395         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
8396         uint64_t ret_ref = 0;
8397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8399         return ret_ref;
8400 }
8401
8402 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8403 CHECK(!owner->result_ok);
8404         return DecodeError_clone(&*owner->contents.err);
8405 }
8406 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
8407         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
8408         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8409         *ret_copy = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
8410         uint64_t ret_ref = tag_ptr(ret_copy, true);
8411         return ret_ref;
8412 }
8413
8414 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
8415         LDKQueryShortChannelIds ret = *owner->contents.result;
8416         ret.is_owned = false;
8417         return ret;
8418 }
8419 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint64_t owner) {
8420         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
8421         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
8422         uint64_t ret_ref = 0;
8423         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8424         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8425         return ret_ref;
8426 }
8427
8428 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
8429 CHECK(!owner->result_ok);
8430         return DecodeError_clone(&*owner->contents.err);
8431 }
8432 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint64_t owner) {
8433         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
8434         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8435         *ret_copy = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
8436         uint64_t ret_ref = tag_ptr(ret_copy, true);
8437         return ret_ref;
8438 }
8439
8440 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
8441         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
8442         ret.is_owned = false;
8443         return ret;
8444 }
8445 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint64_t owner) {
8446         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
8447         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
8448         uint64_t ret_ref = 0;
8449         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8450         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8451         return ret_ref;
8452 }
8453
8454 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
8455 CHECK(!owner->result_ok);
8456         return DecodeError_clone(&*owner->contents.err);
8457 }
8458 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint64_t owner) {
8459         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
8460         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8461         *ret_copy = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
8462         uint64_t ret_ref = tag_ptr(ret_copy, true);
8463         return ret_ref;
8464 }
8465
8466 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8467         LDKQueryChannelRange ret = *owner->contents.result;
8468         ret.is_owned = false;
8469         return ret;
8470 }
8471 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
8472         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
8473         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
8474         uint64_t ret_ref = 0;
8475         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8476         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8477         return ret_ref;
8478 }
8479
8480 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8481 CHECK(!owner->result_ok);
8482         return DecodeError_clone(&*owner->contents.err);
8483 }
8484 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
8485         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
8486         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8487         *ret_copy = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
8488         uint64_t ret_ref = tag_ptr(ret_copy, true);
8489         return ret_ref;
8490 }
8491
8492 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8493         LDKReplyChannelRange ret = *owner->contents.result;
8494         ret.is_owned = false;
8495         return ret;
8496 }
8497 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
8498         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
8499         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
8500         uint64_t ret_ref = 0;
8501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8503         return ret_ref;
8504 }
8505
8506 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8507 CHECK(!owner->result_ok);
8508         return DecodeError_clone(&*owner->contents.err);
8509 }
8510 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
8511         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
8512         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8513         *ret_copy = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
8514         uint64_t ret_ref = tag_ptr(ret_copy, true);
8515         return ret_ref;
8516 }
8517
8518 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
8519         LDKGossipTimestampFilter ret = *owner->contents.result;
8520         ret.is_owned = false;
8521         return ret;
8522 }
8523 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint64_t owner) {
8524         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
8525         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
8526         uint64_t ret_ref = 0;
8527         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8528         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8529         return ret_ref;
8530 }
8531
8532 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
8533 CHECK(!owner->result_ok);
8534         return DecodeError_clone(&*owner->contents.err);
8535 }
8536 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err(uint64_t owner) {
8537         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
8538         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8539         *ret_copy = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
8540         uint64_t ret_ref = tag_ptr(ret_copy, true);
8541         return ret_ref;
8542 }
8543
8544 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
8545         LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
8546         for (size_t i = 0; i < ret.datalen; i++) {
8547                 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
8548         }
8549         return ret;
8550 }
8551 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_ty_from_ptr"))) TS_LDKSignOrCreationError_ty_from_ptr(uint64_t ptr) {
8552         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
8553         switch(obj->tag) {
8554                 case LDKSignOrCreationError_SignError: return 0;
8555                 case LDKSignOrCreationError_CreationError: return 1;
8556                 default: abort();
8557         }
8558 }
8559 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_CreationError_get_creation_error"))) TS_LDKSignOrCreationError_CreationError_get_creation_error(uint64_t ptr) {
8560         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
8561         assert(obj->tag == LDKSignOrCreationError_CreationError);
8562                         uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
8563         return creation_error_conv;
8564 }
8565 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
8566         LDKBolt11Invoice ret = *owner->contents.result;
8567         ret.is_owned = false;
8568         return ret;
8569 }
8570 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(uint64_t owner) {
8571         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
8572         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
8573         uint64_t ret_ref = 0;
8574         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8575         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8576         return ret_ref;
8577 }
8578
8579 static inline struct LDKSignOrCreationError CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
8580 CHECK(!owner->result_ok);
8581         return SignOrCreationError_clone(&*owner->contents.err);
8582 }
8583 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(uint64_t owner) {
8584         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
8585         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
8586         *ret_copy = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(owner_conv);
8587         uint64_t ret_ref = tag_ptr(ret_copy, true);
8588         return ret_ref;
8589 }
8590
8591 static inline struct LDKOffersMessage CResult_OffersMessageDecodeErrorZ_get_ok(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
8592 CHECK(owner->result_ok);
8593         return OffersMessage_clone(&*owner->contents.result);
8594 }
8595 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_get_ok"))) TS_CResult_OffersMessageDecodeErrorZ_get_ok(uint64_t owner) {
8596         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
8597         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
8598         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_ok(owner_conv);
8599         uint64_t ret_ref = tag_ptr(ret_copy, true);
8600         return ret_ref;
8601 }
8602
8603 static inline struct LDKDecodeError CResult_OffersMessageDecodeErrorZ_get_err(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
8604 CHECK(!owner->result_ok);
8605         return DecodeError_clone(&*owner->contents.err);
8606 }
8607 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_get_err"))) TS_CResult_OffersMessageDecodeErrorZ_get_err(uint64_t owner) {
8608         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
8609         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8610         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_err(owner_conv);
8611         uint64_t ret_ref = tag_ptr(ret_copy, true);
8612         return ret_ref;
8613 }
8614
8615 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCClaimZ_ty_from_ptr"))) TS_LDKCOption_HTLCClaimZ_ty_from_ptr(uint64_t ptr) {
8616         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
8617         switch(obj->tag) {
8618                 case LDKCOption_HTLCClaimZ_Some: return 0;
8619                 case LDKCOption_HTLCClaimZ_None: return 1;
8620                 default: abort();
8621         }
8622 }
8623 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCClaimZ_Some_get_some"))) TS_LDKCOption_HTLCClaimZ_Some_get_some(uint64_t ptr) {
8624         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
8625         assert(obj->tag == LDKCOption_HTLCClaimZ_Some);
8626                         uint32_t some_conv = LDKHTLCClaim_to_js(obj->some);
8627         return some_conv;
8628 }
8629 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
8630         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
8631         ret.is_owned = false;
8632         return ret;
8633 }
8634 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(uint64_t owner) {
8635         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
8636         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
8637         uint64_t ret_ref = 0;
8638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8640         return ret_ref;
8641 }
8642
8643 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
8644 CHECK(!owner->result_ok);
8645         return DecodeError_clone(&*owner->contents.err);
8646 }
8647 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(uint64_t owner) {
8648         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
8649         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8650         *ret_copy = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
8651         uint64_t ret_ref = tag_ptr(ret_copy, true);
8652         return ret_ref;
8653 }
8654
8655 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
8656         LDKTxCreationKeys ret = *owner->contents.result;
8657         ret.is_owned = false;
8658         return ret;
8659 }
8660 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_ok(uint64_t owner) {
8661         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
8662         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
8663         uint64_t ret_ref = 0;
8664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8665         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8666         return ret_ref;
8667 }
8668
8669 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
8670 CHECK(!owner->result_ok);
8671         return DecodeError_clone(&*owner->contents.err);
8672 }
8673 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_err(uint64_t owner) {
8674         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
8675         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8676         *ret_copy = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
8677         uint64_t ret_ref = tag_ptr(ret_copy, true);
8678         return ret_ref;
8679 }
8680
8681 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
8682         LDKChannelPublicKeys ret = *owner->contents.result;
8683         ret.is_owned = false;
8684         return ret;
8685 }
8686 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint64_t owner) {
8687         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
8688         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
8689         uint64_t ret_ref = 0;
8690         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8691         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8692         return ret_ref;
8693 }
8694
8695 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
8696 CHECK(!owner->result_ok);
8697         return DecodeError_clone(&*owner->contents.err);
8698 }
8699 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err(uint64_t owner) {
8700         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
8701         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8702         *ret_copy = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
8703         uint64_t ret_ref = tag_ptr(ret_copy, true);
8704         return ret_ref;
8705 }
8706
8707 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
8708         LDKHTLCOutputInCommitment ret = *owner->contents.result;
8709         ret.is_owned = false;
8710         return ret;
8711 }
8712 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint64_t owner) {
8713         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
8714         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
8715         uint64_t ret_ref = 0;
8716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8718         return ret_ref;
8719 }
8720
8721 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
8722 CHECK(!owner->result_ok);
8723         return DecodeError_clone(&*owner->contents.err);
8724 }
8725 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint64_t owner) {
8726         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
8727         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8728         *ret_copy = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
8729         uint64_t ret_ref = tag_ptr(ret_copy, true);
8730         return ret_ref;
8731 }
8732
8733 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
8734         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
8735         ret.is_owned = false;
8736         return ret;
8737 }
8738 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
8739         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
8740         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
8741         uint64_t ret_ref = 0;
8742         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8743         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8744         return ret_ref;
8745 }
8746
8747 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
8748 CHECK(!owner->result_ok);
8749         return DecodeError_clone(&*owner->contents.err);
8750 }
8751 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
8752         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
8753         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8754         *ret_copy = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
8755         uint64_t ret_ref = tag_ptr(ret_copy, true);
8756         return ret_ref;
8757 }
8758
8759 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
8760         LDKChannelTransactionParameters ret = *owner->contents.result;
8761         ret.is_owned = false;
8762         return ret;
8763 }
8764 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
8765         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
8766         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
8767         uint64_t ret_ref = 0;
8768         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8769         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8770         return ret_ref;
8771 }
8772
8773 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
8774 CHECK(!owner->result_ok);
8775         return DecodeError_clone(&*owner->contents.err);
8776 }
8777 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
8778         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
8779         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8780         *ret_copy = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
8781         uint64_t ret_ref = tag_ptr(ret_copy, true);
8782         return ret_ref;
8783 }
8784
8785 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
8786         LDKHolderCommitmentTransaction ret = *owner->contents.result;
8787         ret.is_owned = false;
8788         return ret;
8789 }
8790 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
8791         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
8792         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
8793         uint64_t ret_ref = 0;
8794         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8795         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8796         return ret_ref;
8797 }
8798
8799 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
8800 CHECK(!owner->result_ok);
8801         return DecodeError_clone(&*owner->contents.err);
8802 }
8803 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
8804         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
8805         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8806         *ret_copy = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
8807         uint64_t ret_ref = tag_ptr(ret_copy, true);
8808         return ret_ref;
8809 }
8810
8811 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
8812         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
8813         ret.is_owned = false;
8814         return ret;
8815 }
8816 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
8817         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
8818         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
8819         uint64_t ret_ref = 0;
8820         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8821         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8822         return ret_ref;
8823 }
8824
8825 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
8826 CHECK(!owner->result_ok);
8827         return DecodeError_clone(&*owner->contents.err);
8828 }
8829 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
8830         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
8831         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8832         *ret_copy = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
8833         uint64_t ret_ref = tag_ptr(ret_copy, true);
8834         return ret_ref;
8835 }
8836
8837 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
8838         LDKTrustedClosingTransaction ret = *owner->contents.result;
8839         ret.is_owned = false;
8840         return ret;
8841 }
8842 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_get_ok(uint64_t owner) {
8843         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
8844         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
8845         uint64_t ret_ref = 0;
8846         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8847         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8848         return ret_ref;
8849 }
8850
8851 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
8852 CHECK(!owner->result_ok);
8853         return *owner->contents.err;
8854 }
8855 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_err"))) TS_CResult_TrustedClosingTransactionNoneZ_get_err(uint64_t owner) {
8856         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
8857         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
8858 }
8859
8860 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
8861         LDKCommitmentTransaction ret = *owner->contents.result;
8862         ret.is_owned = false;
8863         return ret;
8864 }
8865 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
8866         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
8867         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
8868         uint64_t ret_ref = 0;
8869         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8870         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8871         return ret_ref;
8872 }
8873
8874 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
8875 CHECK(!owner->result_ok);
8876         return DecodeError_clone(&*owner->contents.err);
8877 }
8878 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
8879         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
8880         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8881         *ret_copy = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
8882         uint64_t ret_ref = tag_ptr(ret_copy, true);
8883         return ret_ref;
8884 }
8885
8886 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
8887         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
8888         ret.is_owned = false;
8889         return ret;
8890 }
8891 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok(uint64_t owner) {
8892         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
8893         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
8894         uint64_t ret_ref = 0;
8895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8897         return ret_ref;
8898 }
8899
8900 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
8901 CHECK(!owner->result_ok);
8902         return *owner->contents.err;
8903 }
8904 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_err(uint64_t owner) {
8905         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
8906         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
8907 }
8908
8909 static inline struct LDKCVec_ECDSASignatureZ CResult_CVec_ECDSASignatureZNoneZ_get_ok(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
8910 CHECK(owner->result_ok);
8911         return *owner->contents.result;
8912 }
8913 ptrArray  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_get_ok"))) TS_CResult_CVec_ECDSASignatureZNoneZ_get_ok(uint64_t owner) {
8914         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
8915         LDKCVec_ECDSASignatureZ ret_var = CResult_CVec_ECDSASignatureZNoneZ_get_ok(owner_conv);
8916         ptrArray ret_arr = NULL;
8917         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
8918         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
8919         for (size_t m = 0; m < ret_var.datalen; m++) {
8920                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
8921                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
8922                 ret_arr_ptr[m] = ret_conv_12_arr;
8923         }
8924         
8925         return ret_arr;
8926 }
8927
8928 static inline void CResult_CVec_ECDSASignatureZNoneZ_get_err(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
8929 CHECK(!owner->result_ok);
8930         return *owner->contents.err;
8931 }
8932 void  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_get_err"))) TS_CResult_CVec_ECDSASignatureZNoneZ_get_err(uint64_t owner) {
8933         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
8934         CResult_CVec_ECDSASignatureZNoneZ_get_err(owner_conv);
8935 }
8936
8937 uint32_t __attribute__((export_name("TS_LDKCOption_usizeZ_ty_from_ptr"))) TS_LDKCOption_usizeZ_ty_from_ptr(uint64_t ptr) {
8938         LDKCOption_usizeZ *obj = (LDKCOption_usizeZ*)untag_ptr(ptr);
8939         switch(obj->tag) {
8940                 case LDKCOption_usizeZ_Some: return 0;
8941                 case LDKCOption_usizeZ_None: return 1;
8942                 default: abort();
8943         }
8944 }
8945 uint32_t __attribute__((export_name("TS_LDKCOption_usizeZ_Some_get_some"))) TS_LDKCOption_usizeZ_Some_get_some(uint64_t ptr) {
8946         LDKCOption_usizeZ *obj = (LDKCOption_usizeZ*)untag_ptr(ptr);
8947         assert(obj->tag == LDKCOption_usizeZ_Some);
8948                         uint32_t some_conv = obj->some;
8949         return some_conv;
8950 }
8951 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
8952         LDKShutdownScript ret = *owner->contents.result;
8953         ret.is_owned = false;
8954         return ret;
8955 }
8956 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_ok(uint64_t owner) {
8957         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
8958         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
8959         uint64_t ret_ref = 0;
8960         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8961         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8962         return ret_ref;
8963 }
8964
8965 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
8966 CHECK(!owner->result_ok);
8967         return DecodeError_clone(&*owner->contents.err);
8968 }
8969 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_err(uint64_t owner) {
8970         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
8971         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8972         *ret_copy = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
8973         uint64_t ret_ref = tag_ptr(ret_copy, true);
8974         return ret_ref;
8975 }
8976
8977 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
8978         LDKShutdownScript ret = *owner->contents.result;
8979         ret.is_owned = false;
8980         return ret;
8981 }
8982 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint64_t owner) {
8983         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
8984         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
8985         uint64_t ret_ref = 0;
8986         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8987         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8988         return ret_ref;
8989 }
8990
8991 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
8992         LDKInvalidShutdownScript ret = *owner->contents.err;
8993         ret.is_owned = false;
8994         return ret;
8995 }
8996 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint64_t owner) {
8997         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
8998         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
8999         uint64_t ret_ref = 0;
9000         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9001         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9002         return ret_ref;
9003 }
9004
9005 uint32_t __attribute__((export_name("TS_LDKPaymentPurpose_ty_from_ptr"))) TS_LDKPaymentPurpose_ty_from_ptr(uint64_t ptr) {
9006         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
9007         switch(obj->tag) {
9008                 case LDKPaymentPurpose_InvoicePayment: return 0;
9009                 case LDKPaymentPurpose_SpontaneousPayment: return 1;
9010                 default: abort();
9011         }
9012 }
9013 uint64_t __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage(uint64_t ptr) {
9014         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
9015         assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
9016                         uint64_t payment_preimage_ref = tag_ptr(&obj->invoice_payment.payment_preimage, false);
9017         return payment_preimage_ref;
9018 }
9019 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret(uint64_t ptr) {
9020         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
9021         assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
9022                         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
9023                         memcpy(payment_secret_arr->elems, obj->invoice_payment.payment_secret.data, 32);
9024         return payment_secret_arr;
9025 }
9026 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment"))) TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment(uint64_t ptr) {
9027         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
9028         assert(obj->tag == LDKPaymentPurpose_SpontaneousPayment);
9029                         int8_tArray spontaneous_payment_arr = init_int8_tArray(32, __LINE__);
9030                         memcpy(spontaneous_payment_arr->elems, obj->spontaneous_payment.data, 32);
9031         return spontaneous_payment_arr;
9032 }
9033 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
9034 CHECK(owner->result_ok);
9035         return PaymentPurpose_clone(&*owner->contents.result);
9036 }
9037 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_ok(uint64_t owner) {
9038         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
9039         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
9040         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
9041         uint64_t ret_ref = tag_ptr(ret_copy, true);
9042         return ret_ref;
9043 }
9044
9045 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
9046 CHECK(!owner->result_ok);
9047         return DecodeError_clone(&*owner->contents.err);
9048 }
9049 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_err(uint64_t owner) {
9050         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
9051         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9052         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
9053         uint64_t ret_ref = tag_ptr(ret_copy, true);
9054         return ret_ref;
9055 }
9056
9057 static inline struct LDKClaimedHTLC CResult_ClaimedHTLCDecodeErrorZ_get_ok(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
9058         LDKClaimedHTLC ret = *owner->contents.result;
9059         ret.is_owned = false;
9060         return ret;
9061 }
9062 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_get_ok"))) TS_CResult_ClaimedHTLCDecodeErrorZ_get_ok(uint64_t owner) {
9063         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
9064         LDKClaimedHTLC ret_var = CResult_ClaimedHTLCDecodeErrorZ_get_ok(owner_conv);
9065         uint64_t ret_ref = 0;
9066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9068         return ret_ref;
9069 }
9070
9071 static inline struct LDKDecodeError CResult_ClaimedHTLCDecodeErrorZ_get_err(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
9072 CHECK(!owner->result_ok);
9073         return DecodeError_clone(&*owner->contents.err);
9074 }
9075 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_get_err"))) TS_CResult_ClaimedHTLCDecodeErrorZ_get_err(uint64_t owner) {
9076         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
9077         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9078         *ret_copy = CResult_ClaimedHTLCDecodeErrorZ_get_err(owner_conv);
9079         uint64_t ret_ref = tag_ptr(ret_copy, true);
9080         return ret_ref;
9081 }
9082
9083 uint32_t __attribute__((export_name("TS_LDKPathFailure_ty_from_ptr"))) TS_LDKPathFailure_ty_from_ptr(uint64_t ptr) {
9084         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
9085         switch(obj->tag) {
9086                 case LDKPathFailure_InitialSend: return 0;
9087                 case LDKPathFailure_OnPath: return 1;
9088                 default: abort();
9089         }
9090 }
9091 uint64_t __attribute__((export_name("TS_LDKPathFailure_InitialSend_get_err"))) TS_LDKPathFailure_InitialSend_get_err(uint64_t ptr) {
9092         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
9093         assert(obj->tag == LDKPathFailure_InitialSend);
9094                         uint64_t err_ref = tag_ptr(&obj->initial_send.err, false);
9095         return err_ref;
9096 }
9097 uint64_t __attribute__((export_name("TS_LDKPathFailure_OnPath_get_network_update"))) TS_LDKPathFailure_OnPath_get_network_update(uint64_t ptr) {
9098         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
9099         assert(obj->tag == LDKPathFailure_OnPath);
9100                         uint64_t network_update_ref = tag_ptr(&obj->on_path.network_update, false);
9101         return network_update_ref;
9102 }
9103 uint32_t __attribute__((export_name("TS_LDKCOption_PathFailureZ_ty_from_ptr"))) TS_LDKCOption_PathFailureZ_ty_from_ptr(uint64_t ptr) {
9104         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
9105         switch(obj->tag) {
9106                 case LDKCOption_PathFailureZ_Some: return 0;
9107                 case LDKCOption_PathFailureZ_None: return 1;
9108                 default: abort();
9109         }
9110 }
9111 uint64_t __attribute__((export_name("TS_LDKCOption_PathFailureZ_Some_get_some"))) TS_LDKCOption_PathFailureZ_Some_get_some(uint64_t ptr) {
9112         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
9113         assert(obj->tag == LDKCOption_PathFailureZ_Some);
9114                         uint64_t some_ref = tag_ptr(&obj->some, false);
9115         return some_ref;
9116 }
9117 static inline struct LDKCOption_PathFailureZ CResult_COption_PathFailureZDecodeErrorZ_get_ok(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
9118 CHECK(owner->result_ok);
9119         return COption_PathFailureZ_clone(&*owner->contents.result);
9120 }
9121 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_get_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_get_ok(uint64_t owner) {
9122         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
9123         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
9124         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_ok(owner_conv);
9125         uint64_t ret_ref = tag_ptr(ret_copy, true);
9126         return ret_ref;
9127 }
9128
9129 static inline struct LDKDecodeError CResult_COption_PathFailureZDecodeErrorZ_get_err(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
9130 CHECK(!owner->result_ok);
9131         return DecodeError_clone(&*owner->contents.err);
9132 }
9133 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_get_err"))) TS_CResult_COption_PathFailureZDecodeErrorZ_get_err(uint64_t owner) {
9134         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
9135         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9136         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_err(owner_conv);
9137         uint64_t ret_ref = tag_ptr(ret_copy, true);
9138         return ret_ref;
9139 }
9140
9141 uint32_t __attribute__((export_name("TS_LDKClosureReason_ty_from_ptr"))) TS_LDKClosureReason_ty_from_ptr(uint64_t ptr) {
9142         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
9143         switch(obj->tag) {
9144                 case LDKClosureReason_CounterpartyForceClosed: return 0;
9145                 case LDKClosureReason_HolderForceClosed: return 1;
9146                 case LDKClosureReason_CooperativeClosure: return 2;
9147                 case LDKClosureReason_CommitmentTxConfirmed: return 3;
9148                 case LDKClosureReason_FundingTimedOut: return 4;
9149                 case LDKClosureReason_ProcessingError: return 5;
9150                 case LDKClosureReason_DisconnectedPeer: return 6;
9151                 case LDKClosureReason_OutdatedChannelManager: return 7;
9152                 case LDKClosureReason_CounterpartyCoopClosedUnfundedChannel: return 8;
9153                 case LDKClosureReason_FundingBatchClosure: return 9;
9154                 default: abort();
9155         }
9156 }
9157 uint64_t __attribute__((export_name("TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg"))) TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg(uint64_t ptr) {
9158         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
9159         assert(obj->tag == LDKClosureReason_CounterpartyForceClosed);
9160                         LDKUntrustedString peer_msg_var = obj->counterparty_force_closed.peer_msg;
9161                         uint64_t peer_msg_ref = 0;
9162                         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_var);
9163                         peer_msg_ref = tag_ptr(peer_msg_var.inner, false);
9164         return peer_msg_ref;
9165 }
9166 jstring __attribute__((export_name("TS_LDKClosureReason_ProcessingError_get_err"))) TS_LDKClosureReason_ProcessingError_get_err(uint64_t ptr) {
9167         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
9168         assert(obj->tag == LDKClosureReason_ProcessingError);
9169                         LDKStr err_str = obj->processing_error.err;
9170                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
9171         return err_conv;
9172 }
9173 uint32_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_ty_from_ptr"))) TS_LDKCOption_ClosureReasonZ_ty_from_ptr(uint64_t ptr) {
9174         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
9175         switch(obj->tag) {
9176                 case LDKCOption_ClosureReasonZ_Some: return 0;
9177                 case LDKCOption_ClosureReasonZ_None: return 1;
9178                 default: abort();
9179         }
9180 }
9181 uint64_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_Some_get_some"))) TS_LDKCOption_ClosureReasonZ_Some_get_some(uint64_t ptr) {
9182         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
9183         assert(obj->tag == LDKCOption_ClosureReasonZ_Some);
9184                         uint64_t some_ref = tag_ptr(&obj->some, false);
9185         return some_ref;
9186 }
9187 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
9188 CHECK(owner->result_ok);
9189         return COption_ClosureReasonZ_clone(&*owner->contents.result);
9190 }
9191 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(uint64_t owner) {
9192         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
9193         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
9194         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
9195         uint64_t ret_ref = tag_ptr(ret_copy, true);
9196         return ret_ref;
9197 }
9198
9199 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
9200 CHECK(!owner->result_ok);
9201         return DecodeError_clone(&*owner->contents.err);
9202 }
9203 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err(uint64_t owner) {
9204         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
9205         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9206         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
9207         uint64_t ret_ref = tag_ptr(ret_copy, true);
9208         return ret_ref;
9209 }
9210
9211 uint32_t __attribute__((export_name("TS_LDKHTLCDestination_ty_from_ptr"))) TS_LDKHTLCDestination_ty_from_ptr(uint64_t ptr) {
9212         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
9213         switch(obj->tag) {
9214                 case LDKHTLCDestination_NextHopChannel: return 0;
9215                 case LDKHTLCDestination_UnknownNextHop: return 1;
9216                 case LDKHTLCDestination_InvalidForward: return 2;
9217                 case LDKHTLCDestination_FailedPayment: return 3;
9218                 default: abort();
9219         }
9220 }
9221 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_node_id"))) TS_LDKHTLCDestination_NextHopChannel_get_node_id(uint64_t ptr) {
9222         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
9223         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
9224                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
9225                         memcpy(node_id_arr->elems, obj->next_hop_channel.node_id.compressed_form, 33);
9226         return node_id_arr;
9227 }
9228 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_channel_id"))) TS_LDKHTLCDestination_NextHopChannel_get_channel_id(uint64_t ptr) {
9229         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
9230         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
9231                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
9232                         memcpy(channel_id_arr->elems, obj->next_hop_channel.channel_id.data, 32);
9233         return channel_id_arr;
9234 }
9235 int64_t __attribute__((export_name("TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid"))) TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid(uint64_t ptr) {
9236         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
9237         assert(obj->tag == LDKHTLCDestination_UnknownNextHop);
9238                         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
9239         return requested_forward_scid_conv;
9240 }
9241 int64_t __attribute__((export_name("TS_LDKHTLCDestination_InvalidForward_get_requested_forward_scid"))) TS_LDKHTLCDestination_InvalidForward_get_requested_forward_scid(uint64_t ptr) {
9242         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
9243         assert(obj->tag == LDKHTLCDestination_InvalidForward);
9244                         int64_t requested_forward_scid_conv = obj->invalid_forward.requested_forward_scid;
9245         return requested_forward_scid_conv;
9246 }
9247 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_FailedPayment_get_payment_hash"))) TS_LDKHTLCDestination_FailedPayment_get_payment_hash(uint64_t ptr) {
9248         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
9249         assert(obj->tag == LDKHTLCDestination_FailedPayment);
9250                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
9251                         memcpy(payment_hash_arr->elems, obj->failed_payment.payment_hash.data, 32);
9252         return payment_hash_arr;
9253 }
9254 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_ty_from_ptr"))) TS_LDKCOption_HTLCDestinationZ_ty_from_ptr(uint64_t ptr) {
9255         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
9256         switch(obj->tag) {
9257                 case LDKCOption_HTLCDestinationZ_Some: return 0;
9258                 case LDKCOption_HTLCDestinationZ_None: return 1;
9259                 default: abort();
9260         }
9261 }
9262 uint64_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_Some_get_some"))) TS_LDKCOption_HTLCDestinationZ_Some_get_some(uint64_t ptr) {
9263         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
9264         assert(obj->tag == LDKCOption_HTLCDestinationZ_Some);
9265                         uint64_t some_ref = tag_ptr(&obj->some, false);
9266         return some_ref;
9267 }
9268 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
9269 CHECK(owner->result_ok);
9270         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
9271 }
9272 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(uint64_t owner) {
9273         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
9274         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
9275         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
9276         uint64_t ret_ref = tag_ptr(ret_copy, true);
9277         return ret_ref;
9278 }
9279
9280 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
9281 CHECK(!owner->result_ok);
9282         return DecodeError_clone(&*owner->contents.err);
9283 }
9284 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(uint64_t owner) {
9285         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
9286         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9287         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
9288         uint64_t ret_ref = tag_ptr(ret_copy, true);
9289         return ret_ref;
9290 }
9291
9292 static inline enum LDKPaymentFailureReason CResult_PaymentFailureReasonDecodeErrorZ_get_ok(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
9293 CHECK(owner->result_ok);
9294         return PaymentFailureReason_clone(&*owner->contents.result);
9295 }
9296 uint32_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_get_ok"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_get_ok(uint64_t owner) {
9297         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
9298         uint32_t ret_conv = LDKPaymentFailureReason_to_js(CResult_PaymentFailureReasonDecodeErrorZ_get_ok(owner_conv));
9299         return ret_conv;
9300 }
9301
9302 static inline struct LDKDecodeError CResult_PaymentFailureReasonDecodeErrorZ_get_err(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
9303 CHECK(!owner->result_ok);
9304         return DecodeError_clone(&*owner->contents.err);
9305 }
9306 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_get_err"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_get_err(uint64_t owner) {
9307         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
9308         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9309         *ret_copy = CResult_PaymentFailureReasonDecodeErrorZ_get_err(owner_conv);
9310         uint64_t ret_ref = tag_ptr(ret_copy, true);
9311         return ret_ref;
9312 }
9313
9314 uint32_t __attribute__((export_name("TS_LDKCOption_U128Z_ty_from_ptr"))) TS_LDKCOption_U128Z_ty_from_ptr(uint64_t ptr) {
9315         LDKCOption_U128Z *obj = (LDKCOption_U128Z*)untag_ptr(ptr);
9316         switch(obj->tag) {
9317                 case LDKCOption_U128Z_Some: return 0;
9318                 case LDKCOption_U128Z_None: return 1;
9319                 default: abort();
9320         }
9321 }
9322 int8_tArray __attribute__((export_name("TS_LDKCOption_U128Z_Some_get_some"))) TS_LDKCOption_U128Z_Some_get_some(uint64_t ptr) {
9323         LDKCOption_U128Z *obj = (LDKCOption_U128Z*)untag_ptr(ptr);
9324         assert(obj->tag == LDKCOption_U128Z_Some);
9325                         int8_tArray some_arr = init_int8_tArray(16, __LINE__);
9326                         memcpy(some_arr->elems, obj->some.le_bytes, 16);
9327         return some_arr;
9328 }
9329 static inline LDKCVec_ClaimedHTLCZ CVec_ClaimedHTLCZ_clone(const LDKCVec_ClaimedHTLCZ *orig) {
9330         LDKCVec_ClaimedHTLCZ ret = { .data = MALLOC(sizeof(LDKClaimedHTLC) * orig->datalen, "LDKCVec_ClaimedHTLCZ clone bytes"), .datalen = orig->datalen };
9331         for (size_t i = 0; i < ret.datalen; i++) {
9332                 ret.data[i] = ClaimedHTLC_clone(&orig->data[i]);
9333         }
9334         return ret;
9335 }
9336 uint32_t __attribute__((export_name("TS_LDKCOption_PaymentFailureReasonZ_ty_from_ptr"))) TS_LDKCOption_PaymentFailureReasonZ_ty_from_ptr(uint64_t ptr) {
9337         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
9338         switch(obj->tag) {
9339                 case LDKCOption_PaymentFailureReasonZ_Some: return 0;
9340                 case LDKCOption_PaymentFailureReasonZ_None: return 1;
9341                 default: abort();
9342         }
9343 }
9344 uint32_t __attribute__((export_name("TS_LDKCOption_PaymentFailureReasonZ_Some_get_some"))) TS_LDKCOption_PaymentFailureReasonZ_Some_get_some(uint64_t ptr) {
9345         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
9346         assert(obj->tag == LDKCOption_PaymentFailureReasonZ_Some);
9347                         uint32_t some_conv = LDKPaymentFailureReason_to_js(obj->some);
9348         return some_conv;
9349 }
9350 uint32_t __attribute__((export_name("TS_LDKBumpTransactionEvent_ty_from_ptr"))) TS_LDKBumpTransactionEvent_ty_from_ptr(uint64_t ptr) {
9351         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9352         switch(obj->tag) {
9353                 case LDKBumpTransactionEvent_ChannelClose: return 0;
9354                 case LDKBumpTransactionEvent_HTLCResolution: return 1;
9355                 default: abort();
9356         }
9357 }
9358 int8_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_claim_id"))) TS_LDKBumpTransactionEvent_ChannelClose_get_claim_id(uint64_t ptr) {
9359         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9360         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
9361                         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
9362                         memcpy(claim_id_arr->elems, obj->channel_close.claim_id.data, 32);
9363         return claim_id_arr;
9364 }
9365 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) {
9366         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9367         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
9368                         int32_t package_target_feerate_sat_per_1000_weight_conv = obj->channel_close.package_target_feerate_sat_per_1000_weight;
9369         return package_target_feerate_sat_per_1000_weight_conv;
9370 }
9371 int8_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx"))) TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx(uint64_t ptr) {
9372         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9373         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
9374                         LDKTransaction commitment_tx_var = obj->channel_close.commitment_tx;
9375                         int8_tArray commitment_tx_arr = init_int8_tArray(commitment_tx_var.datalen, __LINE__);
9376                         memcpy(commitment_tx_arr->elems, commitment_tx_var.data, commitment_tx_var.datalen);
9377         return commitment_tx_arr;
9378 }
9379 int64_t __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx_fee_satoshis"))) TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx_fee_satoshis(uint64_t ptr) {
9380         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9381         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
9382                         int64_t commitment_tx_fee_satoshis_conv = obj->channel_close.commitment_tx_fee_satoshis;
9383         return commitment_tx_fee_satoshis_conv;
9384 }
9385 uint64_t __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_anchor_descriptor"))) TS_LDKBumpTransactionEvent_ChannelClose_get_anchor_descriptor(uint64_t ptr) {
9386         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9387         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
9388                         LDKAnchorDescriptor anchor_descriptor_var = obj->channel_close.anchor_descriptor;
9389                         uint64_t anchor_descriptor_ref = 0;
9390                         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_var);
9391                         anchor_descriptor_ref = tag_ptr(anchor_descriptor_var.inner, false);
9392         return anchor_descriptor_ref;
9393 }
9394 uint64_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_pending_htlcs"))) TS_LDKBumpTransactionEvent_ChannelClose_get_pending_htlcs(uint64_t ptr) {
9395         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9396         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
9397                         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_var = obj->channel_close.pending_htlcs;
9398                         uint64_tArray pending_htlcs_arr = NULL;
9399                         pending_htlcs_arr = init_uint64_tArray(pending_htlcs_var.datalen, __LINE__);
9400                         uint64_t *pending_htlcs_arr_ptr = (uint64_t*)(((uint8_t*)pending_htlcs_arr) + 8);
9401                         for (size_t y = 0; y < pending_htlcs_var.datalen; y++) {
9402                                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_var = pending_htlcs_var.data[y];
9403                                 uint64_t pending_htlcs_conv_24_ref = 0;
9404                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_var);
9405                                 pending_htlcs_conv_24_ref = tag_ptr(pending_htlcs_conv_24_var.inner, false);
9406                                 pending_htlcs_arr_ptr[y] = pending_htlcs_conv_24_ref;
9407                         }
9408                         
9409         return pending_htlcs_arr;
9410 }
9411 int8_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_HTLCResolution_get_claim_id"))) TS_LDKBumpTransactionEvent_HTLCResolution_get_claim_id(uint64_t ptr) {
9412         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9413         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
9414                         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
9415                         memcpy(claim_id_arr->elems, obj->htlc_resolution.claim_id.data, 32);
9416         return claim_id_arr;
9417 }
9418 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) {
9419         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9420         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
9421                         int32_t target_feerate_sat_per_1000_weight_conv = obj->htlc_resolution.target_feerate_sat_per_1000_weight;
9422         return target_feerate_sat_per_1000_weight_conv;
9423 }
9424 uint64_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_HTLCResolution_get_htlc_descriptors"))) TS_LDKBumpTransactionEvent_HTLCResolution_get_htlc_descriptors(uint64_t ptr) {
9425         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9426         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
9427                         LDKCVec_HTLCDescriptorZ htlc_descriptors_var = obj->htlc_resolution.htlc_descriptors;
9428                         uint64_tArray htlc_descriptors_arr = NULL;
9429                         htlc_descriptors_arr = init_uint64_tArray(htlc_descriptors_var.datalen, __LINE__);
9430                         uint64_t *htlc_descriptors_arr_ptr = (uint64_t*)(((uint8_t*)htlc_descriptors_arr) + 8);
9431                         for (size_t q = 0; q < htlc_descriptors_var.datalen; q++) {
9432                                 LDKHTLCDescriptor htlc_descriptors_conv_16_var = htlc_descriptors_var.data[q];
9433                                 uint64_t htlc_descriptors_conv_16_ref = 0;
9434                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_var);
9435                                 htlc_descriptors_conv_16_ref = tag_ptr(htlc_descriptors_conv_16_var.inner, false);
9436                                 htlc_descriptors_arr_ptr[q] = htlc_descriptors_conv_16_ref;
9437                         }
9438                         
9439         return htlc_descriptors_arr;
9440 }
9441 int32_t __attribute__((export_name("TS_LDKBumpTransactionEvent_HTLCResolution_get_tx_lock_time"))) TS_LDKBumpTransactionEvent_HTLCResolution_get_tx_lock_time(uint64_t ptr) {
9442         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
9443         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
9444                         int32_t tx_lock_time_conv = obj->htlc_resolution.tx_lock_time;
9445         return tx_lock_time_conv;
9446 }
9447 uint32_t __attribute__((export_name("TS_LDKEvent_ty_from_ptr"))) TS_LDKEvent_ty_from_ptr(uint64_t ptr) {
9448         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9449         switch(obj->tag) {
9450                 case LDKEvent_FundingGenerationReady: return 0;
9451                 case LDKEvent_PaymentClaimable: return 1;
9452                 case LDKEvent_PaymentClaimed: return 2;
9453                 case LDKEvent_PaymentSent: return 3;
9454                 case LDKEvent_PaymentFailed: return 4;
9455                 case LDKEvent_PaymentPathSuccessful: return 5;
9456                 case LDKEvent_PaymentPathFailed: return 6;
9457                 case LDKEvent_ProbeSuccessful: return 7;
9458                 case LDKEvent_ProbeFailed: return 8;
9459                 case LDKEvent_PendingHTLCsForwardable: return 9;
9460                 case LDKEvent_HTLCIntercepted: return 10;
9461                 case LDKEvent_SpendableOutputs: return 11;
9462                 case LDKEvent_PaymentForwarded: return 12;
9463                 case LDKEvent_ChannelPending: return 13;
9464                 case LDKEvent_ChannelReady: return 14;
9465                 case LDKEvent_ChannelClosed: return 15;
9466                 case LDKEvent_DiscardFunding: return 16;
9467                 case LDKEvent_OpenChannelRequest: return 17;
9468                 case LDKEvent_HTLCHandlingFailed: return 18;
9469                 case LDKEvent_BumpTransaction: return 19;
9470                 default: abort();
9471         }
9472 }
9473 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id(uint64_t ptr) {
9474         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9475         assert(obj->tag == LDKEvent_FundingGenerationReady);
9476                         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
9477                         memcpy(temporary_channel_id_arr->elems, obj->funding_generation_ready.temporary_channel_id.data, 32);
9478         return temporary_channel_id_arr;
9479 }
9480 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id"))) TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id(uint64_t ptr) {
9481         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9482         assert(obj->tag == LDKEvent_FundingGenerationReady);
9483                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
9484                         memcpy(counterparty_node_id_arr->elems, obj->funding_generation_ready.counterparty_node_id.compressed_form, 33);
9485         return counterparty_node_id_arr;
9486 }
9487 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis"))) TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis(uint64_t ptr) {
9488         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9489         assert(obj->tag == LDKEvent_FundingGenerationReady);
9490                         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
9491         return channel_value_satoshis_conv;
9492 }
9493 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_output_script"))) TS_LDKEvent_FundingGenerationReady_get_output_script(uint64_t ptr) {
9494         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9495         assert(obj->tag == LDKEvent_FundingGenerationReady);
9496                         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
9497                         int8_tArray output_script_arr = init_int8_tArray(output_script_var.datalen, __LINE__);
9498                         memcpy(output_script_arr->elems, output_script_var.data, output_script_var.datalen);
9499         return output_script_arr;
9500 }
9501 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_user_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_user_channel_id(uint64_t ptr) {
9502         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9503         assert(obj->tag == LDKEvent_FundingGenerationReady);
9504                         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
9505                         memcpy(user_channel_id_arr->elems, obj->funding_generation_ready.user_channel_id.le_bytes, 16);
9506         return user_channel_id_arr;
9507 }
9508 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_receiver_node_id"))) TS_LDKEvent_PaymentClaimable_get_receiver_node_id(uint64_t ptr) {
9509         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9510         assert(obj->tag == LDKEvent_PaymentClaimable);
9511                         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
9512                         memcpy(receiver_node_id_arr->elems, obj->payment_claimable.receiver_node_id.compressed_form, 33);
9513         return receiver_node_id_arr;
9514 }
9515 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_payment_hash"))) TS_LDKEvent_PaymentClaimable_get_payment_hash(uint64_t ptr) {
9516         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9517         assert(obj->tag == LDKEvent_PaymentClaimable);
9518                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
9519                         memcpy(payment_hash_arr->elems, obj->payment_claimable.payment_hash.data, 32);
9520         return payment_hash_arr;
9521 }
9522 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_onion_fields"))) TS_LDKEvent_PaymentClaimable_get_onion_fields(uint64_t ptr) {
9523         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9524         assert(obj->tag == LDKEvent_PaymentClaimable);
9525                         LDKRecipientOnionFields onion_fields_var = obj->payment_claimable.onion_fields;
9526                         uint64_t onion_fields_ref = 0;
9527                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_var);
9528                         onion_fields_ref = tag_ptr(onion_fields_var.inner, false);
9529         return onion_fields_ref;
9530 }
9531 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_amount_msat"))) TS_LDKEvent_PaymentClaimable_get_amount_msat(uint64_t ptr) {
9532         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9533         assert(obj->tag == LDKEvent_PaymentClaimable);
9534                         int64_t amount_msat_conv = obj->payment_claimable.amount_msat;
9535         return amount_msat_conv;
9536 }
9537 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_counterparty_skimmed_fee_msat"))) TS_LDKEvent_PaymentClaimable_get_counterparty_skimmed_fee_msat(uint64_t ptr) {
9538         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9539         assert(obj->tag == LDKEvent_PaymentClaimable);
9540                         int64_t counterparty_skimmed_fee_msat_conv = obj->payment_claimable.counterparty_skimmed_fee_msat;
9541         return counterparty_skimmed_fee_msat_conv;
9542 }
9543 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_purpose"))) TS_LDKEvent_PaymentClaimable_get_purpose(uint64_t ptr) {
9544         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9545         assert(obj->tag == LDKEvent_PaymentClaimable);
9546                         uint64_t purpose_ref = tag_ptr(&obj->payment_claimable.purpose, false);
9547         return purpose_ref;
9548 }
9549 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_via_channel_id"))) TS_LDKEvent_PaymentClaimable_get_via_channel_id(uint64_t ptr) {
9550         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9551         assert(obj->tag == LDKEvent_PaymentClaimable);
9552                         uint64_t via_channel_id_ref = tag_ptr(&obj->payment_claimable.via_channel_id, false);
9553         return via_channel_id_ref;
9554 }
9555 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_via_user_channel_id"))) TS_LDKEvent_PaymentClaimable_get_via_user_channel_id(uint64_t ptr) {
9556         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9557         assert(obj->tag == LDKEvent_PaymentClaimable);
9558                         uint64_t via_user_channel_id_ref = tag_ptr(&obj->payment_claimable.via_user_channel_id, false);
9559         return via_user_channel_id_ref;
9560 }
9561 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_claim_deadline"))) TS_LDKEvent_PaymentClaimable_get_claim_deadline(uint64_t ptr) {
9562         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9563         assert(obj->tag == LDKEvent_PaymentClaimable);
9564                         uint64_t claim_deadline_ref = tag_ptr(&obj->payment_claimable.claim_deadline, false);
9565         return claim_deadline_ref;
9566 }
9567 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_receiver_node_id"))) TS_LDKEvent_PaymentClaimed_get_receiver_node_id(uint64_t ptr) {
9568         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9569         assert(obj->tag == LDKEvent_PaymentClaimed);
9570                         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
9571                         memcpy(receiver_node_id_arr->elems, obj->payment_claimed.receiver_node_id.compressed_form, 33);
9572         return receiver_node_id_arr;
9573 }
9574 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_payment_hash"))) TS_LDKEvent_PaymentClaimed_get_payment_hash(uint64_t ptr) {
9575         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9576         assert(obj->tag == LDKEvent_PaymentClaimed);
9577                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
9578                         memcpy(payment_hash_arr->elems, obj->payment_claimed.payment_hash.data, 32);
9579         return payment_hash_arr;
9580 }
9581 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_amount_msat"))) TS_LDKEvent_PaymentClaimed_get_amount_msat(uint64_t ptr) {
9582         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9583         assert(obj->tag == LDKEvent_PaymentClaimed);
9584                         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
9585         return amount_msat_conv;
9586 }
9587 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_purpose"))) TS_LDKEvent_PaymentClaimed_get_purpose(uint64_t ptr) {
9588         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9589         assert(obj->tag == LDKEvent_PaymentClaimed);
9590                         uint64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
9591         return purpose_ref;
9592 }
9593 uint64_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_htlcs"))) TS_LDKEvent_PaymentClaimed_get_htlcs(uint64_t ptr) {
9594         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9595         assert(obj->tag == LDKEvent_PaymentClaimed);
9596                         LDKCVec_ClaimedHTLCZ htlcs_var = obj->payment_claimed.htlcs;
9597                         uint64_tArray htlcs_arr = NULL;
9598                         htlcs_arr = init_uint64_tArray(htlcs_var.datalen, __LINE__);
9599                         uint64_t *htlcs_arr_ptr = (uint64_t*)(((uint8_t*)htlcs_arr) + 8);
9600                         for (size_t n = 0; n < htlcs_var.datalen; n++) {
9601                                 LDKClaimedHTLC htlcs_conv_13_var = htlcs_var.data[n];
9602                                 uint64_t htlcs_conv_13_ref = 0;
9603                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_var);
9604                                 htlcs_conv_13_ref = tag_ptr(htlcs_conv_13_var.inner, false);
9605                                 htlcs_arr_ptr[n] = htlcs_conv_13_ref;
9606                         }
9607                         
9608         return htlcs_arr;
9609 }
9610 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_sender_intended_total_msat"))) TS_LDKEvent_PaymentClaimed_get_sender_intended_total_msat(uint64_t ptr) {
9611         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9612         assert(obj->tag == LDKEvent_PaymentClaimed);
9613                         uint64_t sender_intended_total_msat_ref = tag_ptr(&obj->payment_claimed.sender_intended_total_msat, false);
9614         return sender_intended_total_msat_ref;
9615 }
9616 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_id"))) TS_LDKEvent_PaymentSent_get_payment_id(uint64_t ptr) {
9617         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9618         assert(obj->tag == LDKEvent_PaymentSent);
9619                         uint64_t payment_id_ref = tag_ptr(&obj->payment_sent.payment_id, false);
9620         return payment_id_ref;
9621 }
9622 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_preimage"))) TS_LDKEvent_PaymentSent_get_payment_preimage(uint64_t ptr) {
9623         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9624         assert(obj->tag == LDKEvent_PaymentSent);
9625                         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
9626                         memcpy(payment_preimage_arr->elems, obj->payment_sent.payment_preimage.data, 32);
9627         return payment_preimage_arr;
9628 }
9629 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_hash"))) TS_LDKEvent_PaymentSent_get_payment_hash(uint64_t ptr) {
9630         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9631         assert(obj->tag == LDKEvent_PaymentSent);
9632                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
9633                         memcpy(payment_hash_arr->elems, obj->payment_sent.payment_hash.data, 32);
9634         return payment_hash_arr;
9635 }
9636 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_fee_paid_msat"))) TS_LDKEvent_PaymentSent_get_fee_paid_msat(uint64_t ptr) {
9637         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9638         assert(obj->tag == LDKEvent_PaymentSent);
9639                         uint64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
9640         return fee_paid_msat_ref;
9641 }
9642 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_id"))) TS_LDKEvent_PaymentFailed_get_payment_id(uint64_t ptr) {
9643         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9644         assert(obj->tag == LDKEvent_PaymentFailed);
9645                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
9646                         memcpy(payment_id_arr->elems, obj->payment_failed.payment_id.data, 32);
9647         return payment_id_arr;
9648 }
9649 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_hash"))) TS_LDKEvent_PaymentFailed_get_payment_hash(uint64_t ptr) {
9650         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9651         assert(obj->tag == LDKEvent_PaymentFailed);
9652                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
9653                         memcpy(payment_hash_arr->elems, obj->payment_failed.payment_hash.data, 32);
9654         return payment_hash_arr;
9655 }
9656 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_reason"))) TS_LDKEvent_PaymentFailed_get_reason(uint64_t ptr) {
9657         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9658         assert(obj->tag == LDKEvent_PaymentFailed);
9659                         uint64_t reason_ref = tag_ptr(&obj->payment_failed.reason, false);
9660         return reason_ref;
9661 }
9662 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_id"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_id(uint64_t ptr) {
9663         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9664         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
9665                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
9666                         memcpy(payment_id_arr->elems, obj->payment_path_successful.payment_id.data, 32);
9667         return payment_id_arr;
9668 }
9669 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_hash"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_hash(uint64_t ptr) {
9670         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9671         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
9672                         uint64_t payment_hash_ref = tag_ptr(&obj->payment_path_successful.payment_hash, false);
9673         return payment_hash_ref;
9674 }
9675 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_path"))) TS_LDKEvent_PaymentPathSuccessful_get_path(uint64_t ptr) {
9676         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9677         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
9678                         LDKPath path_var = obj->payment_path_successful.path;
9679                         uint64_t path_ref = 0;
9680                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
9681                         path_ref = tag_ptr(path_var.inner, false);
9682         return path_ref;
9683 }
9684 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_id"))) TS_LDKEvent_PaymentPathFailed_get_payment_id(uint64_t ptr) {
9685         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9686         assert(obj->tag == LDKEvent_PaymentPathFailed);
9687                         uint64_t payment_id_ref = tag_ptr(&obj->payment_path_failed.payment_id, false);
9688         return payment_id_ref;
9689 }
9690 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_hash"))) TS_LDKEvent_PaymentPathFailed_get_payment_hash(uint64_t ptr) {
9691         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9692         assert(obj->tag == LDKEvent_PaymentPathFailed);
9693                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
9694                         memcpy(payment_hash_arr->elems, obj->payment_path_failed.payment_hash.data, 32);
9695         return payment_hash_arr;
9696 }
9697 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently"))) TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently(uint64_t ptr) {
9698         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9699         assert(obj->tag == LDKEvent_PaymentPathFailed);
9700                         jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently;
9701         return payment_failed_permanently_conv;
9702 }
9703 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_failure"))) TS_LDKEvent_PaymentPathFailed_get_failure(uint64_t ptr) {
9704         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9705         assert(obj->tag == LDKEvent_PaymentPathFailed);
9706                         uint64_t failure_ref = tag_ptr(&obj->payment_path_failed.failure, false);
9707         return failure_ref;
9708 }
9709 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_path"))) TS_LDKEvent_PaymentPathFailed_get_path(uint64_t ptr) {
9710         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9711         assert(obj->tag == LDKEvent_PaymentPathFailed);
9712                         LDKPath path_var = obj->payment_path_failed.path;
9713                         uint64_t path_ref = 0;
9714                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
9715                         path_ref = tag_ptr(path_var.inner, false);
9716         return path_ref;
9717 }
9718 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_short_channel_id"))) TS_LDKEvent_PaymentPathFailed_get_short_channel_id(uint64_t ptr) {
9719         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9720         assert(obj->tag == LDKEvent_PaymentPathFailed);
9721                         uint64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
9722         return short_channel_id_ref;
9723 }
9724 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_id"))) TS_LDKEvent_ProbeSuccessful_get_payment_id(uint64_t ptr) {
9725         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9726         assert(obj->tag == LDKEvent_ProbeSuccessful);
9727                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
9728                         memcpy(payment_id_arr->elems, obj->probe_successful.payment_id.data, 32);
9729         return payment_id_arr;
9730 }
9731 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_hash"))) TS_LDKEvent_ProbeSuccessful_get_payment_hash(uint64_t ptr) {
9732         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9733         assert(obj->tag == LDKEvent_ProbeSuccessful);
9734                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
9735                         memcpy(payment_hash_arr->elems, obj->probe_successful.payment_hash.data, 32);
9736         return payment_hash_arr;
9737 }
9738 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_path"))) TS_LDKEvent_ProbeSuccessful_get_path(uint64_t ptr) {
9739         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9740         assert(obj->tag == LDKEvent_ProbeSuccessful);
9741                         LDKPath path_var = obj->probe_successful.path;
9742                         uint64_t path_ref = 0;
9743                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
9744                         path_ref = tag_ptr(path_var.inner, false);
9745         return path_ref;
9746 }
9747 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_id"))) TS_LDKEvent_ProbeFailed_get_payment_id(uint64_t ptr) {
9748         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9749         assert(obj->tag == LDKEvent_ProbeFailed);
9750                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
9751                         memcpy(payment_id_arr->elems, obj->probe_failed.payment_id.data, 32);
9752         return payment_id_arr;
9753 }
9754 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_hash"))) TS_LDKEvent_ProbeFailed_get_payment_hash(uint64_t ptr) {
9755         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9756         assert(obj->tag == LDKEvent_ProbeFailed);
9757                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
9758                         memcpy(payment_hash_arr->elems, obj->probe_failed.payment_hash.data, 32);
9759         return payment_hash_arr;
9760 }
9761 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_path"))) TS_LDKEvent_ProbeFailed_get_path(uint64_t ptr) {
9762         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9763         assert(obj->tag == LDKEvent_ProbeFailed);
9764                         LDKPath path_var = obj->probe_failed.path;
9765                         uint64_t path_ref = 0;
9766                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
9767                         path_ref = tag_ptr(path_var.inner, false);
9768         return path_ref;
9769 }
9770 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_short_channel_id"))) TS_LDKEvent_ProbeFailed_get_short_channel_id(uint64_t ptr) {
9771         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9772         assert(obj->tag == LDKEvent_ProbeFailed);
9773                         uint64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
9774         return short_channel_id_ref;
9775 }
9776 int64_t __attribute__((export_name("TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable"))) TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable(uint64_t ptr) {
9777         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9778         assert(obj->tag == LDKEvent_PendingHTLCsForwardable);
9779                         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
9780         return time_forwardable_conv;
9781 }
9782 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_intercept_id"))) TS_LDKEvent_HTLCIntercepted_get_intercept_id(uint64_t ptr) {
9783         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9784         assert(obj->tag == LDKEvent_HTLCIntercepted);
9785                         int8_tArray intercept_id_arr = init_int8_tArray(32, __LINE__);
9786                         memcpy(intercept_id_arr->elems, obj->htlc_intercepted.intercept_id.data, 32);
9787         return intercept_id_arr;
9788 }
9789 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_requested_next_hop_scid"))) TS_LDKEvent_HTLCIntercepted_get_requested_next_hop_scid(uint64_t ptr) {
9790         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9791         assert(obj->tag == LDKEvent_HTLCIntercepted);
9792                         int64_t requested_next_hop_scid_conv = obj->htlc_intercepted.requested_next_hop_scid;
9793         return requested_next_hop_scid_conv;
9794 }
9795 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_payment_hash"))) TS_LDKEvent_HTLCIntercepted_get_payment_hash(uint64_t ptr) {
9796         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9797         assert(obj->tag == LDKEvent_HTLCIntercepted);
9798                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
9799                         memcpy(payment_hash_arr->elems, obj->htlc_intercepted.payment_hash.data, 32);
9800         return payment_hash_arr;
9801 }
9802 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_inbound_amount_msat"))) TS_LDKEvent_HTLCIntercepted_get_inbound_amount_msat(uint64_t ptr) {
9803         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9804         assert(obj->tag == LDKEvent_HTLCIntercepted);
9805                         int64_t inbound_amount_msat_conv = obj->htlc_intercepted.inbound_amount_msat;
9806         return inbound_amount_msat_conv;
9807 }
9808 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat"))) TS_LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat(uint64_t ptr) {
9809         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9810         assert(obj->tag == LDKEvent_HTLCIntercepted);
9811                         int64_t expected_outbound_amount_msat_conv = obj->htlc_intercepted.expected_outbound_amount_msat;
9812         return expected_outbound_amount_msat_conv;
9813 }
9814 uint64_tArray __attribute__((export_name("TS_LDKEvent_SpendableOutputs_get_outputs"))) TS_LDKEvent_SpendableOutputs_get_outputs(uint64_t ptr) {
9815         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9816         assert(obj->tag == LDKEvent_SpendableOutputs);
9817                         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
9818                         uint64_tArray outputs_arr = NULL;
9819                         outputs_arr = init_uint64_tArray(outputs_var.datalen, __LINE__);
9820                         uint64_t *outputs_arr_ptr = (uint64_t*)(((uint8_t*)outputs_arr) + 8);
9821                         for (size_t b = 0; b < outputs_var.datalen; b++) {
9822                                 uint64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
9823                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
9824                         }
9825                         
9826         return outputs_arr;
9827 }
9828 uint64_t __attribute__((export_name("TS_LDKEvent_SpendableOutputs_get_channel_id"))) TS_LDKEvent_SpendableOutputs_get_channel_id(uint64_t ptr) {
9829         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9830         assert(obj->tag == LDKEvent_SpendableOutputs);
9831                         uint64_t channel_id_ref = tag_ptr(&obj->spendable_outputs.channel_id, false);
9832         return channel_id_ref;
9833 }
9834 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_prev_channel_id"))) TS_LDKEvent_PaymentForwarded_get_prev_channel_id(uint64_t ptr) {
9835         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9836         assert(obj->tag == LDKEvent_PaymentForwarded);
9837                         uint64_t prev_channel_id_ref = tag_ptr(&obj->payment_forwarded.prev_channel_id, false);
9838         return prev_channel_id_ref;
9839 }
9840 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_next_channel_id"))) TS_LDKEvent_PaymentForwarded_get_next_channel_id(uint64_t ptr) {
9841         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9842         assert(obj->tag == LDKEvent_PaymentForwarded);
9843                         uint64_t next_channel_id_ref = tag_ptr(&obj->payment_forwarded.next_channel_id, false);
9844         return next_channel_id_ref;
9845 }
9846 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_fee_earned_msat"))) TS_LDKEvent_PaymentForwarded_get_fee_earned_msat(uint64_t ptr) {
9847         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9848         assert(obj->tag == LDKEvent_PaymentForwarded);
9849                         uint64_t fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.fee_earned_msat, false);
9850         return fee_earned_msat_ref;
9851 }
9852 jboolean __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx"))) TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx(uint64_t ptr) {
9853         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9854         assert(obj->tag == LDKEvent_PaymentForwarded);
9855                         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
9856         return claim_from_onchain_tx_conv;
9857 }
9858 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_outbound_amount_forwarded_msat"))) TS_LDKEvent_PaymentForwarded_get_outbound_amount_forwarded_msat(uint64_t ptr) {
9859         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9860         assert(obj->tag == LDKEvent_PaymentForwarded);
9861                         uint64_t outbound_amount_forwarded_msat_ref = tag_ptr(&obj->payment_forwarded.outbound_amount_forwarded_msat, false);
9862         return outbound_amount_forwarded_msat_ref;
9863 }
9864 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelPending_get_channel_id"))) TS_LDKEvent_ChannelPending_get_channel_id(uint64_t ptr) {
9865         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9866         assert(obj->tag == LDKEvent_ChannelPending);
9867                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
9868                         memcpy(channel_id_arr->elems, obj->channel_pending.channel_id.data, 32);
9869         return channel_id_arr;
9870 }
9871 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelPending_get_user_channel_id"))) TS_LDKEvent_ChannelPending_get_user_channel_id(uint64_t ptr) {
9872         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9873         assert(obj->tag == LDKEvent_ChannelPending);
9874                         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
9875                         memcpy(user_channel_id_arr->elems, obj->channel_pending.user_channel_id.le_bytes, 16);
9876         return user_channel_id_arr;
9877 }
9878 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelPending_get_former_temporary_channel_id"))) TS_LDKEvent_ChannelPending_get_former_temporary_channel_id(uint64_t ptr) {
9879         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9880         assert(obj->tag == LDKEvent_ChannelPending);
9881                         uint64_t former_temporary_channel_id_ref = tag_ptr(&obj->channel_pending.former_temporary_channel_id, false);
9882         return former_temporary_channel_id_ref;
9883 }
9884 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelPending_get_counterparty_node_id"))) TS_LDKEvent_ChannelPending_get_counterparty_node_id(uint64_t ptr) {
9885         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9886         assert(obj->tag == LDKEvent_ChannelPending);
9887                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
9888                         memcpy(counterparty_node_id_arr->elems, obj->channel_pending.counterparty_node_id.compressed_form, 33);
9889         return counterparty_node_id_arr;
9890 }
9891 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelPending_get_funding_txo"))) TS_LDKEvent_ChannelPending_get_funding_txo(uint64_t ptr) {
9892         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9893         assert(obj->tag == LDKEvent_ChannelPending);
9894                         LDKOutPoint funding_txo_var = obj->channel_pending.funding_txo;
9895                         uint64_t funding_txo_ref = 0;
9896                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
9897                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
9898         return funding_txo_ref;
9899 }
9900 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_channel_id"))) TS_LDKEvent_ChannelReady_get_channel_id(uint64_t ptr) {
9901         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9902         assert(obj->tag == LDKEvent_ChannelReady);
9903                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
9904                         memcpy(channel_id_arr->elems, obj->channel_ready.channel_id.data, 32);
9905         return channel_id_arr;
9906 }
9907 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_user_channel_id"))) TS_LDKEvent_ChannelReady_get_user_channel_id(uint64_t ptr) {
9908         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9909         assert(obj->tag == LDKEvent_ChannelReady);
9910                         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
9911                         memcpy(user_channel_id_arr->elems, obj->channel_ready.user_channel_id.le_bytes, 16);
9912         return user_channel_id_arr;
9913 }
9914 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_counterparty_node_id"))) TS_LDKEvent_ChannelReady_get_counterparty_node_id(uint64_t ptr) {
9915         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9916         assert(obj->tag == LDKEvent_ChannelReady);
9917                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
9918                         memcpy(counterparty_node_id_arr->elems, obj->channel_ready.counterparty_node_id.compressed_form, 33);
9919         return counterparty_node_id_arr;
9920 }
9921 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelReady_get_channel_type"))) TS_LDKEvent_ChannelReady_get_channel_type(uint64_t ptr) {
9922         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9923         assert(obj->tag == LDKEvent_ChannelReady);
9924                         LDKChannelTypeFeatures channel_type_var = obj->channel_ready.channel_type;
9925                         uint64_t channel_type_ref = 0;
9926                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
9927                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
9928         return channel_type_ref;
9929 }
9930 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_id"))) TS_LDKEvent_ChannelClosed_get_channel_id(uint64_t ptr) {
9931         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9932         assert(obj->tag == LDKEvent_ChannelClosed);
9933                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
9934                         memcpy(channel_id_arr->elems, obj->channel_closed.channel_id.data, 32);
9935         return channel_id_arr;
9936 }
9937 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_user_channel_id"))) TS_LDKEvent_ChannelClosed_get_user_channel_id(uint64_t ptr) {
9938         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9939         assert(obj->tag == LDKEvent_ChannelClosed);
9940                         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
9941                         memcpy(user_channel_id_arr->elems, obj->channel_closed.user_channel_id.le_bytes, 16);
9942         return user_channel_id_arr;
9943 }
9944 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_reason"))) TS_LDKEvent_ChannelClosed_get_reason(uint64_t ptr) {
9945         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9946         assert(obj->tag == LDKEvent_ChannelClosed);
9947                         uint64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
9948         return reason_ref;
9949 }
9950 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_counterparty_node_id"))) TS_LDKEvent_ChannelClosed_get_counterparty_node_id(uint64_t ptr) {
9951         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9952         assert(obj->tag == LDKEvent_ChannelClosed);
9953                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
9954                         memcpy(counterparty_node_id_arr->elems, obj->channel_closed.counterparty_node_id.compressed_form, 33);
9955         return counterparty_node_id_arr;
9956 }
9957 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_capacity_sats"))) TS_LDKEvent_ChannelClosed_get_channel_capacity_sats(uint64_t ptr) {
9958         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9959         assert(obj->tag == LDKEvent_ChannelClosed);
9960                         uint64_t channel_capacity_sats_ref = tag_ptr(&obj->channel_closed.channel_capacity_sats, false);
9961         return channel_capacity_sats_ref;
9962 }
9963 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_channel_id"))) TS_LDKEvent_DiscardFunding_get_channel_id(uint64_t ptr) {
9964         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9965         assert(obj->tag == LDKEvent_DiscardFunding);
9966                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
9967                         memcpy(channel_id_arr->elems, obj->discard_funding.channel_id.data, 32);
9968         return channel_id_arr;
9969 }
9970 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_transaction"))) TS_LDKEvent_DiscardFunding_get_transaction(uint64_t ptr) {
9971         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9972         assert(obj->tag == LDKEvent_DiscardFunding);
9973                         LDKTransaction transaction_var = obj->discard_funding.transaction;
9974                         int8_tArray transaction_arr = init_int8_tArray(transaction_var.datalen, __LINE__);
9975                         memcpy(transaction_arr->elems, transaction_var.data, transaction_var.datalen);
9976         return transaction_arr;
9977 }
9978 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id"))) TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id(uint64_t ptr) {
9979         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9980         assert(obj->tag == LDKEvent_OpenChannelRequest);
9981                         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
9982                         memcpy(temporary_channel_id_arr->elems, obj->open_channel_request.temporary_channel_id.data, 32);
9983         return temporary_channel_id_arr;
9984 }
9985 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id"))) TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id(uint64_t ptr) {
9986         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9987         assert(obj->tag == LDKEvent_OpenChannelRequest);
9988                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
9989                         memcpy(counterparty_node_id_arr->elems, obj->open_channel_request.counterparty_node_id.compressed_form, 33);
9990         return counterparty_node_id_arr;
9991 }
9992 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_funding_satoshis"))) TS_LDKEvent_OpenChannelRequest_get_funding_satoshis(uint64_t ptr) {
9993         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
9994         assert(obj->tag == LDKEvent_OpenChannelRequest);
9995                         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
9996         return funding_satoshis_conv;
9997 }
9998 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_push_msat"))) TS_LDKEvent_OpenChannelRequest_get_push_msat(uint64_t ptr) {
9999         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10000         assert(obj->tag == LDKEvent_OpenChannelRequest);
10001                         int64_t push_msat_conv = obj->open_channel_request.push_msat;
10002         return push_msat_conv;
10003 }
10004 uint64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_channel_type"))) TS_LDKEvent_OpenChannelRequest_get_channel_type(uint64_t ptr) {
10005         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10006         assert(obj->tag == LDKEvent_OpenChannelRequest);
10007                         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
10008                         uint64_t channel_type_ref = 0;
10009                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
10010                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
10011         return channel_type_ref;
10012 }
10013 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id"))) TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id(uint64_t ptr) {
10014         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10015         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
10016                         int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
10017                         memcpy(prev_channel_id_arr->elems, obj->htlc_handling_failed.prev_channel_id.data, 32);
10018         return prev_channel_id_arr;
10019 }
10020 uint64_t __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination"))) TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination(uint64_t ptr) {
10021         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10022         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
10023                         uint64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
10024         return failed_next_destination_ref;
10025 }
10026 uint64_t __attribute__((export_name("TS_LDKEvent_BumpTransaction_get_bump_transaction"))) TS_LDKEvent_BumpTransaction_get_bump_transaction(uint64_t ptr) {
10027         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
10028         assert(obj->tag == LDKEvent_BumpTransaction);
10029                         uint64_t bump_transaction_ref = tag_ptr(&obj->bump_transaction, false);
10030         return bump_transaction_ref;
10031 }
10032 uint32_t __attribute__((export_name("TS_LDKCOption_EventZ_ty_from_ptr"))) TS_LDKCOption_EventZ_ty_from_ptr(uint64_t ptr) {
10033         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
10034         switch(obj->tag) {
10035                 case LDKCOption_EventZ_Some: return 0;
10036                 case LDKCOption_EventZ_None: return 1;
10037                 default: abort();
10038         }
10039 }
10040 uint64_t __attribute__((export_name("TS_LDKCOption_EventZ_Some_get_some"))) TS_LDKCOption_EventZ_Some_get_some(uint64_t ptr) {
10041         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
10042         assert(obj->tag == LDKCOption_EventZ_Some);
10043                         uint64_t some_ref = tag_ptr(&obj->some, false);
10044         return some_ref;
10045 }
10046 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
10047 CHECK(owner->result_ok);
10048         return COption_EventZ_clone(&*owner->contents.result);
10049 }
10050 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_ok"))) TS_CResult_COption_EventZDecodeErrorZ_get_ok(uint64_t owner) {
10051         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
10052         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
10053         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
10054         uint64_t ret_ref = tag_ptr(ret_copy, true);
10055         return ret_ref;
10056 }
10057
10058 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
10059 CHECK(!owner->result_ok);
10060         return DecodeError_clone(&*owner->contents.err);
10061 }
10062 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_err"))) TS_CResult_COption_EventZDecodeErrorZ_get_err(uint64_t owner) {
10063         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
10064         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10065         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
10066         uint64_t ret_ref = tag_ptr(ret_copy, true);
10067         return ret_ref;
10068 }
10069
10070 uint32_t __attribute__((export_name("TS_LDKBolt11ParseError_ty_from_ptr"))) TS_LDKBolt11ParseError_ty_from_ptr(uint64_t ptr) {
10071         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
10072         switch(obj->tag) {
10073                 case LDKBolt11ParseError_Bech32Error: return 0;
10074                 case LDKBolt11ParseError_ParseAmountError: return 1;
10075                 case LDKBolt11ParseError_MalformedSignature: return 2;
10076                 case LDKBolt11ParseError_BadPrefix: return 3;
10077                 case LDKBolt11ParseError_UnknownCurrency: return 4;
10078                 case LDKBolt11ParseError_UnknownSiPrefix: return 5;
10079                 case LDKBolt11ParseError_MalformedHRP: return 6;
10080                 case LDKBolt11ParseError_TooShortDataPart: return 7;
10081                 case LDKBolt11ParseError_UnexpectedEndOfTaggedFields: return 8;
10082                 case LDKBolt11ParseError_DescriptionDecodeError: return 9;
10083                 case LDKBolt11ParseError_PaddingError: return 10;
10084                 case LDKBolt11ParseError_IntegerOverflowError: return 11;
10085                 case LDKBolt11ParseError_InvalidSegWitProgramLength: return 12;
10086                 case LDKBolt11ParseError_InvalidPubKeyHashLength: return 13;
10087                 case LDKBolt11ParseError_InvalidScriptHashLength: return 14;
10088                 case LDKBolt11ParseError_InvalidRecoveryId: return 15;
10089                 case LDKBolt11ParseError_InvalidSliceLength: return 16;
10090                 case LDKBolt11ParseError_Skip: return 17;
10091                 default: abort();
10092         }
10093 }
10094 uint64_t __attribute__((export_name("TS_LDKBolt11ParseError_Bech32Error_get_bech32_error"))) TS_LDKBolt11ParseError_Bech32Error_get_bech32_error(uint64_t ptr) {
10095         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
10096         assert(obj->tag == LDKBolt11ParseError_Bech32Error);
10097                         uint64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
10098         return bech32_error_ref;
10099 }
10100 int32_t __attribute__((export_name("TS_LDKBolt11ParseError_ParseAmountError_get_parse_amount_error"))) TS_LDKBolt11ParseError_ParseAmountError_get_parse_amount_error(uint64_t ptr) {
10101         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
10102         assert(obj->tag == LDKBolt11ParseError_ParseAmountError);
10103                         /*obj->parse_amount_error*/
10104         return 0;
10105 }
10106 uint32_t __attribute__((export_name("TS_LDKBolt11ParseError_MalformedSignature_get_malformed_signature"))) TS_LDKBolt11ParseError_MalformedSignature_get_malformed_signature(uint64_t ptr) {
10107         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
10108         assert(obj->tag == LDKBolt11ParseError_MalformedSignature);
10109                         uint32_t malformed_signature_conv = LDKSecp256k1Error_to_js(obj->malformed_signature);
10110         return malformed_signature_conv;
10111 }
10112 int32_t __attribute__((export_name("TS_LDKBolt11ParseError_DescriptionDecodeError_get_description_decode_error"))) TS_LDKBolt11ParseError_DescriptionDecodeError_get_description_decode_error(uint64_t ptr) {
10113         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
10114         assert(obj->tag == LDKBolt11ParseError_DescriptionDecodeError);
10115                         /*obj->description_decode_error*/
10116         return 0;
10117 }
10118 jstring __attribute__((export_name("TS_LDKBolt11ParseError_InvalidSliceLength_get_invalid_slice_length"))) TS_LDKBolt11ParseError_InvalidSliceLength_get_invalid_slice_length(uint64_t ptr) {
10119         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
10120         assert(obj->tag == LDKBolt11ParseError_InvalidSliceLength);
10121                         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
10122                         jstring invalid_slice_length_conv = str_ref_to_ts(invalid_slice_length_str.chars, invalid_slice_length_str.len);
10123         return invalid_slice_length_conv;
10124 }
10125 static inline enum LDKSiPrefix CResult_SiPrefixBolt11ParseErrorZ_get_ok(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
10126 CHECK(owner->result_ok);
10127         return SiPrefix_clone(&*owner->contents.result);
10128 }
10129 uint32_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_get_ok"))) TS_CResult_SiPrefixBolt11ParseErrorZ_get_ok(uint64_t owner) {
10130         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
10131         uint32_t ret_conv = LDKSiPrefix_to_js(CResult_SiPrefixBolt11ParseErrorZ_get_ok(owner_conv));
10132         return ret_conv;
10133 }
10134
10135 static inline struct LDKBolt11ParseError CResult_SiPrefixBolt11ParseErrorZ_get_err(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
10136 CHECK(!owner->result_ok);
10137         return Bolt11ParseError_clone(&*owner->contents.err);
10138 }
10139 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_get_err"))) TS_CResult_SiPrefixBolt11ParseErrorZ_get_err(uint64_t owner) {
10140         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
10141         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
10142         *ret_copy = CResult_SiPrefixBolt11ParseErrorZ_get_err(owner_conv);
10143         uint64_t ret_ref = tag_ptr(ret_copy, true);
10144         return ret_ref;
10145 }
10146
10147 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_ty_from_ptr"))) TS_LDKParseOrSemanticError_ty_from_ptr(uint64_t ptr) {
10148         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
10149         switch(obj->tag) {
10150                 case LDKParseOrSemanticError_ParseError: return 0;
10151                 case LDKParseOrSemanticError_SemanticError: return 1;
10152                 default: abort();
10153         }
10154 }
10155 uint64_t __attribute__((export_name("TS_LDKParseOrSemanticError_ParseError_get_parse_error"))) TS_LDKParseOrSemanticError_ParseError_get_parse_error(uint64_t ptr) {
10156         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
10157         assert(obj->tag == LDKParseOrSemanticError_ParseError);
10158                         uint64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
10159         return parse_error_ref;
10160 }
10161 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_SemanticError_get_semantic_error"))) TS_LDKParseOrSemanticError_SemanticError_get_semantic_error(uint64_t ptr) {
10162         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
10163         assert(obj->tag == LDKParseOrSemanticError_SemanticError);
10164                         uint32_t semantic_error_conv = LDKBolt11SemanticError_to_js(obj->semantic_error);
10165         return semantic_error_conv;
10166 }
10167 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
10168         LDKBolt11Invoice ret = *owner->contents.result;
10169         ret.is_owned = false;
10170         return ret;
10171 }
10172 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(uint64_t owner) {
10173         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
10174         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
10175         uint64_t ret_ref = 0;
10176         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10177         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10178         return ret_ref;
10179 }
10180
10181 static inline struct LDKParseOrSemanticError CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
10182 CHECK(!owner->result_ok);
10183         return ParseOrSemanticError_clone(&*owner->contents.err);
10184 }
10185 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(uint64_t owner) {
10186         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
10187         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
10188         *ret_copy = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
10189         uint64_t ret_ref = tag_ptr(ret_copy, true);
10190         return ret_ref;
10191 }
10192
10193 static inline struct LDKSignedRawBolt11Invoice CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
10194         LDKSignedRawBolt11Invoice ret = *owner->contents.result;
10195         ret.is_owned = false;
10196         return ret;
10197 }
10198 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(uint64_t owner) {
10199         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
10200         LDKSignedRawBolt11Invoice ret_var = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(owner_conv);
10201         uint64_t ret_ref = 0;
10202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10204         return ret_ref;
10205 }
10206
10207 static inline struct LDKBolt11ParseError CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
10208 CHECK(!owner->result_ok);
10209         return Bolt11ParseError_clone(&*owner->contents.err);
10210 }
10211 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(uint64_t owner) {
10212         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
10213         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
10214         *ret_copy = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(owner_conv);
10215         uint64_t ret_ref = tag_ptr(ret_copy, true);
10216         return ret_ref;
10217 }
10218
10219 static inline struct LDKRawBolt11Invoice C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
10220         LDKRawBolt11Invoice ret = owner->a;
10221         ret.is_owned = false;
10222         return ret;
10223 }
10224 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(uint64_t owner) {
10225         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
10226         LDKRawBolt11Invoice ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(owner_conv);
10227         uint64_t ret_ref = 0;
10228         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10229         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10230         return ret_ref;
10231 }
10232
10233 static inline struct LDKThirtyTwoBytes C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
10234         return ThirtyTwoBytes_clone(&owner->b);
10235 }
10236 int8_tArray  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(uint64_t owner) {
10237         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
10238         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
10239         memcpy(ret_arr->elems, C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(owner_conv).data, 32);
10240         return ret_arr;
10241 }
10242
10243 static inline struct LDKBolt11InvoiceSignature C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
10244         LDKBolt11InvoiceSignature ret = owner->c;
10245         ret.is_owned = false;
10246         return ret;
10247 }
10248 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(uint64_t owner) {
10249         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
10250         LDKBolt11InvoiceSignature ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(owner_conv);
10251         uint64_t ret_ref = 0;
10252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10254         return ret_ref;
10255 }
10256
10257 static inline struct LDKPayeePubKey CResult_PayeePubKeySecp256k1ErrorZ_get_ok(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
10258         LDKPayeePubKey ret = *owner->contents.result;
10259         ret.is_owned = false;
10260         return ret;
10261 }
10262 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_get_ok"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_get_ok(uint64_t owner) {
10263         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
10264         LDKPayeePubKey ret_var = CResult_PayeePubKeySecp256k1ErrorZ_get_ok(owner_conv);
10265         uint64_t ret_ref = 0;
10266         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10267         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10268         return ret_ref;
10269 }
10270
10271 static inline enum LDKSecp256k1Error CResult_PayeePubKeySecp256k1ErrorZ_get_err(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
10272 CHECK(!owner->result_ok);
10273         return *owner->contents.err;
10274 }
10275 uint32_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_get_err"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_get_err(uint64_t owner) {
10276         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
10277         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PayeePubKeySecp256k1ErrorZ_get_err(owner_conv));
10278         return ret_conv;
10279 }
10280
10281 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
10282         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
10283         for (size_t i = 0; i < ret.datalen; i++) {
10284                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
10285         }
10286         return ret;
10287 }
10288 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
10289         LDKPositiveTimestamp ret = *owner->contents.result;
10290         ret.is_owned = false;
10291         return ret;
10292 }
10293 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_get_ok(uint64_t owner) {
10294         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
10295         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
10296         uint64_t ret_ref = 0;
10297         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10298         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10299         return ret_ref;
10300 }
10301
10302 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
10303 CHECK(!owner->result_ok);
10304         return CreationError_clone(&*owner->contents.err);
10305 }
10306 uint32_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_err"))) TS_CResult_PositiveTimestampCreationErrorZ_get_err(uint64_t owner) {
10307         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
10308         uint32_t ret_conv = LDKCreationError_to_js(CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
10309         return ret_conv;
10310 }
10311
10312 static inline void CResult_NoneBolt11SemanticErrorZ_get_ok(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
10313 CHECK(owner->result_ok);
10314         return *owner->contents.result;
10315 }
10316 void  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_get_ok"))) TS_CResult_NoneBolt11SemanticErrorZ_get_ok(uint64_t owner) {
10317         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
10318         CResult_NoneBolt11SemanticErrorZ_get_ok(owner_conv);
10319 }
10320
10321 static inline enum LDKBolt11SemanticError CResult_NoneBolt11SemanticErrorZ_get_err(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
10322 CHECK(!owner->result_ok);
10323         return Bolt11SemanticError_clone(&*owner->contents.err);
10324 }
10325 uint32_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_get_err"))) TS_CResult_NoneBolt11SemanticErrorZ_get_err(uint64_t owner) {
10326         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
10327         uint32_t ret_conv = LDKBolt11SemanticError_to_js(CResult_NoneBolt11SemanticErrorZ_get_err(owner_conv));
10328         return ret_conv;
10329 }
10330
10331 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
10332         LDKBolt11Invoice ret = *owner->contents.result;
10333         ret.is_owned = false;
10334         return ret;
10335 }
10336 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(uint64_t owner) {
10337         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
10338         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(owner_conv);
10339         uint64_t ret_ref = 0;
10340         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10341         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10342         return ret_ref;
10343 }
10344
10345 static inline enum LDKBolt11SemanticError CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
10346 CHECK(!owner->result_ok);
10347         return Bolt11SemanticError_clone(&*owner->contents.err);
10348 }
10349 uint32_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(uint64_t owner) {
10350         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
10351         uint32_t ret_conv = LDKBolt11SemanticError_to_js(CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(owner_conv));
10352         return ret_conv;
10353 }
10354
10355 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
10356         LDKDescription ret = *owner->contents.result;
10357         ret.is_owned = false;
10358         return ret;
10359 }
10360 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_ok"))) TS_CResult_DescriptionCreationErrorZ_get_ok(uint64_t owner) {
10361         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
10362         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
10363         uint64_t ret_ref = 0;
10364         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10365         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10366         return ret_ref;
10367 }
10368
10369 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
10370 CHECK(!owner->result_ok);
10371         return CreationError_clone(&*owner->contents.err);
10372 }
10373 uint32_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_err"))) TS_CResult_DescriptionCreationErrorZ_get_err(uint64_t owner) {
10374         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
10375         uint32_t ret_conv = LDKCreationError_to_js(CResult_DescriptionCreationErrorZ_get_err(owner_conv));
10376         return ret_conv;
10377 }
10378
10379 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
10380         LDKPrivateRoute ret = *owner->contents.result;
10381         ret.is_owned = false;
10382         return ret;
10383 }
10384 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_ok"))) TS_CResult_PrivateRouteCreationErrorZ_get_ok(uint64_t owner) {
10385         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
10386         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
10387         uint64_t ret_ref = 0;
10388         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10389         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10390         return ret_ref;
10391 }
10392
10393 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
10394 CHECK(!owner->result_ok);
10395         return CreationError_clone(&*owner->contents.err);
10396 }
10397 uint32_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_err"))) TS_CResult_PrivateRouteCreationErrorZ_get_err(uint64_t owner) {
10398         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
10399         uint32_t ret_conv = LDKCreationError_to_js(CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
10400         return ret_conv;
10401 }
10402
10403 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
10404         LDKOutPoint ret = *owner->contents.result;
10405         ret.is_owned = false;
10406         return ret;
10407 }
10408 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_ok"))) TS_CResult_OutPointDecodeErrorZ_get_ok(uint64_t owner) {
10409         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
10410         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
10411         uint64_t ret_ref = 0;
10412         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10413         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10414         return ret_ref;
10415 }
10416
10417 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
10418 CHECK(!owner->result_ok);
10419         return DecodeError_clone(&*owner->contents.err);
10420 }
10421 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_err"))) TS_CResult_OutPointDecodeErrorZ_get_err(uint64_t owner) {
10422         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
10423         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10424         *ret_copy = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
10425         uint64_t ret_ref = tag_ptr(ret_copy, true);
10426         return ret_ref;
10427 }
10428
10429 static inline struct LDKBigSize CResult_BigSizeDecodeErrorZ_get_ok(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
10430         LDKBigSize ret = *owner->contents.result;
10431         ret.is_owned = false;
10432         return ret;
10433 }
10434 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_get_ok"))) TS_CResult_BigSizeDecodeErrorZ_get_ok(uint64_t owner) {
10435         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
10436         LDKBigSize ret_var = CResult_BigSizeDecodeErrorZ_get_ok(owner_conv);
10437         uint64_t ret_ref = 0;
10438         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10439         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10440         return ret_ref;
10441 }
10442
10443 static inline struct LDKDecodeError CResult_BigSizeDecodeErrorZ_get_err(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
10444 CHECK(!owner->result_ok);
10445         return DecodeError_clone(&*owner->contents.err);
10446 }
10447 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_get_err"))) TS_CResult_BigSizeDecodeErrorZ_get_err(uint64_t owner) {
10448         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
10449         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10450         *ret_copy = CResult_BigSizeDecodeErrorZ_get_err(owner_conv);
10451         uint64_t ret_ref = tag_ptr(ret_copy, true);
10452         return ret_ref;
10453 }
10454
10455 static inline struct LDKHostname CResult_HostnameDecodeErrorZ_get_ok(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
10456         LDKHostname ret = *owner->contents.result;
10457         ret.is_owned = false;
10458         return ret;
10459 }
10460 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_get_ok"))) TS_CResult_HostnameDecodeErrorZ_get_ok(uint64_t owner) {
10461         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
10462         LDKHostname ret_var = CResult_HostnameDecodeErrorZ_get_ok(owner_conv);
10463         uint64_t ret_ref = 0;
10464         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10465         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10466         return ret_ref;
10467 }
10468
10469 static inline struct LDKDecodeError CResult_HostnameDecodeErrorZ_get_err(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
10470 CHECK(!owner->result_ok);
10471         return DecodeError_clone(&*owner->contents.err);
10472 }
10473 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_get_err"))) TS_CResult_HostnameDecodeErrorZ_get_err(uint64_t owner) {
10474         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
10475         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10476         *ret_copy = CResult_HostnameDecodeErrorZ_get_err(owner_conv);
10477         uint64_t ret_ref = tag_ptr(ret_copy, true);
10478         return ret_ref;
10479 }
10480
10481 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedNoneZ_get_ok(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
10482         LDKTransactionU16LenLimited ret = *owner->contents.result;
10483         ret.is_owned = false;
10484         return ret;
10485 }
10486 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_get_ok"))) TS_CResult_TransactionU16LenLimitedNoneZ_get_ok(uint64_t owner) {
10487         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
10488         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedNoneZ_get_ok(owner_conv);
10489         uint64_t ret_ref = 0;
10490         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10491         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10492         return ret_ref;
10493 }
10494
10495 static inline void CResult_TransactionU16LenLimitedNoneZ_get_err(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
10496 CHECK(!owner->result_ok);
10497         return *owner->contents.err;
10498 }
10499 void  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_get_err"))) TS_CResult_TransactionU16LenLimitedNoneZ_get_err(uint64_t owner) {
10500         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
10501         CResult_TransactionU16LenLimitedNoneZ_get_err(owner_conv);
10502 }
10503
10504 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
10505         LDKTransactionU16LenLimited ret = *owner->contents.result;
10506         ret.is_owned = false;
10507         return ret;
10508 }
10509 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(uint64_t owner) {
10510         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
10511         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(owner_conv);
10512         uint64_t ret_ref = 0;
10513         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10514         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10515         return ret_ref;
10516 }
10517
10518 static inline struct LDKDecodeError CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
10519 CHECK(!owner->result_ok);
10520         return DecodeError_clone(&*owner->contents.err);
10521 }
10522 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_err"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(uint64_t owner) {
10523         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
10524         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10525         *ret_copy = CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(owner_conv);
10526         uint64_t ret_ref = tag_ptr(ret_copy, true);
10527         return ret_ref;
10528 }
10529
10530 static inline struct LDKUntrustedString CResult_UntrustedStringDecodeErrorZ_get_ok(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
10531         LDKUntrustedString ret = *owner->contents.result;
10532         ret.is_owned = false;
10533         return ret;
10534 }
10535 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_get_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_get_ok(uint64_t owner) {
10536         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
10537         LDKUntrustedString ret_var = CResult_UntrustedStringDecodeErrorZ_get_ok(owner_conv);
10538         uint64_t ret_ref = 0;
10539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10541         return ret_ref;
10542 }
10543
10544 static inline struct LDKDecodeError CResult_UntrustedStringDecodeErrorZ_get_err(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
10545 CHECK(!owner->result_ok);
10546         return DecodeError_clone(&*owner->contents.err);
10547 }
10548 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_get_err"))) TS_CResult_UntrustedStringDecodeErrorZ_get_err(uint64_t owner) {
10549         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
10550         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10551         *ret_copy = CResult_UntrustedStringDecodeErrorZ_get_err(owner_conv);
10552         uint64_t ret_ref = tag_ptr(ret_copy, true);
10553         return ret_ref;
10554 }
10555
10556 static inline struct LDKReceiveTlvs CResult_ReceiveTlvsDecodeErrorZ_get_ok(LDKCResult_ReceiveTlvsDecodeErrorZ *NONNULL_PTR owner){
10557         LDKReceiveTlvs ret = *owner->contents.result;
10558         ret.is_owned = false;
10559         return ret;
10560 }
10561 uint64_t  __attribute__((export_name("TS_CResult_ReceiveTlvsDecodeErrorZ_get_ok"))) TS_CResult_ReceiveTlvsDecodeErrorZ_get_ok(uint64_t owner) {
10562         LDKCResult_ReceiveTlvsDecodeErrorZ* owner_conv = (LDKCResult_ReceiveTlvsDecodeErrorZ*)untag_ptr(owner);
10563         LDKReceiveTlvs ret_var = CResult_ReceiveTlvsDecodeErrorZ_get_ok(owner_conv);
10564         uint64_t ret_ref = 0;
10565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10567         return ret_ref;
10568 }
10569
10570 static inline struct LDKDecodeError CResult_ReceiveTlvsDecodeErrorZ_get_err(LDKCResult_ReceiveTlvsDecodeErrorZ *NONNULL_PTR owner){
10571 CHECK(!owner->result_ok);
10572         return DecodeError_clone(&*owner->contents.err);
10573 }
10574 uint64_t  __attribute__((export_name("TS_CResult_ReceiveTlvsDecodeErrorZ_get_err"))) TS_CResult_ReceiveTlvsDecodeErrorZ_get_err(uint64_t owner) {
10575         LDKCResult_ReceiveTlvsDecodeErrorZ* owner_conv = (LDKCResult_ReceiveTlvsDecodeErrorZ*)untag_ptr(owner);
10576         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10577         *ret_copy = CResult_ReceiveTlvsDecodeErrorZ_get_err(owner_conv);
10578         uint64_t ret_ref = tag_ptr(ret_copy, true);
10579         return ret_ref;
10580 }
10581
10582 static inline struct LDKPaymentRelay CResult_PaymentRelayDecodeErrorZ_get_ok(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
10583         LDKPaymentRelay ret = *owner->contents.result;
10584         ret.is_owned = false;
10585         return ret;
10586 }
10587 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_get_ok"))) TS_CResult_PaymentRelayDecodeErrorZ_get_ok(uint64_t owner) {
10588         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
10589         LDKPaymentRelay ret_var = CResult_PaymentRelayDecodeErrorZ_get_ok(owner_conv);
10590         uint64_t ret_ref = 0;
10591         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10592         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10593         return ret_ref;
10594 }
10595
10596 static inline struct LDKDecodeError CResult_PaymentRelayDecodeErrorZ_get_err(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
10597 CHECK(!owner->result_ok);
10598         return DecodeError_clone(&*owner->contents.err);
10599 }
10600 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_get_err"))) TS_CResult_PaymentRelayDecodeErrorZ_get_err(uint64_t owner) {
10601         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
10602         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10603         *ret_copy = CResult_PaymentRelayDecodeErrorZ_get_err(owner_conv);
10604         uint64_t ret_ref = tag_ptr(ret_copy, true);
10605         return ret_ref;
10606 }
10607
10608 static inline struct LDKPaymentConstraints CResult_PaymentConstraintsDecodeErrorZ_get_ok(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
10609         LDKPaymentConstraints ret = *owner->contents.result;
10610         ret.is_owned = false;
10611         return ret;
10612 }
10613 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_get_ok"))) TS_CResult_PaymentConstraintsDecodeErrorZ_get_ok(uint64_t owner) {
10614         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
10615         LDKPaymentConstraints ret_var = CResult_PaymentConstraintsDecodeErrorZ_get_ok(owner_conv);
10616         uint64_t ret_ref = 0;
10617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10619         return ret_ref;
10620 }
10621
10622 static inline struct LDKDecodeError CResult_PaymentConstraintsDecodeErrorZ_get_err(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
10623 CHECK(!owner->result_ok);
10624         return DecodeError_clone(&*owner->contents.err);
10625 }
10626 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_get_err"))) TS_CResult_PaymentConstraintsDecodeErrorZ_get_err(uint64_t owner) {
10627         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
10628         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10629         *ret_copy = CResult_PaymentConstraintsDecodeErrorZ_get_err(owner_conv);
10630         uint64_t ret_ref = tag_ptr(ret_copy, true);
10631         return ret_ref;
10632 }
10633
10634 uint32_t __attribute__((export_name("TS_LDKPaymentError_ty_from_ptr"))) TS_LDKPaymentError_ty_from_ptr(uint64_t ptr) {
10635         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
10636         switch(obj->tag) {
10637                 case LDKPaymentError_Invoice: return 0;
10638                 case LDKPaymentError_Sending: return 1;
10639                 default: abort();
10640         }
10641 }
10642 jstring __attribute__((export_name("TS_LDKPaymentError_Invoice_get_invoice"))) TS_LDKPaymentError_Invoice_get_invoice(uint64_t ptr) {
10643         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
10644         assert(obj->tag == LDKPaymentError_Invoice);
10645                         LDKStr invoice_str = obj->invoice;
10646                         jstring invoice_conv = str_ref_to_ts(invoice_str.chars, invoice_str.len);
10647         return invoice_conv;
10648 }
10649 uint32_t __attribute__((export_name("TS_LDKPaymentError_Sending_get_sending"))) TS_LDKPaymentError_Sending_get_sending(uint64_t ptr) {
10650         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
10651         assert(obj->tag == LDKPaymentError_Sending);
10652                         uint32_t sending_conv = LDKRetryableSendFailure_to_js(obj->sending);
10653         return sending_conv;
10654 }
10655 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesPaymentErrorZ_get_ok(LDKCResult_ThirtyTwoBytesPaymentErrorZ *NONNULL_PTR owner){
10656 CHECK(owner->result_ok);
10657         return ThirtyTwoBytes_clone(&*owner->contents.result);
10658 }
10659 int8_tArray  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentErrorZ_get_ok"))) TS_CResult_ThirtyTwoBytesPaymentErrorZ_get_ok(uint64_t owner) {
10660         LDKCResult_ThirtyTwoBytesPaymentErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentErrorZ*)untag_ptr(owner);
10661         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
10662         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesPaymentErrorZ_get_ok(owner_conv).data, 32);
10663         return ret_arr;
10664 }
10665
10666 static inline struct LDKPaymentError CResult_ThirtyTwoBytesPaymentErrorZ_get_err(LDKCResult_ThirtyTwoBytesPaymentErrorZ *NONNULL_PTR owner){
10667 CHECK(!owner->result_ok);
10668         return PaymentError_clone(&*owner->contents.err);
10669 }
10670 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentErrorZ_get_err"))) TS_CResult_ThirtyTwoBytesPaymentErrorZ_get_err(uint64_t owner) {
10671         LDKCResult_ThirtyTwoBytesPaymentErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentErrorZ*)untag_ptr(owner);
10672         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
10673         *ret_copy = CResult_ThirtyTwoBytesPaymentErrorZ_get_err(owner_conv);
10674         uint64_t ret_ref = tag_ptr(ret_copy, true);
10675         return ret_ref;
10676 }
10677
10678 static inline void CResult_NonePaymentErrorZ_get_ok(LDKCResult_NonePaymentErrorZ *NONNULL_PTR owner){
10679 CHECK(owner->result_ok);
10680         return *owner->contents.result;
10681 }
10682 void  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_get_ok"))) TS_CResult_NonePaymentErrorZ_get_ok(uint64_t owner) {
10683         LDKCResult_NonePaymentErrorZ* owner_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(owner);
10684         CResult_NonePaymentErrorZ_get_ok(owner_conv);
10685 }
10686
10687 static inline struct LDKPaymentError CResult_NonePaymentErrorZ_get_err(LDKCResult_NonePaymentErrorZ *NONNULL_PTR owner){
10688 CHECK(!owner->result_ok);
10689         return PaymentError_clone(&*owner->contents.err);
10690 }
10691 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_get_err"))) TS_CResult_NonePaymentErrorZ_get_err(uint64_t owner) {
10692         LDKCResult_NonePaymentErrorZ* owner_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(owner);
10693         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
10694         *ret_copy = CResult_NonePaymentErrorZ_get_err(owner_conv);
10695         uint64_t ret_ref = tag_ptr(ret_copy, true);
10696         return ret_ref;
10697 }
10698
10699 uint32_t __attribute__((export_name("TS_LDKProbingError_ty_from_ptr"))) TS_LDKProbingError_ty_from_ptr(uint64_t ptr) {
10700         LDKProbingError *obj = (LDKProbingError*)untag_ptr(ptr);
10701         switch(obj->tag) {
10702                 case LDKProbingError_Invoice: return 0;
10703                 case LDKProbingError_Sending: return 1;
10704                 default: abort();
10705         }
10706 }
10707 jstring __attribute__((export_name("TS_LDKProbingError_Invoice_get_invoice"))) TS_LDKProbingError_Invoice_get_invoice(uint64_t ptr) {
10708         LDKProbingError *obj = (LDKProbingError*)untag_ptr(ptr);
10709         assert(obj->tag == LDKProbingError_Invoice);
10710                         LDKStr invoice_str = obj->invoice;
10711                         jstring invoice_conv = str_ref_to_ts(invoice_str.chars, invoice_str.len);
10712         return invoice_conv;
10713 }
10714 uint64_t __attribute__((export_name("TS_LDKProbingError_Sending_get_sending"))) TS_LDKProbingError_Sending_get_sending(uint64_t ptr) {
10715         LDKProbingError *obj = (LDKProbingError*)untag_ptr(ptr);
10716         assert(obj->tag == LDKProbingError_Sending);
10717                         uint64_t sending_ref = tag_ptr(&obj->sending, false);
10718         return sending_ref;
10719 }
10720 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ *NONNULL_PTR owner){
10721 CHECK(owner->result_ok);
10722         return CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(&*owner->contents.result);
10723 }
10724 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_ok(uint64_t owner) {
10725         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)untag_ptr(owner);
10726         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_ok(owner_conv);
10727         uint64_tArray ret_arr = NULL;
10728         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
10729         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
10730         for (size_t o = 0; o < ret_var.datalen; o++) {
10731                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
10732                 *ret_conv_40_conv = ret_var.data[o];
10733                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
10734         }
10735         
10736         FREE(ret_var.data);
10737         return ret_arr;
10738 }
10739
10740 static inline struct LDKProbingError CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ *NONNULL_PTR owner){
10741 CHECK(!owner->result_ok);
10742         return ProbingError_clone(&*owner->contents.err);
10743 }
10744 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_err(uint64_t owner) {
10745         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)untag_ptr(owner);
10746         LDKProbingError *ret_copy = MALLOC(sizeof(LDKProbingError), "LDKProbingError");
10747         *ret_copy = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_err(owner_conv);
10748         uint64_t ret_ref = tag_ptr(ret_copy, true);
10749         return ret_ref;
10750 }
10751
10752 static inline struct LDKStr CResult_StrSecp256k1ErrorZ_get_ok(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
10753 CHECK(owner->result_ok);
10754         return *owner->contents.result;
10755 }
10756 jstring  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_get_ok"))) TS_CResult_StrSecp256k1ErrorZ_get_ok(uint64_t owner) {
10757         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
10758         LDKStr ret_str = CResult_StrSecp256k1ErrorZ_get_ok(owner_conv);
10759         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
10760         return ret_conv;
10761 }
10762
10763 static inline enum LDKSecp256k1Error CResult_StrSecp256k1ErrorZ_get_err(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
10764 CHECK(!owner->result_ok);
10765         return *owner->contents.err;
10766 }
10767 uint32_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_get_err"))) TS_CResult_StrSecp256k1ErrorZ_get_err(uint64_t owner) {
10768         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
10769         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_StrSecp256k1ErrorZ_get_err(owner_conv));
10770         return ret_conv;
10771 }
10772
10773 static inline struct LDKOnionMessagePath CResult_OnionMessagePathNoneZ_get_ok(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
10774         LDKOnionMessagePath ret = *owner->contents.result;
10775         ret.is_owned = false;
10776         return ret;
10777 }
10778 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_get_ok"))) TS_CResult_OnionMessagePathNoneZ_get_ok(uint64_t owner) {
10779         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
10780         LDKOnionMessagePath ret_var = CResult_OnionMessagePathNoneZ_get_ok(owner_conv);
10781         uint64_t ret_ref = 0;
10782         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10783         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10784         return ret_ref;
10785 }
10786
10787 static inline void CResult_OnionMessagePathNoneZ_get_err(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
10788 CHECK(!owner->result_ok);
10789         return *owner->contents.err;
10790 }
10791 void  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_get_err"))) TS_CResult_OnionMessagePathNoneZ_get_err(uint64_t owner) {
10792         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
10793         CResult_OnionMessagePathNoneZ_get_err(owner_conv);
10794 }
10795
10796 static inline struct LDKPublicKey C2Tuple_PublicKeyOnionMessageZ_get_a(LDKC2Tuple_PublicKeyOnionMessageZ *NONNULL_PTR owner){
10797         return owner->a;
10798 }
10799 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyOnionMessageZ_get_a"))) TS_C2Tuple_PublicKeyOnionMessageZ_get_a(uint64_t owner) {
10800         LDKC2Tuple_PublicKeyOnionMessageZ* owner_conv = (LDKC2Tuple_PublicKeyOnionMessageZ*)untag_ptr(owner);
10801         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
10802         memcpy(ret_arr->elems, C2Tuple_PublicKeyOnionMessageZ_get_a(owner_conv).compressed_form, 33);
10803         return ret_arr;
10804 }
10805
10806 static inline struct LDKOnionMessage C2Tuple_PublicKeyOnionMessageZ_get_b(LDKC2Tuple_PublicKeyOnionMessageZ *NONNULL_PTR owner){
10807         LDKOnionMessage ret = owner->b;
10808         ret.is_owned = false;
10809         return ret;
10810 }
10811 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyOnionMessageZ_get_b"))) TS_C2Tuple_PublicKeyOnionMessageZ_get_b(uint64_t owner) {
10812         LDKC2Tuple_PublicKeyOnionMessageZ* owner_conv = (LDKC2Tuple_PublicKeyOnionMessageZ*)untag_ptr(owner);
10813         LDKOnionMessage ret_var = C2Tuple_PublicKeyOnionMessageZ_get_b(owner_conv);
10814         uint64_t ret_ref = 0;
10815         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10816         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10817         return ret_ref;
10818 }
10819
10820 uint32_t __attribute__((export_name("TS_LDKSendError_ty_from_ptr"))) TS_LDKSendError_ty_from_ptr(uint64_t ptr) {
10821         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
10822         switch(obj->tag) {
10823                 case LDKSendError_Secp256k1: return 0;
10824                 case LDKSendError_TooBigPacket: return 1;
10825                 case LDKSendError_TooFewBlindedHops: return 2;
10826                 case LDKSendError_InvalidFirstHop: return 3;
10827                 case LDKSendError_InvalidMessage: return 4;
10828                 case LDKSendError_BufferFull: return 5;
10829                 case LDKSendError_GetNodeIdFailed: return 6;
10830                 case LDKSendError_BlindedPathAdvanceFailed: return 7;
10831                 default: abort();
10832         }
10833 }
10834 uint32_t __attribute__((export_name("TS_LDKSendError_Secp256k1_get_secp256k1"))) TS_LDKSendError_Secp256k1_get_secp256k1(uint64_t ptr) {
10835         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
10836         assert(obj->tag == LDKSendError_Secp256k1);
10837                         uint32_t secp256k1_conv = LDKSecp256k1Error_to_js(obj->secp256k1);
10838         return secp256k1_conv;
10839 }
10840 static inline struct LDKC2Tuple_PublicKeyOnionMessageZ CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_ok(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ *NONNULL_PTR owner){
10841 CHECK(owner->result_ok);
10842         return C2Tuple_PublicKeyOnionMessageZ_clone(&*owner->contents.result);
10843 }
10844 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_ok"))) TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_ok(uint64_t owner) {
10845         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* owner_conv = (LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ*)untag_ptr(owner);
10846         LDKC2Tuple_PublicKeyOnionMessageZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyOnionMessageZ), "LDKC2Tuple_PublicKeyOnionMessageZ");
10847         *ret_conv = CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_ok(owner_conv);
10848         return tag_ptr(ret_conv, true);
10849 }
10850
10851 static inline struct LDKSendError CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_err(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ *NONNULL_PTR owner){
10852 CHECK(!owner->result_ok);
10853         return SendError_clone(&*owner->contents.err);
10854 }
10855 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_err"))) TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_err(uint64_t owner) {
10856         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* owner_conv = (LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ*)untag_ptr(owner);
10857         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
10858         *ret_copy = CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_err(owner_conv);
10859         uint64_t ret_ref = tag_ptr(ret_copy, true);
10860         return ret_ref;
10861 }
10862
10863 static inline void CResult_NoneSendErrorZ_get_ok(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
10864 CHECK(owner->result_ok);
10865         return *owner->contents.result;
10866 }
10867 void  __attribute__((export_name("TS_CResult_NoneSendErrorZ_get_ok"))) TS_CResult_NoneSendErrorZ_get_ok(uint64_t owner) {
10868         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
10869         CResult_NoneSendErrorZ_get_ok(owner_conv);
10870 }
10871
10872 static inline struct LDKSendError CResult_NoneSendErrorZ_get_err(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
10873 CHECK(!owner->result_ok);
10874         return SendError_clone(&*owner->contents.err);
10875 }
10876 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_get_err"))) TS_CResult_NoneSendErrorZ_get_err(uint64_t owner) {
10877         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
10878         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
10879         *ret_copy = CResult_NoneSendErrorZ_get_err(owner_conv);
10880         uint64_t ret_ref = tag_ptr(ret_copy, true);
10881         return ret_ref;
10882 }
10883
10884 static inline struct LDKBlindedPath CResult_BlindedPathNoneZ_get_ok(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
10885         LDKBlindedPath ret = *owner->contents.result;
10886         ret.is_owned = false;
10887         return ret;
10888 }
10889 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_get_ok"))) TS_CResult_BlindedPathNoneZ_get_ok(uint64_t owner) {
10890         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
10891         LDKBlindedPath ret_var = CResult_BlindedPathNoneZ_get_ok(owner_conv);
10892         uint64_t ret_ref = 0;
10893         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10894         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10895         return ret_ref;
10896 }
10897
10898 static inline void CResult_BlindedPathNoneZ_get_err(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
10899 CHECK(!owner->result_ok);
10900         return *owner->contents.err;
10901 }
10902 void  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_get_err"))) TS_CResult_BlindedPathNoneZ_get_err(uint64_t owner) {
10903         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
10904         CResult_BlindedPathNoneZ_get_err(owner_conv);
10905 }
10906
10907 static inline struct LDKC2Tuple_BlindedPayInfoBlindedPathZ CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
10908 CHECK(owner->result_ok);
10909         return C2Tuple_BlindedPayInfoBlindedPathZ_clone(&*owner->contents.result);
10910 }
10911 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(uint64_t owner) {
10912         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
10913         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
10914         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(owner_conv);
10915         return tag_ptr(ret_conv, true);
10916 }
10917
10918 static inline void CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
10919 CHECK(!owner->result_ok);
10920         return *owner->contents.err;
10921 }
10922 void  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(uint64_t owner) {
10923         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
10924         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(owner_conv);
10925 }
10926
10927 static inline struct LDKBlindedPath CResult_BlindedPathDecodeErrorZ_get_ok(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
10928         LDKBlindedPath ret = *owner->contents.result;
10929         ret.is_owned = false;
10930         return ret;
10931 }
10932 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_get_ok"))) TS_CResult_BlindedPathDecodeErrorZ_get_ok(uint64_t owner) {
10933         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
10934         LDKBlindedPath ret_var = CResult_BlindedPathDecodeErrorZ_get_ok(owner_conv);
10935         uint64_t ret_ref = 0;
10936         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10937         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10938         return ret_ref;
10939 }
10940
10941 static inline struct LDKDecodeError CResult_BlindedPathDecodeErrorZ_get_err(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
10942 CHECK(!owner->result_ok);
10943         return DecodeError_clone(&*owner->contents.err);
10944 }
10945 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_get_err"))) TS_CResult_BlindedPathDecodeErrorZ_get_err(uint64_t owner) {
10946         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
10947         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10948         *ret_copy = CResult_BlindedPathDecodeErrorZ_get_err(owner_conv);
10949         uint64_t ret_ref = tag_ptr(ret_copy, true);
10950         return ret_ref;
10951 }
10952
10953 static inline struct LDKBlindedHop CResult_BlindedHopDecodeErrorZ_get_ok(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
10954         LDKBlindedHop ret = *owner->contents.result;
10955         ret.is_owned = false;
10956         return ret;
10957 }
10958 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_ok"))) TS_CResult_BlindedHopDecodeErrorZ_get_ok(uint64_t owner) {
10959         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
10960         LDKBlindedHop ret_var = CResult_BlindedHopDecodeErrorZ_get_ok(owner_conv);
10961         uint64_t ret_ref = 0;
10962         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10963         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10964         return ret_ref;
10965 }
10966
10967 static inline struct LDKDecodeError CResult_BlindedHopDecodeErrorZ_get_err(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
10968 CHECK(!owner->result_ok);
10969         return DecodeError_clone(&*owner->contents.err);
10970 }
10971 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_err"))) TS_CResult_BlindedHopDecodeErrorZ_get_err(uint64_t owner) {
10972         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
10973         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10974         *ret_copy = CResult_BlindedHopDecodeErrorZ_get_err(owner_conv);
10975         uint64_t ret_ref = tag_ptr(ret_copy, true);
10976         return ret_ref;
10977 }
10978
10979 static inline struct LDKInvoiceError CResult_InvoiceErrorDecodeErrorZ_get_ok(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
10980         LDKInvoiceError ret = *owner->contents.result;
10981         ret.is_owned = false;
10982         return ret;
10983 }
10984 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_get_ok"))) TS_CResult_InvoiceErrorDecodeErrorZ_get_ok(uint64_t owner) {
10985         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
10986         LDKInvoiceError ret_var = CResult_InvoiceErrorDecodeErrorZ_get_ok(owner_conv);
10987         uint64_t ret_ref = 0;
10988         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10989         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10990         return ret_ref;
10991 }
10992
10993 static inline struct LDKDecodeError CResult_InvoiceErrorDecodeErrorZ_get_err(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
10994 CHECK(!owner->result_ok);
10995         return DecodeError_clone(&*owner->contents.err);
10996 }
10997 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_get_err"))) TS_CResult_InvoiceErrorDecodeErrorZ_get_err(uint64_t owner) {
10998         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
10999         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11000         *ret_copy = CResult_InvoiceErrorDecodeErrorZ_get_err(owner_conv);
11001         uint64_t ret_ref = tag_ptr(ret_copy, true);
11002         return ret_ref;
11003 }
11004
11005 typedef struct LDKFilter_JCalls {
11006         atomic_size_t refcnt;
11007         uint32_t instance_ptr;
11008 } LDKFilter_JCalls;
11009 static void LDKFilter_JCalls_free(void* this_arg) {
11010         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
11011         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11012                 FREE(j_calls);
11013         }
11014 }
11015 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
11016         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
11017         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
11018         memcpy(txid_arr->elems, *txid, 32);
11019         LDKu8slice script_pubkey_var = script_pubkey;
11020         int8_tArray script_pubkey_arr = init_int8_tArray(script_pubkey_var.datalen, __LINE__);
11021         memcpy(script_pubkey_arr->elems, script_pubkey_var.data, script_pubkey_var.datalen);
11022         js_invoke_function_uuuuuu(j_calls->instance_ptr, 43, (uint32_t)txid_arr, (uint32_t)script_pubkey_arr, 0, 0, 0, 0);
11023 }
11024 void register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
11025         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
11026         LDKWatchedOutput output_var = output;
11027         uint64_t output_ref = 0;
11028         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
11029         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
11030         js_invoke_function_buuuuu(j_calls->instance_ptr, 44, output_ref, 0, 0, 0, 0, 0);
11031 }
11032 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
11033         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
11034         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11035 }
11036 static inline LDKFilter LDKFilter_init (JSValue o) {
11037         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
11038         atomic_init(&calls->refcnt, 1);
11039         calls->instance_ptr = o;
11040
11041         LDKFilter ret = {
11042                 .this_arg = (void*) calls,
11043                 .register_tx = register_tx_LDKFilter_jcall,
11044                 .register_output = register_output_LDKFilter_jcall,
11045                 .free = LDKFilter_JCalls_free,
11046         };
11047         return ret;
11048 }
11049 uint64_t  __attribute__((export_name("TS_LDKFilter_new"))) TS_LDKFilter_new(JSValue o) {
11050         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
11051         *res_ptr = LDKFilter_init(o);
11052         return tag_ptr(res_ptr, true);
11053 }
11054 void  __attribute__((export_name("TS_Filter_register_tx"))) TS_Filter_register_tx(uint64_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
11055         void* this_arg_ptr = untag_ptr(this_arg);
11056         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11057         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
11058         uint8_t txid_arr[32];
11059         CHECK(txid->arr_len == 32);
11060         memcpy(txid_arr, txid->elems, 32); FREE(txid);
11061         uint8_t (*txid_ref)[32] = &txid_arr;
11062         LDKu8slice script_pubkey_ref;
11063         script_pubkey_ref.datalen = script_pubkey->arr_len;
11064         script_pubkey_ref.data = script_pubkey->elems;
11065         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
11066         FREE(script_pubkey);
11067 }
11068
11069 void  __attribute__((export_name("TS_Filter_register_output"))) TS_Filter_register_output(uint64_t this_arg, uint64_t output) {
11070         void* this_arg_ptr = untag_ptr(this_arg);
11071         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11072         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
11073         LDKWatchedOutput output_conv;
11074         output_conv.inner = untag_ptr(output);
11075         output_conv.is_owned = ptr_is_owned(output);
11076         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
11077         output_conv = WatchedOutput_clone(&output_conv);
11078         (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
11079 }
11080
11081 uint32_t __attribute__((export_name("TS_LDKCOption_FilterZ_ty_from_ptr"))) TS_LDKCOption_FilterZ_ty_from_ptr(uint64_t ptr) {
11082         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
11083         switch(obj->tag) {
11084                 case LDKCOption_FilterZ_Some: return 0;
11085                 case LDKCOption_FilterZ_None: return 1;
11086                 default: abort();
11087         }
11088 }
11089 uint64_t __attribute__((export_name("TS_LDKCOption_FilterZ_Some_get_some"))) TS_LDKCOption_FilterZ_Some_get_some(uint64_t ptr) {
11090         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
11091         assert(obj->tag == LDKCOption_FilterZ_Some);
11092                         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
11093                         *some_ret = obj->some;
11094                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
11095                         if ((*some_ret).free == LDKFilter_JCalls_free) {
11096                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11097                                 LDKFilter_JCalls_cloned(&(*some_ret));
11098                         }
11099         return tag_ptr(some_ret, true);
11100 }
11101 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
11102         LDKLockedChannelMonitor ret = *owner->contents.result;
11103         ret.is_owned = false;
11104         return ret;
11105 }
11106 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_ok"))) TS_CResult_LockedChannelMonitorNoneZ_get_ok(uint64_t owner) {
11107         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
11108         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
11109         uint64_t ret_ref = 0;
11110         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11111         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11112         return ret_ref;
11113 }
11114
11115 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
11116 CHECK(!owner->result_ok);
11117         return *owner->contents.err;
11118 }
11119 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_err"))) TS_CResult_LockedChannelMonitorNoneZ_get_err(uint64_t owner) {
11120         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
11121         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
11122 }
11123
11124 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
11125         LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
11126         for (size_t i = 0; i < ret.datalen; i++) {
11127                 ret.data[i] = OutPoint_clone(&orig->data[i]);
11128         }
11129         return ret;
11130 }
11131 static inline LDKCVec_MonitorUpdateIdZ CVec_MonitorUpdateIdZ_clone(const LDKCVec_MonitorUpdateIdZ *orig) {
11132         LDKCVec_MonitorUpdateIdZ ret = { .data = MALLOC(sizeof(LDKMonitorUpdateId) * orig->datalen, "LDKCVec_MonitorUpdateIdZ clone bytes"), .datalen = orig->datalen };
11133         for (size_t i = 0; i < ret.datalen; i++) {
11134                 ret.data[i] = MonitorUpdateId_clone(&orig->data[i]);
11135         }
11136         return ret;
11137 }
11138 static inline struct LDKOutPoint C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
11139         LDKOutPoint ret = owner->a;
11140         ret.is_owned = false;
11141         return ret;
11142 }
11143 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(uint64_t owner) {
11144         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
11145         LDKOutPoint ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(owner_conv);
11146         uint64_t ret_ref = 0;
11147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11148         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11149         return ret_ref;
11150 }
11151
11152 static inline struct LDKCVec_MonitorUpdateIdZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
11153         return CVec_MonitorUpdateIdZ_clone(&owner->b);
11154 }
11155 uint64_tArray  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(uint64_t owner) {
11156         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
11157         LDKCVec_MonitorUpdateIdZ ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(owner_conv);
11158         uint64_tArray ret_arr = NULL;
11159         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
11160         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
11161         for (size_t r = 0; r < ret_var.datalen; r++) {
11162                 LDKMonitorUpdateId ret_conv_17_var = ret_var.data[r];
11163                 uint64_t ret_conv_17_ref = 0;
11164                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_17_var);
11165                 ret_conv_17_ref = tag_ptr(ret_conv_17_var.inner, ret_conv_17_var.is_owned);
11166                 ret_arr_ptr[r] = ret_conv_17_ref;
11167         }
11168         
11169         FREE(ret_var.data);
11170         return ret_arr;
11171 }
11172
11173 static inline LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_clone(const LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ *orig) {
11174         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ clone bytes"), .datalen = orig->datalen };
11175         for (size_t i = 0; i < ret.datalen; i++) {
11176                 ret.data[i] = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(&orig->data[i]);
11177         }
11178         return ret;
11179 }
11180 typedef struct LDKKVStore_JCalls {
11181         atomic_size_t refcnt;
11182         uint32_t instance_ptr;
11183 } LDKKVStore_JCalls;
11184 static void LDKKVStore_JCalls_free(void* this_arg) {
11185         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
11186         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11187                 FREE(j_calls);
11188         }
11189 }
11190 LDKCResult_CVec_u8ZIOErrorZ read_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key) {
11191         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
11192         LDKStr primary_namespace_str = primary_namespace;
11193         jstring primary_namespace_conv = str_ref_to_ts(primary_namespace_str.chars, primary_namespace_str.len);
11194         Str_free(primary_namespace_str);
11195         LDKStr secondary_namespace_str = secondary_namespace;
11196         jstring secondary_namespace_conv = str_ref_to_ts(secondary_namespace_str.chars, secondary_namespace_str.len);
11197         Str_free(secondary_namespace_str);
11198         LDKStr key_str = key;
11199         jstring key_conv = str_ref_to_ts(key_str.chars, key_str.len);
11200         Str_free(key_str);
11201         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 45, primary_namespace_conv, secondary_namespace_conv, key_conv, 0, 0, 0);
11202         void* ret_ptr = untag_ptr(ret);
11203         CHECK_ACCESS(ret_ptr);
11204         LDKCResult_CVec_u8ZIOErrorZ ret_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(ret_ptr);
11205         FREE(untag_ptr(ret));
11206         return ret_conv;
11207 }
11208 LDKCResult_NoneIOErrorZ write_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, LDKu8slice buf) {
11209         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
11210         LDKStr primary_namespace_str = primary_namespace;
11211         jstring primary_namespace_conv = str_ref_to_ts(primary_namespace_str.chars, primary_namespace_str.len);
11212         Str_free(primary_namespace_str);
11213         LDKStr secondary_namespace_str = secondary_namespace;
11214         jstring secondary_namespace_conv = str_ref_to_ts(secondary_namespace_str.chars, secondary_namespace_str.len);
11215         Str_free(secondary_namespace_str);
11216         LDKStr key_str = key;
11217         jstring key_conv = str_ref_to_ts(key_str.chars, key_str.len);
11218         Str_free(key_str);
11219         LDKu8slice buf_var = buf;
11220         int8_tArray buf_arr = init_int8_tArray(buf_var.datalen, __LINE__);
11221         memcpy(buf_arr->elems, buf_var.data, buf_var.datalen);
11222         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);
11223         void* ret_ptr = untag_ptr(ret);
11224         CHECK_ACCESS(ret_ptr);
11225         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
11226         FREE(untag_ptr(ret));
11227         return ret_conv;
11228 }
11229 LDKCResult_NoneIOErrorZ remove_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, bool lazy) {
11230         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
11231         LDKStr primary_namespace_str = primary_namespace;
11232         jstring primary_namespace_conv = str_ref_to_ts(primary_namespace_str.chars, primary_namespace_str.len);
11233         Str_free(primary_namespace_str);
11234         LDKStr secondary_namespace_str = secondary_namespace;
11235         jstring secondary_namespace_conv = str_ref_to_ts(secondary_namespace_str.chars, secondary_namespace_str.len);
11236         Str_free(secondary_namespace_str);
11237         LDKStr key_str = key;
11238         jstring key_conv = str_ref_to_ts(key_str.chars, key_str.len);
11239         Str_free(key_str);
11240         jboolean lazy_conv = lazy;
11241         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 47, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy_conv, 0, 0);
11242         void* ret_ptr = untag_ptr(ret);
11243         CHECK_ACCESS(ret_ptr);
11244         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
11245         FREE(untag_ptr(ret));
11246         return ret_conv;
11247 }
11248 LDKCResult_CVec_StrZIOErrorZ list_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace) {
11249         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
11250         LDKStr primary_namespace_str = primary_namespace;
11251         jstring primary_namespace_conv = str_ref_to_ts(primary_namespace_str.chars, primary_namespace_str.len);
11252         Str_free(primary_namespace_str);
11253         LDKStr secondary_namespace_str = secondary_namespace;
11254         jstring secondary_namespace_conv = str_ref_to_ts(secondary_namespace_str.chars, secondary_namespace_str.len);
11255         Str_free(secondary_namespace_str);
11256         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 48, primary_namespace_conv, secondary_namespace_conv, 0, 0, 0, 0);
11257         void* ret_ptr = untag_ptr(ret);
11258         CHECK_ACCESS(ret_ptr);
11259         LDKCResult_CVec_StrZIOErrorZ ret_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(ret_ptr);
11260         FREE(untag_ptr(ret));
11261         return ret_conv;
11262 }
11263 static void LDKKVStore_JCalls_cloned(LDKKVStore* new_obj) {
11264         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) new_obj->this_arg;
11265         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11266 }
11267 static inline LDKKVStore LDKKVStore_init (JSValue o) {
11268         LDKKVStore_JCalls *calls = MALLOC(sizeof(LDKKVStore_JCalls), "LDKKVStore_JCalls");
11269         atomic_init(&calls->refcnt, 1);
11270         calls->instance_ptr = o;
11271
11272         LDKKVStore ret = {
11273                 .this_arg = (void*) calls,
11274                 .read = read_LDKKVStore_jcall,
11275                 .write = write_LDKKVStore_jcall,
11276                 .remove = remove_LDKKVStore_jcall,
11277                 .list = list_LDKKVStore_jcall,
11278                 .free = LDKKVStore_JCalls_free,
11279         };
11280         return ret;
11281 }
11282 uint64_t  __attribute__((export_name("TS_LDKKVStore_new"))) TS_LDKKVStore_new(JSValue o) {
11283         LDKKVStore *res_ptr = MALLOC(sizeof(LDKKVStore), "LDKKVStore");
11284         *res_ptr = LDKKVStore_init(o);
11285         return tag_ptr(res_ptr, true);
11286 }
11287 uint64_t  __attribute__((export_name("TS_KVStore_read"))) TS_KVStore_read(uint64_t this_arg, jstring primary_namespace, jstring secondary_namespace, jstring key) {
11288         void* this_arg_ptr = untag_ptr(this_arg);
11289         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11290         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
11291         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
11292         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
11293         LDKStr key_conv = str_ref_to_owned_c(key);
11294         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
11295         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv);
11296         return tag_ptr(ret_conv, true);
11297 }
11298
11299 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) {
11300         void* this_arg_ptr = untag_ptr(this_arg);
11301         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11302         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
11303         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
11304         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
11305         LDKStr key_conv = str_ref_to_owned_c(key);
11306         LDKu8slice buf_ref;
11307         buf_ref.datalen = buf->arr_len;
11308         buf_ref.data = buf->elems;
11309         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
11310         *ret_conv = (this_arg_conv->write)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, buf_ref);
11311         FREE(buf);
11312         return tag_ptr(ret_conv, true);
11313 }
11314
11315 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) {
11316         void* this_arg_ptr = untag_ptr(this_arg);
11317         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11318         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
11319         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
11320         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
11321         LDKStr key_conv = str_ref_to_owned_c(key);
11322         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
11323         *ret_conv = (this_arg_conv->remove)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy);
11324         return tag_ptr(ret_conv, true);
11325 }
11326
11327 uint64_t  __attribute__((export_name("TS_KVStore_list"))) TS_KVStore_list(uint64_t this_arg, jstring primary_namespace, jstring secondary_namespace) {
11328         void* this_arg_ptr = untag_ptr(this_arg);
11329         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11330         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
11331         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
11332         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
11333         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
11334         *ret_conv = (this_arg_conv->list)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv);
11335         return tag_ptr(ret_conv, true);
11336 }
11337
11338 typedef struct LDKScoreLookUp_JCalls {
11339         atomic_size_t refcnt;
11340         uint32_t instance_ptr;
11341 } LDKScoreLookUp_JCalls;
11342 static void LDKScoreLookUp_JCalls_free(void* this_arg) {
11343         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
11344         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11345                 FREE(j_calls);
11346         }
11347 }
11348 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) {
11349         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
11350         int64_t short_channel_id_conv = short_channel_id;
11351         LDKNodeId source_var = *source;
11352         uint64_t source_ref = 0;
11353         source_var = NodeId_clone(&source_var);
11354         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
11355         source_ref = tag_ptr(source_var.inner, source_var.is_owned);
11356         LDKNodeId target_var = *target;
11357         uint64_t target_ref = 0;
11358         target_var = NodeId_clone(&target_var);
11359         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
11360         target_ref = tag_ptr(target_var.inner, target_var.is_owned);
11361         LDKChannelUsage usage_var = usage;
11362         uint64_t usage_ref = 0;
11363         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
11364         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
11365         LDKProbabilisticScoringFeeParameters score_params_var = *score_params;
11366         uint64_t score_params_ref = 0;
11367         score_params_var = ProbabilisticScoringFeeParameters_clone(&score_params_var);
11368         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_var);
11369         score_params_ref = tag_ptr(score_params_var.inner, score_params_var.is_owned);
11370         return js_invoke_function_bbbbbu(j_calls->instance_ptr, 49, short_channel_id_conv, source_ref, target_ref, usage_ref, score_params_ref, 0);
11371 }
11372 static void LDKScoreLookUp_JCalls_cloned(LDKScoreLookUp* new_obj) {
11373         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) new_obj->this_arg;
11374         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11375 }
11376 static inline LDKScoreLookUp LDKScoreLookUp_init (JSValue o) {
11377         LDKScoreLookUp_JCalls *calls = MALLOC(sizeof(LDKScoreLookUp_JCalls), "LDKScoreLookUp_JCalls");
11378         atomic_init(&calls->refcnt, 1);
11379         calls->instance_ptr = o;
11380
11381         LDKScoreLookUp ret = {
11382                 .this_arg = (void*) calls,
11383                 .channel_penalty_msat = channel_penalty_msat_LDKScoreLookUp_jcall,
11384                 .free = LDKScoreLookUp_JCalls_free,
11385         };
11386         return ret;
11387 }
11388 uint64_t  __attribute__((export_name("TS_LDKScoreLookUp_new"))) TS_LDKScoreLookUp_new(JSValue o) {
11389         LDKScoreLookUp *res_ptr = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
11390         *res_ptr = LDKScoreLookUp_init(o);
11391         return tag_ptr(res_ptr, true);
11392 }
11393 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) {
11394         void* this_arg_ptr = untag_ptr(this_arg);
11395         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11396         LDKScoreLookUp* this_arg_conv = (LDKScoreLookUp*)this_arg_ptr;
11397         LDKNodeId source_conv;
11398         source_conv.inner = untag_ptr(source);
11399         source_conv.is_owned = ptr_is_owned(source);
11400         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
11401         source_conv.is_owned = false;
11402         LDKNodeId target_conv;
11403         target_conv.inner = untag_ptr(target);
11404         target_conv.is_owned = ptr_is_owned(target);
11405         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
11406         target_conv.is_owned = false;
11407         LDKChannelUsage usage_conv;
11408         usage_conv.inner = untag_ptr(usage);
11409         usage_conv.is_owned = ptr_is_owned(usage);
11410         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
11411         usage_conv = ChannelUsage_clone(&usage_conv);
11412         LDKProbabilisticScoringFeeParameters score_params_conv;
11413         score_params_conv.inner = untag_ptr(score_params);
11414         score_params_conv.is_owned = ptr_is_owned(score_params);
11415         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
11416         score_params_conv.is_owned = false;
11417         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);
11418         return ret_conv;
11419 }
11420
11421 typedef struct LDKScoreUpdate_JCalls {
11422         atomic_size_t refcnt;
11423         uint32_t instance_ptr;
11424 } LDKScoreUpdate_JCalls;
11425 static void LDKScoreUpdate_JCalls_free(void* this_arg) {
11426         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
11427         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11428                 FREE(j_calls);
11429         }
11430 }
11431 void payment_path_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id) {
11432         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
11433         LDKPath path_var = *path;
11434         uint64_t path_ref = 0;
11435         path_var = Path_clone(&path_var);
11436         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
11437         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
11438         int64_t short_channel_id_conv = short_channel_id;
11439         js_invoke_function_bbuuuu(j_calls->instance_ptr, 50, path_ref, short_channel_id_conv, 0, 0, 0, 0);
11440 }
11441 void payment_path_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path) {
11442         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
11443         LDKPath path_var = *path;
11444         uint64_t path_ref = 0;
11445         path_var = Path_clone(&path_var);
11446         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
11447         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
11448         js_invoke_function_buuuuu(j_calls->instance_ptr, 51, path_ref, 0, 0, 0, 0, 0);
11449 }
11450 void probe_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id) {
11451         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
11452         LDKPath path_var = *path;
11453         uint64_t path_ref = 0;
11454         path_var = Path_clone(&path_var);
11455         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
11456         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
11457         int64_t short_channel_id_conv = short_channel_id;
11458         js_invoke_function_bbuuuu(j_calls->instance_ptr, 52, path_ref, short_channel_id_conv, 0, 0, 0, 0);
11459 }
11460 void probe_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path) {
11461         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
11462         LDKPath path_var = *path;
11463         uint64_t path_ref = 0;
11464         path_var = Path_clone(&path_var);
11465         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
11466         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
11467         js_invoke_function_buuuuu(j_calls->instance_ptr, 53, path_ref, 0, 0, 0, 0, 0);
11468 }
11469 static void LDKScoreUpdate_JCalls_cloned(LDKScoreUpdate* new_obj) {
11470         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) new_obj->this_arg;
11471         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11472 }
11473 static inline LDKScoreUpdate LDKScoreUpdate_init (JSValue o) {
11474         LDKScoreUpdate_JCalls *calls = MALLOC(sizeof(LDKScoreUpdate_JCalls), "LDKScoreUpdate_JCalls");
11475         atomic_init(&calls->refcnt, 1);
11476         calls->instance_ptr = o;
11477
11478         LDKScoreUpdate ret = {
11479                 .this_arg = (void*) calls,
11480                 .payment_path_failed = payment_path_failed_LDKScoreUpdate_jcall,
11481                 .payment_path_successful = payment_path_successful_LDKScoreUpdate_jcall,
11482                 .probe_failed = probe_failed_LDKScoreUpdate_jcall,
11483                 .probe_successful = probe_successful_LDKScoreUpdate_jcall,
11484                 .free = LDKScoreUpdate_JCalls_free,
11485         };
11486         return ret;
11487 }
11488 uint64_t  __attribute__((export_name("TS_LDKScoreUpdate_new"))) TS_LDKScoreUpdate_new(JSValue o) {
11489         LDKScoreUpdate *res_ptr = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
11490         *res_ptr = LDKScoreUpdate_init(o);
11491         return tag_ptr(res_ptr, true);
11492 }
11493 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) {
11494         void* this_arg_ptr = untag_ptr(this_arg);
11495         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11496         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
11497         LDKPath path_conv;
11498         path_conv.inner = untag_ptr(path);
11499         path_conv.is_owned = ptr_is_owned(path);
11500         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
11501         path_conv.is_owned = false;
11502         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id);
11503 }
11504
11505 void  __attribute__((export_name("TS_ScoreUpdate_payment_path_successful"))) TS_ScoreUpdate_payment_path_successful(uint64_t this_arg, uint64_t path) {
11506         void* this_arg_ptr = untag_ptr(this_arg);
11507         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11508         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
11509         LDKPath path_conv;
11510         path_conv.inner = untag_ptr(path);
11511         path_conv.is_owned = ptr_is_owned(path);
11512         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
11513         path_conv.is_owned = false;
11514         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, &path_conv);
11515 }
11516
11517 void  __attribute__((export_name("TS_ScoreUpdate_probe_failed"))) TS_ScoreUpdate_probe_failed(uint64_t this_arg, uint64_t path, int64_t short_channel_id) {
11518         void* this_arg_ptr = untag_ptr(this_arg);
11519         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11520         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
11521         LDKPath path_conv;
11522         path_conv.inner = untag_ptr(path);
11523         path_conv.is_owned = ptr_is_owned(path);
11524         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
11525         path_conv.is_owned = false;
11526         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id);
11527 }
11528
11529 void  __attribute__((export_name("TS_ScoreUpdate_probe_successful"))) TS_ScoreUpdate_probe_successful(uint64_t this_arg, uint64_t path) {
11530         void* this_arg_ptr = untag_ptr(this_arg);
11531         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11532         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
11533         LDKPath path_conv;
11534         path_conv.inner = untag_ptr(path);
11535         path_conv.is_owned = ptr_is_owned(path);
11536         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
11537         path_conv.is_owned = false;
11538         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, &path_conv);
11539 }
11540
11541 typedef struct LDKLockableScore_JCalls {
11542         atomic_size_t refcnt;
11543         uint32_t instance_ptr;
11544 } LDKLockableScore_JCalls;
11545 static void LDKLockableScore_JCalls_free(void* this_arg) {
11546         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
11547         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11548                 FREE(j_calls);
11549         }
11550 }
11551 LDKScoreLookUp read_lock_LDKLockableScore_jcall(const void* this_arg) {
11552         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
11553         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 54, 0, 0, 0, 0, 0, 0);
11554         void* ret_ptr = untag_ptr(ret);
11555         CHECK_ACCESS(ret_ptr);
11556         LDKScoreLookUp ret_conv = *(LDKScoreLookUp*)(ret_ptr);
11557         if (ret_conv.free == LDKScoreLookUp_JCalls_free) {
11558                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11559                 LDKScoreLookUp_JCalls_cloned(&ret_conv);
11560         }// WARNING: we may need a move here but no clone is available for LDKScoreLookUp
11561         
11562         return ret_conv;
11563 }
11564 LDKScoreUpdate write_lock_LDKLockableScore_jcall(const void* this_arg) {
11565         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
11566         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 55, 0, 0, 0, 0, 0, 0);
11567         void* ret_ptr = untag_ptr(ret);
11568         CHECK_ACCESS(ret_ptr);
11569         LDKScoreUpdate ret_conv = *(LDKScoreUpdate*)(ret_ptr);
11570         if (ret_conv.free == LDKScoreUpdate_JCalls_free) {
11571                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11572                 LDKScoreUpdate_JCalls_cloned(&ret_conv);
11573         }// WARNING: we may need a move here but no clone is available for LDKScoreUpdate
11574         
11575         return ret_conv;
11576 }
11577 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
11578         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
11579         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11580 }
11581 static inline LDKLockableScore LDKLockableScore_init (JSValue o) {
11582         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
11583         atomic_init(&calls->refcnt, 1);
11584         calls->instance_ptr = o;
11585
11586         LDKLockableScore ret = {
11587                 .this_arg = (void*) calls,
11588                 .read_lock = read_lock_LDKLockableScore_jcall,
11589                 .write_lock = write_lock_LDKLockableScore_jcall,
11590                 .free = LDKLockableScore_JCalls_free,
11591         };
11592         return ret;
11593 }
11594 uint64_t  __attribute__((export_name("TS_LDKLockableScore_new"))) TS_LDKLockableScore_new(JSValue o) {
11595         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
11596         *res_ptr = LDKLockableScore_init(o);
11597         return tag_ptr(res_ptr, true);
11598 }
11599 uint64_t  __attribute__((export_name("TS_LockableScore_read_lock"))) TS_LockableScore_read_lock(uint64_t this_arg) {
11600         void* this_arg_ptr = untag_ptr(this_arg);
11601         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11602         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
11603         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
11604         *ret_ret = (this_arg_conv->read_lock)(this_arg_conv->this_arg);
11605         return tag_ptr(ret_ret, true);
11606 }
11607
11608 uint64_t  __attribute__((export_name("TS_LockableScore_write_lock"))) TS_LockableScore_write_lock(uint64_t this_arg) {
11609         void* this_arg_ptr = untag_ptr(this_arg);
11610         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11611         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
11612         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
11613         *ret_ret = (this_arg_conv->write_lock)(this_arg_conv->this_arg);
11614         return tag_ptr(ret_ret, true);
11615 }
11616
11617 typedef struct LDKWriteableScore_JCalls {
11618         atomic_size_t refcnt;
11619         uint32_t instance_ptr;
11620         LDKLockableScore_JCalls* LockableScore;
11621 } LDKWriteableScore_JCalls;
11622 static void LDKWriteableScore_JCalls_free(void* this_arg) {
11623         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
11624         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11625                 FREE(j_calls);
11626         }
11627 }
11628 LDKCVec_u8Z write_LDKWriteableScore_jcall(const void* this_arg) {
11629         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
11630         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 56, 0, 0, 0, 0, 0, 0);
11631         LDKCVec_u8Z ret_ref;
11632         ret_ref.datalen = ret->arr_len;
11633         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
11634         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
11635         return ret_ref;
11636 }
11637 static void LDKWriteableScore_JCalls_cloned(LDKWriteableScore* new_obj) {
11638         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) new_obj->this_arg;
11639         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11640         atomic_fetch_add_explicit(&j_calls->LockableScore->refcnt, 1, memory_order_release);
11641 }
11642 static inline LDKWriteableScore LDKWriteableScore_init (JSValue o, JSValue LockableScore) {
11643         LDKWriteableScore_JCalls *calls = MALLOC(sizeof(LDKWriteableScore_JCalls), "LDKWriteableScore_JCalls");
11644         atomic_init(&calls->refcnt, 1);
11645         calls->instance_ptr = o;
11646
11647         LDKWriteableScore ret = {
11648                 .this_arg = (void*) calls,
11649                 .write = write_LDKWriteableScore_jcall,
11650                 .free = LDKWriteableScore_JCalls_free,
11651                 .LockableScore = LDKLockableScore_init(LockableScore),
11652         };
11653         calls->LockableScore = ret.LockableScore.this_arg;
11654         return ret;
11655 }
11656 uint64_t  __attribute__((export_name("TS_LDKWriteableScore_new"))) TS_LDKWriteableScore_new(JSValue o, JSValue LockableScore) {
11657         LDKWriteableScore *res_ptr = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
11658         *res_ptr = LDKWriteableScore_init(o, LockableScore);
11659         return tag_ptr(res_ptr, true);
11660 }
11661 int8_tArray  __attribute__((export_name("TS_WriteableScore_write"))) TS_WriteableScore_write(uint64_t this_arg) {
11662         void* this_arg_ptr = untag_ptr(this_arg);
11663         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11664         LDKWriteableScore* this_arg_conv = (LDKWriteableScore*)this_arg_ptr;
11665         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
11666         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
11667         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
11668         CVec_u8Z_free(ret_var);
11669         return ret_arr;
11670 }
11671
11672 typedef struct LDKPersister_JCalls {
11673         atomic_size_t refcnt;
11674         uint32_t instance_ptr;
11675 } LDKPersister_JCalls;
11676 static void LDKPersister_JCalls_free(void* this_arg) {
11677         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
11678         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11679                 FREE(j_calls);
11680         }
11681 }
11682 LDKCResult_NoneIOErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
11683         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
11684         LDKChannelManager channel_manager_var = *channel_manager;
11685         uint64_t channel_manager_ref = 0;
11686         // WARNING: we may need a move here but no clone is available for LDKChannelManager
11687         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
11688         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
11689         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 57, channel_manager_ref, 0, 0, 0, 0, 0);
11690         void* ret_ptr = untag_ptr(ret);
11691         CHECK_ACCESS(ret_ptr);
11692         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
11693         FREE(untag_ptr(ret));
11694         return ret_conv;
11695 }
11696 LDKCResult_NoneIOErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
11697         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
11698         LDKNetworkGraph network_graph_var = *network_graph;
11699         uint64_t network_graph_ref = 0;
11700         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
11701         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
11702         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
11703         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 58, network_graph_ref, 0, 0, 0, 0, 0);
11704         void* ret_ptr = untag_ptr(ret);
11705         CHECK_ACCESS(ret_ptr);
11706         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
11707         FREE(untag_ptr(ret));
11708         return ret_conv;
11709 }
11710 LDKCResult_NoneIOErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKWriteableScore * scorer) {
11711         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
11712         // WARNING: This object doesn't live past this scope, needs clone!
11713         uint64_t ret_scorer = tag_ptr(scorer, false);
11714         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 59, ret_scorer, 0, 0, 0, 0, 0);
11715         void* ret_ptr = untag_ptr(ret);
11716         CHECK_ACCESS(ret_ptr);
11717         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
11718         FREE(untag_ptr(ret));
11719         return ret_conv;
11720 }
11721 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
11722         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
11723         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11724 }
11725 static inline LDKPersister LDKPersister_init (JSValue o) {
11726         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
11727         atomic_init(&calls->refcnt, 1);
11728         calls->instance_ptr = o;
11729
11730         LDKPersister ret = {
11731                 .this_arg = (void*) calls,
11732                 .persist_manager = persist_manager_LDKPersister_jcall,
11733                 .persist_graph = persist_graph_LDKPersister_jcall,
11734                 .persist_scorer = persist_scorer_LDKPersister_jcall,
11735                 .free = LDKPersister_JCalls_free,
11736         };
11737         return ret;
11738 }
11739 uint64_t  __attribute__((export_name("TS_LDKPersister_new"))) TS_LDKPersister_new(JSValue o) {
11740         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
11741         *res_ptr = LDKPersister_init(o);
11742         return tag_ptr(res_ptr, true);
11743 }
11744 uint64_t  __attribute__((export_name("TS_Persister_persist_manager"))) TS_Persister_persist_manager(uint64_t this_arg, uint64_t channel_manager) {
11745         void* this_arg_ptr = untag_ptr(this_arg);
11746         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11747         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
11748         LDKChannelManager channel_manager_conv;
11749         channel_manager_conv.inner = untag_ptr(channel_manager);
11750         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
11751         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
11752         channel_manager_conv.is_owned = false;
11753         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
11754         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
11755         return tag_ptr(ret_conv, true);
11756 }
11757
11758 uint64_t  __attribute__((export_name("TS_Persister_persist_graph"))) TS_Persister_persist_graph(uint64_t this_arg, uint64_t network_graph) {
11759         void* this_arg_ptr = untag_ptr(this_arg);
11760         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11761         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
11762         LDKNetworkGraph network_graph_conv;
11763         network_graph_conv.inner = untag_ptr(network_graph);
11764         network_graph_conv.is_owned = ptr_is_owned(network_graph);
11765         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
11766         network_graph_conv.is_owned = false;
11767         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
11768         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
11769         return tag_ptr(ret_conv, true);
11770 }
11771
11772 uint64_t  __attribute__((export_name("TS_Persister_persist_scorer"))) TS_Persister_persist_scorer(uint64_t this_arg, uint64_t scorer) {
11773         void* this_arg_ptr = untag_ptr(this_arg);
11774         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11775         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
11776         void* scorer_ptr = untag_ptr(scorer);
11777         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
11778         LDKWriteableScore* scorer_conv = (LDKWriteableScore*)scorer_ptr;
11779         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
11780         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, scorer_conv);
11781         return tag_ptr(ret_conv, true);
11782 }
11783
11784 typedef struct LDKPersist_JCalls {
11785         atomic_size_t refcnt;
11786         uint32_t instance_ptr;
11787 } LDKPersist_JCalls;
11788 static void LDKPersist_JCalls_free(void* this_arg) {
11789         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
11790         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11791                 FREE(j_calls);
11792         }
11793 }
11794 LDKChannelMonitorUpdateStatus persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
11795         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
11796         LDKOutPoint channel_id_var = channel_id;
11797         uint64_t channel_id_ref = 0;
11798         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11799         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
11800         LDKChannelMonitor data_var = *data;
11801         uint64_t data_ref = 0;
11802         data_var = ChannelMonitor_clone(&data_var);
11803         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
11804         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
11805         LDKMonitorUpdateId update_id_var = update_id;
11806         uint64_t update_id_ref = 0;
11807         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
11808         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
11809         uint64_t ret = js_invoke_function_bbbuuu(j_calls->instance_ptr, 60, channel_id_ref, data_ref, update_id_ref, 0, 0, 0);
11810         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
11811         return ret_conv;
11812 }
11813 LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, LDKChannelMonitorUpdate update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
11814         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
11815         LDKOutPoint channel_id_var = channel_id;
11816         uint64_t channel_id_ref = 0;
11817         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11818         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
11819         LDKChannelMonitorUpdate update_var = update;
11820         uint64_t update_ref = 0;
11821         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
11822         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
11823         LDKChannelMonitor data_var = *data;
11824         uint64_t data_ref = 0;
11825         data_var = ChannelMonitor_clone(&data_var);
11826         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
11827         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
11828         LDKMonitorUpdateId update_id_var = update_id;
11829         uint64_t update_id_ref = 0;
11830         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
11831         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
11832         uint64_t ret = js_invoke_function_bbbbuu(j_calls->instance_ptr, 61, channel_id_ref, update_ref, data_ref, update_id_ref, 0, 0);
11833         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
11834         return ret_conv;
11835 }
11836 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
11837         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
11838         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11839 }
11840 static inline LDKPersist LDKPersist_init (JSValue o) {
11841         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
11842         atomic_init(&calls->refcnt, 1);
11843         calls->instance_ptr = o;
11844
11845         LDKPersist ret = {
11846                 .this_arg = (void*) calls,
11847                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
11848                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
11849                 .free = LDKPersist_JCalls_free,
11850         };
11851         return ret;
11852 }
11853 uint64_t  __attribute__((export_name("TS_LDKPersist_new"))) TS_LDKPersist_new(JSValue o) {
11854         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
11855         *res_ptr = LDKPersist_init(o);
11856         return tag_ptr(res_ptr, true);
11857 }
11858 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) {
11859         void* this_arg_ptr = untag_ptr(this_arg);
11860         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11861         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
11862         LDKOutPoint channel_id_conv;
11863         channel_id_conv.inner = untag_ptr(channel_id);
11864         channel_id_conv.is_owned = ptr_is_owned(channel_id);
11865         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
11866         channel_id_conv = OutPoint_clone(&channel_id_conv);
11867         LDKChannelMonitor data_conv;
11868         data_conv.inner = untag_ptr(data);
11869         data_conv.is_owned = ptr_is_owned(data);
11870         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
11871         data_conv.is_owned = false;
11872         LDKMonitorUpdateId update_id_conv;
11873         update_id_conv.inner = untag_ptr(update_id);
11874         update_id_conv.is_owned = ptr_is_owned(update_id);
11875         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
11876         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
11877         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));
11878         return ret_conv;
11879 }
11880
11881 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) {
11882         void* this_arg_ptr = untag_ptr(this_arg);
11883         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11884         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
11885         LDKOutPoint channel_id_conv;
11886         channel_id_conv.inner = untag_ptr(channel_id);
11887         channel_id_conv.is_owned = ptr_is_owned(channel_id);
11888         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
11889         channel_id_conv = OutPoint_clone(&channel_id_conv);
11890         LDKChannelMonitorUpdate update_conv;
11891         update_conv.inner = untag_ptr(update);
11892         update_conv.is_owned = ptr_is_owned(update);
11893         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
11894         update_conv = ChannelMonitorUpdate_clone(&update_conv);
11895         LDKChannelMonitor data_conv;
11896         data_conv.inner = untag_ptr(data);
11897         data_conv.is_owned = ptr_is_owned(data);
11898         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
11899         data_conv.is_owned = false;
11900         LDKMonitorUpdateId update_id_conv;
11901         update_id_conv.inner = untag_ptr(update_id);
11902         update_id_conv.is_owned = ptr_is_owned(update_id);
11903         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
11904         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
11905         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));
11906         return ret_conv;
11907 }
11908
11909 typedef struct LDKFutureCallback_JCalls {
11910         atomic_size_t refcnt;
11911         uint32_t instance_ptr;
11912 } LDKFutureCallback_JCalls;
11913 static void LDKFutureCallback_JCalls_free(void* this_arg) {
11914         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
11915         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11916                 FREE(j_calls);
11917         }
11918 }
11919 void call_LDKFutureCallback_jcall(const void* this_arg) {
11920         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
11921         js_invoke_function_uuuuuu(j_calls->instance_ptr, 62, 0, 0, 0, 0, 0, 0);
11922 }
11923 static void LDKFutureCallback_JCalls_cloned(LDKFutureCallback* new_obj) {
11924         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) new_obj->this_arg;
11925         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11926 }
11927 static inline LDKFutureCallback LDKFutureCallback_init (JSValue o) {
11928         LDKFutureCallback_JCalls *calls = MALLOC(sizeof(LDKFutureCallback_JCalls), "LDKFutureCallback_JCalls");
11929         atomic_init(&calls->refcnt, 1);
11930         calls->instance_ptr = o;
11931
11932         LDKFutureCallback ret = {
11933                 .this_arg = (void*) calls,
11934                 .call = call_LDKFutureCallback_jcall,
11935                 .free = LDKFutureCallback_JCalls_free,
11936         };
11937         return ret;
11938 }
11939 uint64_t  __attribute__((export_name("TS_LDKFutureCallback_new"))) TS_LDKFutureCallback_new(JSValue o) {
11940         LDKFutureCallback *res_ptr = MALLOC(sizeof(LDKFutureCallback), "LDKFutureCallback");
11941         *res_ptr = LDKFutureCallback_init(o);
11942         return tag_ptr(res_ptr, true);
11943 }
11944 void  __attribute__((export_name("TS_FutureCallback_call"))) TS_FutureCallback_call(uint64_t this_arg) {
11945         void* this_arg_ptr = untag_ptr(this_arg);
11946         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11947         LDKFutureCallback* this_arg_conv = (LDKFutureCallback*)this_arg_ptr;
11948         (this_arg_conv->call)(this_arg_conv->this_arg);
11949 }
11950
11951 typedef struct LDKListen_JCalls {
11952         atomic_size_t refcnt;
11953         uint32_t instance_ptr;
11954 } LDKListen_JCalls;
11955 static void LDKListen_JCalls_free(void* this_arg) {
11956         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
11957         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11958                 FREE(j_calls);
11959         }
11960 }
11961 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
11962         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
11963         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
11964         memcpy(header_arr->elems, *header, 80);
11965         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
11966         uint64_tArray txdata_arr = NULL;
11967         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
11968         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
11969         for (size_t c = 0; c < txdata_var.datalen; c++) {
11970                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
11971                 *txdata_conv_28_conv = txdata_var.data[c];
11972                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
11973         }
11974         
11975         FREE(txdata_var.data);
11976         int32_t height_conv = height;
11977         js_invoke_function_uuuuuu(j_calls->instance_ptr, 63, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
11978 }
11979 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
11980         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
11981         LDKu8slice block_var = block;
11982         int8_tArray block_arr = init_int8_tArray(block_var.datalen, __LINE__);
11983         memcpy(block_arr->elems, block_var.data, block_var.datalen);
11984         int32_t height_conv = height;
11985         js_invoke_function_uuuuuu(j_calls->instance_ptr, 64, (uint32_t)block_arr, height_conv, 0, 0, 0, 0);
11986 }
11987 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
11988         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
11989         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
11990         memcpy(header_arr->elems, *header, 80);
11991         int32_t height_conv = height;
11992         js_invoke_function_uuuuuu(j_calls->instance_ptr, 65, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
11993 }
11994 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
11995         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
11996         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11997 }
11998 static inline LDKListen LDKListen_init (JSValue o) {
11999         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
12000         atomic_init(&calls->refcnt, 1);
12001         calls->instance_ptr = o;
12002
12003         LDKListen ret = {
12004                 .this_arg = (void*) calls,
12005                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
12006                 .block_connected = block_connected_LDKListen_jcall,
12007                 .block_disconnected = block_disconnected_LDKListen_jcall,
12008                 .free = LDKListen_JCalls_free,
12009         };
12010         return ret;
12011 }
12012 uint64_t  __attribute__((export_name("TS_LDKListen_new"))) TS_LDKListen_new(JSValue o) {
12013         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
12014         *res_ptr = LDKListen_init(o);
12015         return tag_ptr(res_ptr, true);
12016 }
12017 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) {
12018         void* this_arg_ptr = untag_ptr(this_arg);
12019         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12020         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
12021         uint8_t header_arr[80];
12022         CHECK(header->arr_len == 80);
12023         memcpy(header_arr, header->elems, 80); FREE(header);
12024         uint8_t (*header_ref)[80] = &header_arr;
12025         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
12026         txdata_constr.datalen = txdata->arr_len;
12027         if (txdata_constr.datalen > 0)
12028                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
12029         else
12030                 txdata_constr.data = NULL;
12031         uint64_t* txdata_vals = txdata->elems;
12032         for (size_t c = 0; c < txdata_constr.datalen; c++) {
12033                 uint64_t txdata_conv_28 = txdata_vals[c];
12034                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
12035                 CHECK_ACCESS(txdata_conv_28_ptr);
12036                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
12037                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
12038                 txdata_constr.data[c] = txdata_conv_28_conv;
12039         }
12040         FREE(txdata);
12041         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
12042 }
12043
12044 void  __attribute__((export_name("TS_Listen_block_connected"))) TS_Listen_block_connected(uint64_t this_arg, int8_tArray block, int32_t height) {
12045         void* this_arg_ptr = untag_ptr(this_arg);
12046         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12047         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
12048         LDKu8slice block_ref;
12049         block_ref.datalen = block->arr_len;
12050         block_ref.data = block->elems;
12051         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
12052         FREE(block);
12053 }
12054
12055 void  __attribute__((export_name("TS_Listen_block_disconnected"))) TS_Listen_block_disconnected(uint64_t this_arg, int8_tArray header, int32_t height) {
12056         void* this_arg_ptr = untag_ptr(this_arg);
12057         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12058         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
12059         uint8_t header_arr[80];
12060         CHECK(header->arr_len == 80);
12061         memcpy(header_arr, header->elems, 80); FREE(header);
12062         uint8_t (*header_ref)[80] = &header_arr;
12063         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
12064 }
12065
12066 typedef struct LDKConfirm_JCalls {
12067         atomic_size_t refcnt;
12068         uint32_t instance_ptr;
12069 } LDKConfirm_JCalls;
12070 static void LDKConfirm_JCalls_free(void* this_arg) {
12071         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
12072         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12073                 FREE(j_calls);
12074         }
12075 }
12076 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
12077         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
12078         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
12079         memcpy(header_arr->elems, *header, 80);
12080         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
12081         uint64_tArray txdata_arr = NULL;
12082         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
12083         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
12084         for (size_t c = 0; c < txdata_var.datalen; c++) {
12085                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
12086                 *txdata_conv_28_conv = txdata_var.data[c];
12087                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
12088         }
12089         
12090         FREE(txdata_var.data);
12091         int32_t height_conv = height;
12092         js_invoke_function_uuuuuu(j_calls->instance_ptr, 66, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
12093 }
12094 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
12095         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
12096         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
12097         memcpy(txid_arr->elems, *txid, 32);
12098         js_invoke_function_uuuuuu(j_calls->instance_ptr, 67, (uint32_t)txid_arr, 0, 0, 0, 0, 0);
12099 }
12100 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
12101         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
12102         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
12103         memcpy(header_arr->elems, *header, 80);
12104         int32_t height_conv = height;
12105         js_invoke_function_uuuuuu(j_calls->instance_ptr, 68, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
12106 }
12107 LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
12108         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
12109         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 69, 0, 0, 0, 0, 0, 0);
12110         LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ ret_constr;
12111         ret_constr.datalen = ret->arr_len;
12112         if (ret_constr.datalen > 0)
12113                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ Elements");
12114         else
12115                 ret_constr.data = NULL;
12116         uint64_t* ret_vals = ret->elems;
12117         for (size_t x = 0; x < ret_constr.datalen; x++) {
12118                 uint64_t ret_conv_49 = ret_vals[x];
12119                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
12120                 CHECK_ACCESS(ret_conv_49_ptr);
12121                 LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ ret_conv_49_conv = *(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)(ret_conv_49_ptr);
12122                 FREE(untag_ptr(ret_conv_49));
12123                 ret_constr.data[x] = ret_conv_49_conv;
12124         }
12125         FREE(ret);
12126         return ret_constr;
12127 }
12128 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
12129         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
12130         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12131 }
12132 static inline LDKConfirm LDKConfirm_init (JSValue o) {
12133         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
12134         atomic_init(&calls->refcnt, 1);
12135         calls->instance_ptr = o;
12136
12137         LDKConfirm ret = {
12138                 .this_arg = (void*) calls,
12139                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
12140                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
12141                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
12142                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
12143                 .free = LDKConfirm_JCalls_free,
12144         };
12145         return ret;
12146 }
12147 uint64_t  __attribute__((export_name("TS_LDKConfirm_new"))) TS_LDKConfirm_new(JSValue o) {
12148         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
12149         *res_ptr = LDKConfirm_init(o);
12150         return tag_ptr(res_ptr, true);
12151 }
12152 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) {
12153         void* this_arg_ptr = untag_ptr(this_arg);
12154         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12155         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
12156         uint8_t header_arr[80];
12157         CHECK(header->arr_len == 80);
12158         memcpy(header_arr, header->elems, 80); FREE(header);
12159         uint8_t (*header_ref)[80] = &header_arr;
12160         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
12161         txdata_constr.datalen = txdata->arr_len;
12162         if (txdata_constr.datalen > 0)
12163                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
12164         else
12165                 txdata_constr.data = NULL;
12166         uint64_t* txdata_vals = txdata->elems;
12167         for (size_t c = 0; c < txdata_constr.datalen; c++) {
12168                 uint64_t txdata_conv_28 = txdata_vals[c];
12169                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
12170                 CHECK_ACCESS(txdata_conv_28_ptr);
12171                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
12172                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
12173                 txdata_constr.data[c] = txdata_conv_28_conv;
12174         }
12175         FREE(txdata);
12176         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
12177 }
12178
12179 void  __attribute__((export_name("TS_Confirm_transaction_unconfirmed"))) TS_Confirm_transaction_unconfirmed(uint64_t this_arg, int8_tArray txid) {
12180         void* this_arg_ptr = untag_ptr(this_arg);
12181         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12182         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
12183         uint8_t txid_arr[32];
12184         CHECK(txid->arr_len == 32);
12185         memcpy(txid_arr, txid->elems, 32); FREE(txid);
12186         uint8_t (*txid_ref)[32] = &txid_arr;
12187         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
12188 }
12189
12190 void  __attribute__((export_name("TS_Confirm_best_block_updated"))) TS_Confirm_best_block_updated(uint64_t this_arg, int8_tArray header, int32_t height) {
12191         void* this_arg_ptr = untag_ptr(this_arg);
12192         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12193         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
12194         uint8_t header_arr[80];
12195         CHECK(header->arr_len == 80);
12196         memcpy(header_arr, header->elems, 80); FREE(header);
12197         uint8_t (*header_ref)[80] = &header_arr;
12198         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
12199 }
12200
12201 uint64_tArray  __attribute__((export_name("TS_Confirm_get_relevant_txids"))) TS_Confirm_get_relevant_txids(uint64_t this_arg) {
12202         void* this_arg_ptr = untag_ptr(this_arg);
12203         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12204         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
12205         LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
12206         uint64_tArray ret_arr = NULL;
12207         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
12208         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
12209         for (size_t x = 0; x < ret_var.datalen; x++) {
12210                 LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ");
12211                 *ret_conv_49_conv = ret_var.data[x];
12212                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
12213         }
12214         
12215         FREE(ret_var.data);
12216         return ret_arr;
12217 }
12218
12219 typedef struct LDKEventHandler_JCalls {
12220         atomic_size_t refcnt;
12221         uint32_t instance_ptr;
12222 } LDKEventHandler_JCalls;
12223 static void LDKEventHandler_JCalls_free(void* this_arg) {
12224         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
12225         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12226                 FREE(j_calls);
12227         }
12228 }
12229 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
12230         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
12231         LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
12232         *event_copy = event;
12233         uint64_t event_ref = tag_ptr(event_copy, true);
12234         js_invoke_function_buuuuu(j_calls->instance_ptr, 70, event_ref, 0, 0, 0, 0, 0);
12235 }
12236 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
12237         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
12238         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12239 }
12240 static inline LDKEventHandler LDKEventHandler_init (JSValue o) {
12241         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
12242         atomic_init(&calls->refcnt, 1);
12243         calls->instance_ptr = o;
12244
12245         LDKEventHandler ret = {
12246                 .this_arg = (void*) calls,
12247                 .handle_event = handle_event_LDKEventHandler_jcall,
12248                 .free = LDKEventHandler_JCalls_free,
12249         };
12250         return ret;
12251 }
12252 uint64_t  __attribute__((export_name("TS_LDKEventHandler_new"))) TS_LDKEventHandler_new(JSValue o) {
12253         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
12254         *res_ptr = LDKEventHandler_init(o);
12255         return tag_ptr(res_ptr, true);
12256 }
12257 void  __attribute__((export_name("TS_EventHandler_handle_event"))) TS_EventHandler_handle_event(uint64_t this_arg, uint64_t event) {
12258         void* this_arg_ptr = untag_ptr(this_arg);
12259         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12260         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
12261         void* event_ptr = untag_ptr(event);
12262         CHECK_ACCESS(event_ptr);
12263         LDKEvent event_conv = *(LDKEvent*)(event_ptr);
12264         event_conv = Event_clone((LDKEvent*)untag_ptr(event));
12265         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
12266 }
12267
12268 typedef struct LDKEventsProvider_JCalls {
12269         atomic_size_t refcnt;
12270         uint32_t instance_ptr;
12271 } LDKEventsProvider_JCalls;
12272 static void LDKEventsProvider_JCalls_free(void* this_arg) {
12273         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
12274         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12275                 FREE(j_calls);
12276         }
12277 }
12278 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
12279         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
12280         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
12281         *handler_ret = handler;
12282         js_invoke_function_buuuuu(j_calls->instance_ptr, 71, tag_ptr(handler_ret, true), 0, 0, 0, 0, 0);
12283 }
12284 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
12285         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
12286         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12287 }
12288 static inline LDKEventsProvider LDKEventsProvider_init (JSValue o) {
12289         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
12290         atomic_init(&calls->refcnt, 1);
12291         calls->instance_ptr = o;
12292
12293         LDKEventsProvider ret = {
12294                 .this_arg = (void*) calls,
12295                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
12296                 .free = LDKEventsProvider_JCalls_free,
12297         };
12298         return ret;
12299 }
12300 uint64_t  __attribute__((export_name("TS_LDKEventsProvider_new"))) TS_LDKEventsProvider_new(JSValue o) {
12301         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
12302         *res_ptr = LDKEventsProvider_init(o);
12303         return tag_ptr(res_ptr, true);
12304 }
12305 void  __attribute__((export_name("TS_EventsProvider_process_pending_events"))) TS_EventsProvider_process_pending_events(uint64_t this_arg, uint64_t handler) {
12306         void* this_arg_ptr = untag_ptr(this_arg);
12307         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12308         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
12309         void* handler_ptr = untag_ptr(handler);
12310         CHECK_ACCESS(handler_ptr);
12311         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
12312         if (handler_conv.free == LDKEventHandler_JCalls_free) {
12313                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12314                 LDKEventHandler_JCalls_cloned(&handler_conv);
12315         }
12316         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
12317 }
12318
12319 uint32_t __attribute__((export_name("TS_LDKFailureCode_ty_from_ptr"))) TS_LDKFailureCode_ty_from_ptr(uint64_t ptr) {
12320         LDKFailureCode *obj = (LDKFailureCode*)untag_ptr(ptr);
12321         switch(obj->tag) {
12322                 case LDKFailureCode_TemporaryNodeFailure: return 0;
12323                 case LDKFailureCode_RequiredNodeFeatureMissing: return 1;
12324                 case LDKFailureCode_IncorrectOrUnknownPaymentDetails: return 2;
12325                 case LDKFailureCode_InvalidOnionPayload: return 3;
12326                 default: abort();
12327         }
12328 }
12329 uint64_t __attribute__((export_name("TS_LDKFailureCode_InvalidOnionPayload_get_invalid_onion_payload"))) TS_LDKFailureCode_InvalidOnionPayload_get_invalid_onion_payload(uint64_t ptr) {
12330         LDKFailureCode *obj = (LDKFailureCode*)untag_ptr(ptr);
12331         assert(obj->tag == LDKFailureCode_InvalidOnionPayload);
12332                         uint64_t invalid_onion_payload_ref = tag_ptr(&obj->invalid_onion_payload, false);
12333         return invalid_onion_payload_ref;
12334 }
12335 typedef struct LDKMessageSendEventsProvider_JCalls {
12336         atomic_size_t refcnt;
12337         uint32_t instance_ptr;
12338 } LDKMessageSendEventsProvider_JCalls;
12339 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
12340         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
12341         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12342                 FREE(j_calls);
12343         }
12344 }
12345 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
12346         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
12347         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 72, 0, 0, 0, 0, 0, 0);
12348         LDKCVec_MessageSendEventZ ret_constr;
12349         ret_constr.datalen = ret->arr_len;
12350         if (ret_constr.datalen > 0)
12351                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
12352         else
12353                 ret_constr.data = NULL;
12354         uint64_t* ret_vals = ret->elems;
12355         for (size_t s = 0; s < ret_constr.datalen; s++) {
12356                 uint64_t ret_conv_18 = ret_vals[s];
12357                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
12358                 CHECK_ACCESS(ret_conv_18_ptr);
12359                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
12360                 FREE(untag_ptr(ret_conv_18));
12361                 ret_constr.data[s] = ret_conv_18_conv;
12362         }
12363         FREE(ret);
12364         return ret_constr;
12365 }
12366 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
12367         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
12368         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12369 }
12370 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JSValue o) {
12371         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
12372         atomic_init(&calls->refcnt, 1);
12373         calls->instance_ptr = o;
12374
12375         LDKMessageSendEventsProvider ret = {
12376                 .this_arg = (void*) calls,
12377                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
12378                 .free = LDKMessageSendEventsProvider_JCalls_free,
12379         };
12380         return ret;
12381 }
12382 uint64_t  __attribute__((export_name("TS_LDKMessageSendEventsProvider_new"))) TS_LDKMessageSendEventsProvider_new(JSValue o) {
12383         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
12384         *res_ptr = LDKMessageSendEventsProvider_init(o);
12385         return tag_ptr(res_ptr, true);
12386 }
12387 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) {
12388         void* this_arg_ptr = untag_ptr(this_arg);
12389         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12390         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
12391         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
12392         uint64_tArray ret_arr = NULL;
12393         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
12394         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
12395         for (size_t s = 0; s < ret_var.datalen; s++) {
12396                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12397                 *ret_conv_18_copy = ret_var.data[s];
12398                 uint64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
12399                 ret_arr_ptr[s] = ret_conv_18_ref;
12400         }
12401         
12402         FREE(ret_var.data);
12403         return ret_arr;
12404 }
12405
12406 typedef struct LDKChannelMessageHandler_JCalls {
12407         atomic_size_t refcnt;
12408         uint32_t instance_ptr;
12409         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
12410 } LDKChannelMessageHandler_JCalls;
12411 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
12412         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12413         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12414                 FREE(j_calls);
12415         }
12416 }
12417 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannel * msg) {
12418         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12419         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12420         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12421         LDKOpenChannel msg_var = *msg;
12422         uint64_t msg_ref = 0;
12423         msg_var = OpenChannel_clone(&msg_var);
12424         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12425         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12426         js_invoke_function_ubuuuu(j_calls->instance_ptr, 73, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12427 }
12428 void handle_open_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannelV2 * msg) {
12429         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12430         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12431         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12432         LDKOpenChannelV2 msg_var = *msg;
12433         uint64_t msg_ref = 0;
12434         msg_var = OpenChannelV2_clone(&msg_var);
12435         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12436         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12437         js_invoke_function_ubuuuu(j_calls->instance_ptr, 74, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12438 }
12439 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannel * msg) {
12440         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12441         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12442         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12443         LDKAcceptChannel msg_var = *msg;
12444         uint64_t msg_ref = 0;
12445         msg_var = AcceptChannel_clone(&msg_var);
12446         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12447         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12448         js_invoke_function_ubuuuu(j_calls->instance_ptr, 75, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12449 }
12450 void handle_accept_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannelV2 * msg) {
12451         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12452         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12453         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12454         LDKAcceptChannelV2 msg_var = *msg;
12455         uint64_t msg_ref = 0;
12456         msg_var = AcceptChannelV2_clone(&msg_var);
12457         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12458         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12459         js_invoke_function_ubuuuu(j_calls->instance_ptr, 76, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12460 }
12461 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
12462         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12463         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12464         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12465         LDKFundingCreated msg_var = *msg;
12466         uint64_t msg_ref = 0;
12467         msg_var = FundingCreated_clone(&msg_var);
12468         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12469         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12470         js_invoke_function_ubuuuu(j_calls->instance_ptr, 77, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12471 }
12472 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
12473         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12474         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12475         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12476         LDKFundingSigned msg_var = *msg;
12477         uint64_t msg_ref = 0;
12478         msg_var = FundingSigned_clone(&msg_var);
12479         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12480         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12481         js_invoke_function_ubuuuu(j_calls->instance_ptr, 78, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12482 }
12483 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
12484         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12485         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12486         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12487         LDKChannelReady msg_var = *msg;
12488         uint64_t msg_ref = 0;
12489         msg_var = ChannelReady_clone(&msg_var);
12490         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12491         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12492         js_invoke_function_ubuuuu(j_calls->instance_ptr, 79, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12493 }
12494 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) {
12495         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12496         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12497         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12498         LDKShutdown msg_var = *msg;
12499         uint64_t msg_ref = 0;
12500         msg_var = Shutdown_clone(&msg_var);
12501         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12502         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12503         js_invoke_function_ubuuuu(j_calls->instance_ptr, 80, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12504 }
12505 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
12506         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12507         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12508         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12509         LDKClosingSigned msg_var = *msg;
12510         uint64_t msg_ref = 0;
12511         msg_var = ClosingSigned_clone(&msg_var);
12512         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12513         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12514         js_invoke_function_ubuuuu(j_calls->instance_ptr, 81, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12515 }
12516 void handle_tx_add_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddInput * msg) {
12517         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12518         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12519         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12520         LDKTxAddInput msg_var = *msg;
12521         uint64_t msg_ref = 0;
12522         msg_var = TxAddInput_clone(&msg_var);
12523         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12524         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12525         js_invoke_function_ubuuuu(j_calls->instance_ptr, 82, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12526 }
12527 void handle_tx_add_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddOutput * msg) {
12528         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12529         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12530         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12531         LDKTxAddOutput msg_var = *msg;
12532         uint64_t msg_ref = 0;
12533         msg_var = TxAddOutput_clone(&msg_var);
12534         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12535         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12536         js_invoke_function_ubuuuu(j_calls->instance_ptr, 83, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12537 }
12538 void handle_tx_remove_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveInput * msg) {
12539         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12540         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12541         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12542         LDKTxRemoveInput msg_var = *msg;
12543         uint64_t msg_ref = 0;
12544         msg_var = TxRemoveInput_clone(&msg_var);
12545         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12546         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12547         js_invoke_function_ubuuuu(j_calls->instance_ptr, 84, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12548 }
12549 void handle_tx_remove_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveOutput * msg) {
12550         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12551         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12552         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12553         LDKTxRemoveOutput msg_var = *msg;
12554         uint64_t msg_ref = 0;
12555         msg_var = TxRemoveOutput_clone(&msg_var);
12556         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12557         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12558         js_invoke_function_ubuuuu(j_calls->instance_ptr, 85, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12559 }
12560 void handle_tx_complete_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxComplete * msg) {
12561         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12562         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12563         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12564         LDKTxComplete msg_var = *msg;
12565         uint64_t msg_ref = 0;
12566         msg_var = TxComplete_clone(&msg_var);
12567         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12568         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12569         js_invoke_function_ubuuuu(j_calls->instance_ptr, 86, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12570 }
12571 void handle_tx_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxSignatures * msg) {
12572         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12573         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12574         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12575         LDKTxSignatures msg_var = *msg;
12576         uint64_t msg_ref = 0;
12577         msg_var = TxSignatures_clone(&msg_var);
12578         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12579         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12580         js_invoke_function_ubuuuu(j_calls->instance_ptr, 87, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12581 }
12582 void handle_tx_init_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxInitRbf * msg) {
12583         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12584         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12585         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12586         LDKTxInitRbf msg_var = *msg;
12587         uint64_t msg_ref = 0;
12588         msg_var = TxInitRbf_clone(&msg_var);
12589         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12590         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12591         js_invoke_function_ubuuuu(j_calls->instance_ptr, 88, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12592 }
12593 void handle_tx_ack_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAckRbf * msg) {
12594         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12595         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12596         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12597         LDKTxAckRbf msg_var = *msg;
12598         uint64_t msg_ref = 0;
12599         msg_var = TxAckRbf_clone(&msg_var);
12600         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12601         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12602         js_invoke_function_ubuuuu(j_calls->instance_ptr, 89, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12603 }
12604 void handle_tx_abort_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAbort * msg) {
12605         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12606         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12607         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12608         LDKTxAbort msg_var = *msg;
12609         uint64_t msg_ref = 0;
12610         msg_var = TxAbort_clone(&msg_var);
12611         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12612         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12613         js_invoke_function_ubuuuu(j_calls->instance_ptr, 90, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12614 }
12615 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
12616         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12617         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12618         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12619         LDKUpdateAddHTLC msg_var = *msg;
12620         uint64_t msg_ref = 0;
12621         msg_var = UpdateAddHTLC_clone(&msg_var);
12622         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12623         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12624         js_invoke_function_ubuuuu(j_calls->instance_ptr, 91, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12625 }
12626 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
12627         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12628         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12629         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12630         LDKUpdateFulfillHTLC msg_var = *msg;
12631         uint64_t msg_ref = 0;
12632         msg_var = UpdateFulfillHTLC_clone(&msg_var);
12633         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12634         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12635         js_invoke_function_ubuuuu(j_calls->instance_ptr, 92, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12636 }
12637 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
12638         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12639         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12640         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12641         LDKUpdateFailHTLC msg_var = *msg;
12642         uint64_t msg_ref = 0;
12643         msg_var = UpdateFailHTLC_clone(&msg_var);
12644         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12645         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12646         js_invoke_function_ubuuuu(j_calls->instance_ptr, 93, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12647 }
12648 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
12649         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12650         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12651         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12652         LDKUpdateFailMalformedHTLC msg_var = *msg;
12653         uint64_t msg_ref = 0;
12654         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
12655         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12656         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12657         js_invoke_function_ubuuuu(j_calls->instance_ptr, 94, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12658 }
12659 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
12660         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12661         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12662         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12663         LDKCommitmentSigned msg_var = *msg;
12664         uint64_t msg_ref = 0;
12665         msg_var = CommitmentSigned_clone(&msg_var);
12666         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12667         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12668         js_invoke_function_ubuuuu(j_calls->instance_ptr, 95, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12669 }
12670 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
12671         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12672         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12673         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12674         LDKRevokeAndACK msg_var = *msg;
12675         uint64_t msg_ref = 0;
12676         msg_var = RevokeAndACK_clone(&msg_var);
12677         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12678         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12679         js_invoke_function_ubuuuu(j_calls->instance_ptr, 96, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12680 }
12681 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
12682         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12683         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12684         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12685         LDKUpdateFee msg_var = *msg;
12686         uint64_t msg_ref = 0;
12687         msg_var = UpdateFee_clone(&msg_var);
12688         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12689         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12690         js_invoke_function_ubuuuu(j_calls->instance_ptr, 97, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12691 }
12692 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
12693         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12694         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12695         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12696         LDKAnnouncementSignatures msg_var = *msg;
12697         uint64_t msg_ref = 0;
12698         msg_var = AnnouncementSignatures_clone(&msg_var);
12699         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12700         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12701         js_invoke_function_ubuuuu(j_calls->instance_ptr, 98, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12702 }
12703 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
12704         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12705         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12706         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12707         js_invoke_function_uuuuuu(j_calls->instance_ptr, 99, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
12708 }
12709 LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg, bool inbound) {
12710         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12711         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12712         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12713         LDKInit msg_var = *msg;
12714         uint64_t msg_ref = 0;
12715         msg_var = Init_clone(&msg_var);
12716         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12717         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12718         jboolean inbound_conv = inbound;
12719         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);
12720         void* ret_ptr = untag_ptr(ret);
12721         CHECK_ACCESS(ret_ptr);
12722         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
12723         FREE(untag_ptr(ret));
12724         return ret_conv;
12725 }
12726 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
12727         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12728         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12729         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12730         LDKChannelReestablish msg_var = *msg;
12731         uint64_t msg_ref = 0;
12732         msg_var = ChannelReestablish_clone(&msg_var);
12733         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12734         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12735         js_invoke_function_ubuuuu(j_calls->instance_ptr, 101, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12736 }
12737 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
12738         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12739         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12740         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12741         LDKChannelUpdate msg_var = *msg;
12742         uint64_t msg_ref = 0;
12743         msg_var = ChannelUpdate_clone(&msg_var);
12744         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12745         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12746         js_invoke_function_ubuuuu(j_calls->instance_ptr, 102, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12747 }
12748 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
12749         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12750         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12751         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12752         LDKErrorMessage msg_var = *msg;
12753         uint64_t msg_ref = 0;
12754         msg_var = ErrorMessage_clone(&msg_var);
12755         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12756         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12757         js_invoke_function_ubuuuu(j_calls->instance_ptr, 103, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12758 }
12759 LDKNodeFeatures provided_node_features_LDKChannelMessageHandler_jcall(const void* this_arg) {
12760         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12761         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 104, 0, 0, 0, 0, 0, 0);
12762         LDKNodeFeatures ret_conv;
12763         ret_conv.inner = untag_ptr(ret);
12764         ret_conv.is_owned = ptr_is_owned(ret);
12765         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
12766         return ret_conv;
12767 }
12768 LDKInitFeatures provided_init_features_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
12769         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12770         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12771         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12772         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 105, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
12773         LDKInitFeatures ret_conv;
12774         ret_conv.inner = untag_ptr(ret);
12775         ret_conv.is_owned = ptr_is_owned(ret);
12776         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
12777         return ret_conv;
12778 }
12779 LDKCOption_CVec_ThirtyTwoBytesZZ get_genesis_hashes_LDKChannelMessageHandler_jcall(const void* this_arg) {
12780         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12781         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 106, 0, 0, 0, 0, 0, 0);
12782         void* ret_ptr = untag_ptr(ret);
12783         CHECK_ACCESS(ret_ptr);
12784         LDKCOption_CVec_ThirtyTwoBytesZZ ret_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(ret_ptr);
12785         FREE(untag_ptr(ret));
12786         return ret_conv;
12787 }
12788 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
12789         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
12790         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12791         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
12792 }
12793 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
12794         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
12795         atomic_init(&calls->refcnt, 1);
12796         calls->instance_ptr = o;
12797
12798         LDKChannelMessageHandler ret = {
12799                 .this_arg = (void*) calls,
12800                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
12801                 .handle_open_channel_v2 = handle_open_channel_v2_LDKChannelMessageHandler_jcall,
12802                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
12803                 .handle_accept_channel_v2 = handle_accept_channel_v2_LDKChannelMessageHandler_jcall,
12804                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
12805                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
12806                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
12807                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
12808                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
12809                 .handle_tx_add_input = handle_tx_add_input_LDKChannelMessageHandler_jcall,
12810                 .handle_tx_add_output = handle_tx_add_output_LDKChannelMessageHandler_jcall,
12811                 .handle_tx_remove_input = handle_tx_remove_input_LDKChannelMessageHandler_jcall,
12812                 .handle_tx_remove_output = handle_tx_remove_output_LDKChannelMessageHandler_jcall,
12813                 .handle_tx_complete = handle_tx_complete_LDKChannelMessageHandler_jcall,
12814                 .handle_tx_signatures = handle_tx_signatures_LDKChannelMessageHandler_jcall,
12815                 .handle_tx_init_rbf = handle_tx_init_rbf_LDKChannelMessageHandler_jcall,
12816                 .handle_tx_ack_rbf = handle_tx_ack_rbf_LDKChannelMessageHandler_jcall,
12817                 .handle_tx_abort = handle_tx_abort_LDKChannelMessageHandler_jcall,
12818                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
12819                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
12820                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
12821                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
12822                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
12823                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
12824                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
12825                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
12826                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
12827                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
12828                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
12829                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
12830                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
12831                 .provided_node_features = provided_node_features_LDKChannelMessageHandler_jcall,
12832                 .provided_init_features = provided_init_features_LDKChannelMessageHandler_jcall,
12833                 .get_genesis_hashes = get_genesis_hashes_LDKChannelMessageHandler_jcall,
12834                 .free = LDKChannelMessageHandler_JCalls_free,
12835                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
12836         };
12837         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
12838         return ret;
12839 }
12840 uint64_t  __attribute__((export_name("TS_LDKChannelMessageHandler_new"))) TS_LDKChannelMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
12841         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
12842         *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
12843         return tag_ptr(res_ptr, true);
12844 }
12845 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) {
12846         void* this_arg_ptr = untag_ptr(this_arg);
12847         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12848         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12849         LDKPublicKey their_node_id_ref;
12850         CHECK(their_node_id->arr_len == 33);
12851         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12852         LDKOpenChannel msg_conv;
12853         msg_conv.inner = untag_ptr(msg);
12854         msg_conv.is_owned = ptr_is_owned(msg);
12855         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12856         msg_conv.is_owned = false;
12857         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12858 }
12859
12860 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) {
12861         void* this_arg_ptr = untag_ptr(this_arg);
12862         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12863         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12864         LDKPublicKey their_node_id_ref;
12865         CHECK(their_node_id->arr_len == 33);
12866         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12867         LDKOpenChannelV2 msg_conv;
12868         msg_conv.inner = untag_ptr(msg);
12869         msg_conv.is_owned = ptr_is_owned(msg);
12870         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12871         msg_conv.is_owned = false;
12872         (this_arg_conv->handle_open_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12873 }
12874
12875 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) {
12876         void* this_arg_ptr = untag_ptr(this_arg);
12877         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12878         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12879         LDKPublicKey their_node_id_ref;
12880         CHECK(their_node_id->arr_len == 33);
12881         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12882         LDKAcceptChannel msg_conv;
12883         msg_conv.inner = untag_ptr(msg);
12884         msg_conv.is_owned = ptr_is_owned(msg);
12885         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12886         msg_conv.is_owned = false;
12887         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12888 }
12889
12890 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) {
12891         void* this_arg_ptr = untag_ptr(this_arg);
12892         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12893         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12894         LDKPublicKey their_node_id_ref;
12895         CHECK(their_node_id->arr_len == 33);
12896         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12897         LDKAcceptChannelV2 msg_conv;
12898         msg_conv.inner = untag_ptr(msg);
12899         msg_conv.is_owned = ptr_is_owned(msg);
12900         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12901         msg_conv.is_owned = false;
12902         (this_arg_conv->handle_accept_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12903 }
12904
12905 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) {
12906         void* this_arg_ptr = untag_ptr(this_arg);
12907         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12908         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12909         LDKPublicKey their_node_id_ref;
12910         CHECK(their_node_id->arr_len == 33);
12911         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12912         LDKFundingCreated msg_conv;
12913         msg_conv.inner = untag_ptr(msg);
12914         msg_conv.is_owned = ptr_is_owned(msg);
12915         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12916         msg_conv.is_owned = false;
12917         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12918 }
12919
12920 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) {
12921         void* this_arg_ptr = untag_ptr(this_arg);
12922         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12923         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12924         LDKPublicKey their_node_id_ref;
12925         CHECK(their_node_id->arr_len == 33);
12926         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12927         LDKFundingSigned msg_conv;
12928         msg_conv.inner = untag_ptr(msg);
12929         msg_conv.is_owned = ptr_is_owned(msg);
12930         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12931         msg_conv.is_owned = false;
12932         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12933 }
12934
12935 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) {
12936         void* this_arg_ptr = untag_ptr(this_arg);
12937         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12938         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12939         LDKPublicKey their_node_id_ref;
12940         CHECK(their_node_id->arr_len == 33);
12941         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12942         LDKChannelReady msg_conv;
12943         msg_conv.inner = untag_ptr(msg);
12944         msg_conv.is_owned = ptr_is_owned(msg);
12945         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12946         msg_conv.is_owned = false;
12947         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12948 }
12949
12950 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_shutdown"))) TS_ChannelMessageHandler_handle_shutdown(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
12951         void* this_arg_ptr = untag_ptr(this_arg);
12952         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12953         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12954         LDKPublicKey their_node_id_ref;
12955         CHECK(their_node_id->arr_len == 33);
12956         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12957         LDKShutdown msg_conv;
12958         msg_conv.inner = untag_ptr(msg);
12959         msg_conv.is_owned = ptr_is_owned(msg);
12960         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12961         msg_conv.is_owned = false;
12962         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12963 }
12964
12965 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) {
12966         void* this_arg_ptr = untag_ptr(this_arg);
12967         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12968         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12969         LDKPublicKey their_node_id_ref;
12970         CHECK(their_node_id->arr_len == 33);
12971         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12972         LDKClosingSigned msg_conv;
12973         msg_conv.inner = untag_ptr(msg);
12974         msg_conv.is_owned = ptr_is_owned(msg);
12975         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12976         msg_conv.is_owned = false;
12977         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12978 }
12979
12980 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) {
12981         void* this_arg_ptr = untag_ptr(this_arg);
12982         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12983         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12984         LDKPublicKey their_node_id_ref;
12985         CHECK(their_node_id->arr_len == 33);
12986         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12987         LDKTxAddInput msg_conv;
12988         msg_conv.inner = untag_ptr(msg);
12989         msg_conv.is_owned = ptr_is_owned(msg);
12990         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12991         msg_conv.is_owned = false;
12992         (this_arg_conv->handle_tx_add_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12993 }
12994
12995 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) {
12996         void* this_arg_ptr = untag_ptr(this_arg);
12997         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12998         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12999         LDKPublicKey their_node_id_ref;
13000         CHECK(their_node_id->arr_len == 33);
13001         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13002         LDKTxAddOutput msg_conv;
13003         msg_conv.inner = untag_ptr(msg);
13004         msg_conv.is_owned = ptr_is_owned(msg);
13005         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13006         msg_conv.is_owned = false;
13007         (this_arg_conv->handle_tx_add_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13008 }
13009
13010 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) {
13011         void* this_arg_ptr = untag_ptr(this_arg);
13012         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13013         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13014         LDKPublicKey their_node_id_ref;
13015         CHECK(their_node_id->arr_len == 33);
13016         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13017         LDKTxRemoveInput msg_conv;
13018         msg_conv.inner = untag_ptr(msg);
13019         msg_conv.is_owned = ptr_is_owned(msg);
13020         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13021         msg_conv.is_owned = false;
13022         (this_arg_conv->handle_tx_remove_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13023 }
13024
13025 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) {
13026         void* this_arg_ptr = untag_ptr(this_arg);
13027         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13028         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13029         LDKPublicKey their_node_id_ref;
13030         CHECK(their_node_id->arr_len == 33);
13031         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13032         LDKTxRemoveOutput msg_conv;
13033         msg_conv.inner = untag_ptr(msg);
13034         msg_conv.is_owned = ptr_is_owned(msg);
13035         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13036         msg_conv.is_owned = false;
13037         (this_arg_conv->handle_tx_remove_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13038 }
13039
13040 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) {
13041         void* this_arg_ptr = untag_ptr(this_arg);
13042         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13043         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13044         LDKPublicKey their_node_id_ref;
13045         CHECK(their_node_id->arr_len == 33);
13046         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13047         LDKTxComplete msg_conv;
13048         msg_conv.inner = untag_ptr(msg);
13049         msg_conv.is_owned = ptr_is_owned(msg);
13050         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13051         msg_conv.is_owned = false;
13052         (this_arg_conv->handle_tx_complete)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13053 }
13054
13055 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) {
13056         void* this_arg_ptr = untag_ptr(this_arg);
13057         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13058         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13059         LDKPublicKey their_node_id_ref;
13060         CHECK(their_node_id->arr_len == 33);
13061         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13062         LDKTxSignatures msg_conv;
13063         msg_conv.inner = untag_ptr(msg);
13064         msg_conv.is_owned = ptr_is_owned(msg);
13065         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13066         msg_conv.is_owned = false;
13067         (this_arg_conv->handle_tx_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13068 }
13069
13070 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) {
13071         void* this_arg_ptr = untag_ptr(this_arg);
13072         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13073         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13074         LDKPublicKey their_node_id_ref;
13075         CHECK(their_node_id->arr_len == 33);
13076         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13077         LDKTxInitRbf msg_conv;
13078         msg_conv.inner = untag_ptr(msg);
13079         msg_conv.is_owned = ptr_is_owned(msg);
13080         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13081         msg_conv.is_owned = false;
13082         (this_arg_conv->handle_tx_init_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13083 }
13084
13085 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) {
13086         void* this_arg_ptr = untag_ptr(this_arg);
13087         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13088         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13089         LDKPublicKey their_node_id_ref;
13090         CHECK(their_node_id->arr_len == 33);
13091         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13092         LDKTxAckRbf msg_conv;
13093         msg_conv.inner = untag_ptr(msg);
13094         msg_conv.is_owned = ptr_is_owned(msg);
13095         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13096         msg_conv.is_owned = false;
13097         (this_arg_conv->handle_tx_ack_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13098 }
13099
13100 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) {
13101         void* this_arg_ptr = untag_ptr(this_arg);
13102         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13103         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13104         LDKPublicKey their_node_id_ref;
13105         CHECK(their_node_id->arr_len == 33);
13106         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13107         LDKTxAbort msg_conv;
13108         msg_conv.inner = untag_ptr(msg);
13109         msg_conv.is_owned = ptr_is_owned(msg);
13110         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13111         msg_conv.is_owned = false;
13112         (this_arg_conv->handle_tx_abort)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13113 }
13114
13115 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) {
13116         void* this_arg_ptr = untag_ptr(this_arg);
13117         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13118         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13119         LDKPublicKey their_node_id_ref;
13120         CHECK(their_node_id->arr_len == 33);
13121         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13122         LDKUpdateAddHTLC msg_conv;
13123         msg_conv.inner = untag_ptr(msg);
13124         msg_conv.is_owned = ptr_is_owned(msg);
13125         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13126         msg_conv.is_owned = false;
13127         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13128 }
13129
13130 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) {
13131         void* this_arg_ptr = untag_ptr(this_arg);
13132         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13133         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13134         LDKPublicKey their_node_id_ref;
13135         CHECK(their_node_id->arr_len == 33);
13136         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13137         LDKUpdateFulfillHTLC msg_conv;
13138         msg_conv.inner = untag_ptr(msg);
13139         msg_conv.is_owned = ptr_is_owned(msg);
13140         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13141         msg_conv.is_owned = false;
13142         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13143 }
13144
13145 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) {
13146         void* this_arg_ptr = untag_ptr(this_arg);
13147         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13148         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13149         LDKPublicKey their_node_id_ref;
13150         CHECK(their_node_id->arr_len == 33);
13151         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13152         LDKUpdateFailHTLC msg_conv;
13153         msg_conv.inner = untag_ptr(msg);
13154         msg_conv.is_owned = ptr_is_owned(msg);
13155         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13156         msg_conv.is_owned = false;
13157         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13158 }
13159
13160 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) {
13161         void* this_arg_ptr = untag_ptr(this_arg);
13162         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13163         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13164         LDKPublicKey their_node_id_ref;
13165         CHECK(their_node_id->arr_len == 33);
13166         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13167         LDKUpdateFailMalformedHTLC msg_conv;
13168         msg_conv.inner = untag_ptr(msg);
13169         msg_conv.is_owned = ptr_is_owned(msg);
13170         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13171         msg_conv.is_owned = false;
13172         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13173 }
13174
13175 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) {
13176         void* this_arg_ptr = untag_ptr(this_arg);
13177         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13178         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13179         LDKPublicKey their_node_id_ref;
13180         CHECK(their_node_id->arr_len == 33);
13181         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13182         LDKCommitmentSigned msg_conv;
13183         msg_conv.inner = untag_ptr(msg);
13184         msg_conv.is_owned = ptr_is_owned(msg);
13185         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13186         msg_conv.is_owned = false;
13187         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13188 }
13189
13190 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) {
13191         void* this_arg_ptr = untag_ptr(this_arg);
13192         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13193         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13194         LDKPublicKey their_node_id_ref;
13195         CHECK(their_node_id->arr_len == 33);
13196         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13197         LDKRevokeAndACK msg_conv;
13198         msg_conv.inner = untag_ptr(msg);
13199         msg_conv.is_owned = ptr_is_owned(msg);
13200         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13201         msg_conv.is_owned = false;
13202         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13203 }
13204
13205 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) {
13206         void* this_arg_ptr = untag_ptr(this_arg);
13207         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13208         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13209         LDKPublicKey their_node_id_ref;
13210         CHECK(their_node_id->arr_len == 33);
13211         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13212         LDKUpdateFee msg_conv;
13213         msg_conv.inner = untag_ptr(msg);
13214         msg_conv.is_owned = ptr_is_owned(msg);
13215         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13216         msg_conv.is_owned = false;
13217         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13218 }
13219
13220 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) {
13221         void* this_arg_ptr = untag_ptr(this_arg);
13222         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13223         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13224         LDKPublicKey their_node_id_ref;
13225         CHECK(their_node_id->arr_len == 33);
13226         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13227         LDKAnnouncementSignatures msg_conv;
13228         msg_conv.inner = untag_ptr(msg);
13229         msg_conv.is_owned = ptr_is_owned(msg);
13230         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13231         msg_conv.is_owned = false;
13232         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13233 }
13234
13235 void  __attribute__((export_name("TS_ChannelMessageHandler_peer_disconnected"))) TS_ChannelMessageHandler_peer_disconnected(uint64_t this_arg, int8_tArray their_node_id) {
13236         void* this_arg_ptr = untag_ptr(this_arg);
13237         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13238         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13239         LDKPublicKey their_node_id_ref;
13240         CHECK(their_node_id->arr_len == 33);
13241         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13242         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
13243 }
13244
13245 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) {
13246         void* this_arg_ptr = untag_ptr(this_arg);
13247         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13248         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13249         LDKPublicKey their_node_id_ref;
13250         CHECK(their_node_id->arr_len == 33);
13251         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13252         LDKInit msg_conv;
13253         msg_conv.inner = untag_ptr(msg);
13254         msg_conv.is_owned = ptr_is_owned(msg);
13255         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13256         msg_conv.is_owned = false;
13257         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
13258         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv, inbound);
13259         return tag_ptr(ret_conv, true);
13260 }
13261
13262 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) {
13263         void* this_arg_ptr = untag_ptr(this_arg);
13264         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13265         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13266         LDKPublicKey their_node_id_ref;
13267         CHECK(their_node_id->arr_len == 33);
13268         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13269         LDKChannelReestablish msg_conv;
13270         msg_conv.inner = untag_ptr(msg);
13271         msg_conv.is_owned = ptr_is_owned(msg);
13272         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13273         msg_conv.is_owned = false;
13274         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13275 }
13276
13277 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) {
13278         void* this_arg_ptr = untag_ptr(this_arg);
13279         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13280         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13281         LDKPublicKey their_node_id_ref;
13282         CHECK(their_node_id->arr_len == 33);
13283         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13284         LDKChannelUpdate msg_conv;
13285         msg_conv.inner = untag_ptr(msg);
13286         msg_conv.is_owned = ptr_is_owned(msg);
13287         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13288         msg_conv.is_owned = false;
13289         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13290 }
13291
13292 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_error"))) TS_ChannelMessageHandler_handle_error(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
13293         void* this_arg_ptr = untag_ptr(this_arg);
13294         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13295         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13296         LDKPublicKey their_node_id_ref;
13297         CHECK(their_node_id->arr_len == 33);
13298         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13299         LDKErrorMessage msg_conv;
13300         msg_conv.inner = untag_ptr(msg);
13301         msg_conv.is_owned = ptr_is_owned(msg);
13302         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13303         msg_conv.is_owned = false;
13304         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13305 }
13306
13307 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_node_features"))) TS_ChannelMessageHandler_provided_node_features(uint64_t this_arg) {
13308         void* this_arg_ptr = untag_ptr(this_arg);
13309         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13310         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13311         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
13312         uint64_t ret_ref = 0;
13313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13314         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13315         return ret_ref;
13316 }
13317
13318 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_init_features"))) TS_ChannelMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
13319         void* this_arg_ptr = untag_ptr(this_arg);
13320         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13321         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13322         LDKPublicKey their_node_id_ref;
13323         CHECK(their_node_id->arr_len == 33);
13324         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13325         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
13326         uint64_t ret_ref = 0;
13327         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13328         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13329         return ret_ref;
13330 }
13331
13332 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_get_genesis_hashes"))) TS_ChannelMessageHandler_get_genesis_hashes(uint64_t this_arg) {
13333         void* this_arg_ptr = untag_ptr(this_arg);
13334         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13335         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13336         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
13337         *ret_copy = (this_arg_conv->get_genesis_hashes)(this_arg_conv->this_arg);
13338         uint64_t ret_ref = tag_ptr(ret_copy, true);
13339         return ret_ref;
13340 }
13341
13342 typedef struct LDKRoutingMessageHandler_JCalls {
13343         atomic_size_t refcnt;
13344         uint32_t instance_ptr;
13345         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
13346 } LDKRoutingMessageHandler_JCalls;
13347 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
13348         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13349         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13350                 FREE(j_calls);
13351         }
13352 }
13353 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
13354         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13355         LDKNodeAnnouncement msg_var = *msg;
13356         uint64_t msg_ref = 0;
13357         msg_var = NodeAnnouncement_clone(&msg_var);
13358         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13359         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13360         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 107, msg_ref, 0, 0, 0, 0, 0);
13361         void* ret_ptr = untag_ptr(ret);
13362         CHECK_ACCESS(ret_ptr);
13363         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
13364         FREE(untag_ptr(ret));
13365         return ret_conv;
13366 }
13367 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
13368         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13369         LDKChannelAnnouncement msg_var = *msg;
13370         uint64_t msg_ref = 0;
13371         msg_var = ChannelAnnouncement_clone(&msg_var);
13372         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13373         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13374         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 108, msg_ref, 0, 0, 0, 0, 0);
13375         void* ret_ptr = untag_ptr(ret);
13376         CHECK_ACCESS(ret_ptr);
13377         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
13378         FREE(untag_ptr(ret));
13379         return ret_conv;
13380 }
13381 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
13382         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13383         LDKChannelUpdate msg_var = *msg;
13384         uint64_t msg_ref = 0;
13385         msg_var = ChannelUpdate_clone(&msg_var);
13386         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13387         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13388         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 109, msg_ref, 0, 0, 0, 0, 0);
13389         void* ret_ptr = untag_ptr(ret);
13390         CHECK_ACCESS(ret_ptr);
13391         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
13392         FREE(untag_ptr(ret));
13393         return ret_conv;
13394 }
13395 LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point) {
13396         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13397         int64_t starting_point_conv = starting_point;
13398         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 110, starting_point_conv, 0, 0, 0, 0, 0);
13399         void* ret_ptr = untag_ptr(ret);
13400         CHECK_ACCESS(ret_ptr);
13401         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(ret_ptr);
13402         FREE(untag_ptr(ret));
13403         return ret_conv;
13404 }
13405 LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKNodeId starting_point) {
13406         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13407         LDKNodeId starting_point_var = starting_point;
13408         uint64_t starting_point_ref = 0;
13409         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_var);
13410         starting_point_ref = tag_ptr(starting_point_var.inner, starting_point_var.is_owned);
13411         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 111, starting_point_ref, 0, 0, 0, 0, 0);
13412         LDKNodeAnnouncement ret_conv;
13413         ret_conv.inner = untag_ptr(ret);
13414         ret_conv.is_owned = ptr_is_owned(ret);
13415         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
13416         return ret_conv;
13417 }
13418 LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
13419         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13420         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13421         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13422         LDKInit init_var = *init;
13423         uint64_t init_ref = 0;
13424         init_var = Init_clone(&init_var);
13425         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
13426         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
13427         jboolean inbound_conv = inbound;
13428         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);
13429         void* ret_ptr = untag_ptr(ret);
13430         CHECK_ACCESS(ret_ptr);
13431         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
13432         FREE(untag_ptr(ret));
13433         return ret_conv;
13434 }
13435 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
13436         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13437         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13438         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13439         LDKReplyChannelRange msg_var = msg;
13440         uint64_t msg_ref = 0;
13441         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13442         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13443         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 113, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13444         void* ret_ptr = untag_ptr(ret);
13445         CHECK_ACCESS(ret_ptr);
13446         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
13447         FREE(untag_ptr(ret));
13448         return ret_conv;
13449 }
13450 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
13451         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13452         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13453         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13454         LDKReplyShortChannelIdsEnd msg_var = msg;
13455         uint64_t msg_ref = 0;
13456         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13457         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13458         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 114, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13459         void* ret_ptr = untag_ptr(ret);
13460         CHECK_ACCESS(ret_ptr);
13461         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
13462         FREE(untag_ptr(ret));
13463         return ret_conv;
13464 }
13465 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
13466         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13467         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13468         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13469         LDKQueryChannelRange msg_var = msg;
13470         uint64_t msg_ref = 0;
13471         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13472         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13473         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 115, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13474         void* ret_ptr = untag_ptr(ret);
13475         CHECK_ACCESS(ret_ptr);
13476         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
13477         FREE(untag_ptr(ret));
13478         return ret_conv;
13479 }
13480 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
13481         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13482         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13483         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13484         LDKQueryShortChannelIds msg_var = msg;
13485         uint64_t msg_ref = 0;
13486         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13487         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13488         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 116, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
13489         void* ret_ptr = untag_ptr(ret);
13490         CHECK_ACCESS(ret_ptr);
13491         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
13492         FREE(untag_ptr(ret));
13493         return ret_conv;
13494 }
13495 bool processing_queue_high_LDKRoutingMessageHandler_jcall(const void* this_arg) {
13496         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13497         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 117, 0, 0, 0, 0, 0, 0);
13498 }
13499 LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) {
13500         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13501         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 118, 0, 0, 0, 0, 0, 0);
13502         LDKNodeFeatures ret_conv;
13503         ret_conv.inner = untag_ptr(ret);
13504         ret_conv.is_owned = ptr_is_owned(ret);
13505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
13506         return ret_conv;
13507 }
13508 LDKInitFeatures provided_init_features_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
13509         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13510         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13511         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13512         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 119, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
13513         LDKInitFeatures ret_conv;
13514         ret_conv.inner = untag_ptr(ret);
13515         ret_conv.is_owned = ptr_is_owned(ret);
13516         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
13517         return ret_conv;
13518 }
13519 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
13520         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
13521         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13522         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
13523 }
13524 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
13525         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
13526         atomic_init(&calls->refcnt, 1);
13527         calls->instance_ptr = o;
13528
13529         LDKRoutingMessageHandler ret = {
13530                 .this_arg = (void*) calls,
13531                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
13532                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
13533                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
13534                 .get_next_channel_announcement = get_next_channel_announcement_LDKRoutingMessageHandler_jcall,
13535                 .get_next_node_announcement = get_next_node_announcement_LDKRoutingMessageHandler_jcall,
13536                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
13537                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
13538                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
13539                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
13540                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
13541                 .processing_queue_high = processing_queue_high_LDKRoutingMessageHandler_jcall,
13542                 .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall,
13543                 .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall,
13544                 .free = LDKRoutingMessageHandler_JCalls_free,
13545                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
13546         };
13547         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
13548         return ret;
13549 }
13550 uint64_t  __attribute__((export_name("TS_LDKRoutingMessageHandler_new"))) TS_LDKRoutingMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
13551         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
13552         *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
13553         return tag_ptr(res_ptr, true);
13554 }
13555 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_node_announcement"))) TS_RoutingMessageHandler_handle_node_announcement(uint64_t this_arg, uint64_t msg) {
13556         void* this_arg_ptr = untag_ptr(this_arg);
13557         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13558         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13559         LDKNodeAnnouncement msg_conv;
13560         msg_conv.inner = untag_ptr(msg);
13561         msg_conv.is_owned = ptr_is_owned(msg);
13562         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13563         msg_conv.is_owned = false;
13564         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13565         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
13566         return tag_ptr(ret_conv, true);
13567 }
13568
13569 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_announcement"))) TS_RoutingMessageHandler_handle_channel_announcement(uint64_t this_arg, uint64_t msg) {
13570         void* this_arg_ptr = untag_ptr(this_arg);
13571         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13572         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13573         LDKChannelAnnouncement msg_conv;
13574         msg_conv.inner = untag_ptr(msg);
13575         msg_conv.is_owned = ptr_is_owned(msg);
13576         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13577         msg_conv.is_owned = false;
13578         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13579         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
13580         return tag_ptr(ret_conv, true);
13581 }
13582
13583 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_update"))) TS_RoutingMessageHandler_handle_channel_update(uint64_t this_arg, uint64_t msg) {
13584         void* this_arg_ptr = untag_ptr(this_arg);
13585         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13586         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13587         LDKChannelUpdate msg_conv;
13588         msg_conv.inner = untag_ptr(msg);
13589         msg_conv.is_owned = ptr_is_owned(msg);
13590         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13591         msg_conv.is_owned = false;
13592         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13593         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
13594         return tag_ptr(ret_conv, true);
13595 }
13596
13597 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) {
13598         void* this_arg_ptr = untag_ptr(this_arg);
13599         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13600         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13601         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
13602         *ret_copy = (this_arg_conv->get_next_channel_announcement)(this_arg_conv->this_arg, starting_point);
13603         uint64_t ret_ref = tag_ptr(ret_copy, true);
13604         return ret_ref;
13605 }
13606
13607 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) {
13608         void* this_arg_ptr = untag_ptr(this_arg);
13609         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13610         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13611         LDKNodeId starting_point_conv;
13612         starting_point_conv.inner = untag_ptr(starting_point);
13613         starting_point_conv.is_owned = ptr_is_owned(starting_point);
13614         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_conv);
13615         starting_point_conv = NodeId_clone(&starting_point_conv);
13616         LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_conv);
13617         uint64_t ret_ref = 0;
13618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13620         return ret_ref;
13621 }
13622
13623 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) {
13624         void* this_arg_ptr = untag_ptr(this_arg);
13625         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13626         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13627         LDKPublicKey their_node_id_ref;
13628         CHECK(their_node_id->arr_len == 33);
13629         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13630         LDKInit init_conv;
13631         init_conv.inner = untag_ptr(init);
13632         init_conv.is_owned = ptr_is_owned(init);
13633         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
13634         init_conv.is_owned = false;
13635         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
13636         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
13637         return tag_ptr(ret_conv, true);
13638 }
13639
13640 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) {
13641         void* this_arg_ptr = untag_ptr(this_arg);
13642         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13643         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13644         LDKPublicKey their_node_id_ref;
13645         CHECK(their_node_id->arr_len == 33);
13646         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13647         LDKReplyChannelRange msg_conv;
13648         msg_conv.inner = untag_ptr(msg);
13649         msg_conv.is_owned = ptr_is_owned(msg);
13650         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13651         msg_conv = ReplyChannelRange_clone(&msg_conv);
13652         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13653         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
13654         return tag_ptr(ret_conv, true);
13655 }
13656
13657 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) {
13658         void* this_arg_ptr = untag_ptr(this_arg);
13659         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13660         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13661         LDKPublicKey their_node_id_ref;
13662         CHECK(their_node_id->arr_len == 33);
13663         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13664         LDKReplyShortChannelIdsEnd msg_conv;
13665         msg_conv.inner = untag_ptr(msg);
13666         msg_conv.is_owned = ptr_is_owned(msg);
13667         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13668         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
13669         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13670         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
13671         return tag_ptr(ret_conv, true);
13672 }
13673
13674 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) {
13675         void* this_arg_ptr = untag_ptr(this_arg);
13676         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13677         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13678         LDKPublicKey their_node_id_ref;
13679         CHECK(their_node_id->arr_len == 33);
13680         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13681         LDKQueryChannelRange msg_conv;
13682         msg_conv.inner = untag_ptr(msg);
13683         msg_conv.is_owned = ptr_is_owned(msg);
13684         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13685         msg_conv = QueryChannelRange_clone(&msg_conv);
13686         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13687         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
13688         return tag_ptr(ret_conv, true);
13689 }
13690
13691 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) {
13692         void* this_arg_ptr = untag_ptr(this_arg);
13693         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13694         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13695         LDKPublicKey their_node_id_ref;
13696         CHECK(their_node_id->arr_len == 33);
13697         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13698         LDKQueryShortChannelIds msg_conv;
13699         msg_conv.inner = untag_ptr(msg);
13700         msg_conv.is_owned = ptr_is_owned(msg);
13701         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13702         msg_conv = QueryShortChannelIds_clone(&msg_conv);
13703         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13704         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
13705         return tag_ptr(ret_conv, true);
13706 }
13707
13708 jboolean  __attribute__((export_name("TS_RoutingMessageHandler_processing_queue_high"))) TS_RoutingMessageHandler_processing_queue_high(uint64_t this_arg) {
13709         void* this_arg_ptr = untag_ptr(this_arg);
13710         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13711         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13712         jboolean ret_conv = (this_arg_conv->processing_queue_high)(this_arg_conv->this_arg);
13713         return ret_conv;
13714 }
13715
13716 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_node_features"))) TS_RoutingMessageHandler_provided_node_features(uint64_t this_arg) {
13717         void* this_arg_ptr = untag_ptr(this_arg);
13718         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13719         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13720         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
13721         uint64_t ret_ref = 0;
13722         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13723         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13724         return ret_ref;
13725 }
13726
13727 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_init_features"))) TS_RoutingMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
13728         void* this_arg_ptr = untag_ptr(this_arg);
13729         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13730         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13731         LDKPublicKey their_node_id_ref;
13732         CHECK(their_node_id->arr_len == 33);
13733         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13734         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
13735         uint64_t ret_ref = 0;
13736         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13737         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13738         return ret_ref;
13739 }
13740
13741 typedef struct LDKOnionMessageProvider_JCalls {
13742         atomic_size_t refcnt;
13743         uint32_t instance_ptr;
13744 } LDKOnionMessageProvider_JCalls;
13745 static void LDKOnionMessageProvider_JCalls_free(void* this_arg) {
13746         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg;
13747         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13748                 FREE(j_calls);
13749         }
13750 }
13751 LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageProvider_jcall(const void* this_arg, LDKPublicKey peer_node_id) {
13752         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg;
13753         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
13754         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
13755         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 120, (uint32_t)peer_node_id_arr, 0, 0, 0, 0, 0);
13756         LDKOnionMessage ret_conv;
13757         ret_conv.inner = untag_ptr(ret);
13758         ret_conv.is_owned = ptr_is_owned(ret);
13759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
13760         return ret_conv;
13761 }
13762 static void LDKOnionMessageProvider_JCalls_cloned(LDKOnionMessageProvider* new_obj) {
13763         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) new_obj->this_arg;
13764         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13765 }
13766 static inline LDKOnionMessageProvider LDKOnionMessageProvider_init (JSValue o) {
13767         LDKOnionMessageProvider_JCalls *calls = MALLOC(sizeof(LDKOnionMessageProvider_JCalls), "LDKOnionMessageProvider_JCalls");
13768         atomic_init(&calls->refcnt, 1);
13769         calls->instance_ptr = o;
13770
13771         LDKOnionMessageProvider ret = {
13772                 .this_arg = (void*) calls,
13773                 .next_onion_message_for_peer = next_onion_message_for_peer_LDKOnionMessageProvider_jcall,
13774                 .free = LDKOnionMessageProvider_JCalls_free,
13775         };
13776         return ret;
13777 }
13778 uint64_t  __attribute__((export_name("TS_LDKOnionMessageProvider_new"))) TS_LDKOnionMessageProvider_new(JSValue o) {
13779         LDKOnionMessageProvider *res_ptr = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
13780         *res_ptr = LDKOnionMessageProvider_init(o);
13781         return tag_ptr(res_ptr, true);
13782 }
13783 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) {
13784         void* this_arg_ptr = untag_ptr(this_arg);
13785         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13786         LDKOnionMessageProvider* this_arg_conv = (LDKOnionMessageProvider*)this_arg_ptr;
13787         LDKPublicKey peer_node_id_ref;
13788         CHECK(peer_node_id->arr_len == 33);
13789         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
13790         LDKOnionMessage ret_var = (this_arg_conv->next_onion_message_for_peer)(this_arg_conv->this_arg, peer_node_id_ref);
13791         uint64_t ret_ref = 0;
13792         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13793         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13794         return ret_ref;
13795 }
13796
13797 typedef struct LDKOnionMessageHandler_JCalls {
13798         atomic_size_t refcnt;
13799         uint32_t instance_ptr;
13800         LDKOnionMessageProvider_JCalls* OnionMessageProvider;
13801 } LDKOnionMessageHandler_JCalls;
13802 static void LDKOnionMessageHandler_JCalls_free(void* this_arg) {
13803         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
13804         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13805                 FREE(j_calls);
13806         }
13807 }
13808 void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id, const LDKOnionMessage * msg) {
13809         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
13810         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
13811         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
13812         LDKOnionMessage msg_var = *msg;
13813         uint64_t msg_ref = 0;
13814         msg_var = OnionMessage_clone(&msg_var);
13815         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13816         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13817         js_invoke_function_ubuuuu(j_calls->instance_ptr, 121, (uint32_t)peer_node_id_arr, msg_ref, 0, 0, 0, 0);
13818 }
13819 LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
13820         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
13821         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13822         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13823         LDKInit init_var = *init;
13824         uint64_t init_ref = 0;
13825         init_var = Init_clone(&init_var);
13826         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
13827         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
13828         jboolean inbound_conv = inbound;
13829         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);
13830         void* ret_ptr = untag_ptr(ret);
13831         CHECK_ACCESS(ret_ptr);
13832         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
13833         FREE(untag_ptr(ret));
13834         return ret_conv;
13835 }
13836 void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
13837         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
13838         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13839         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13840         js_invoke_function_uuuuuu(j_calls->instance_ptr, 123, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
13841 }
13842 LDKNodeFeatures provided_node_features_LDKOnionMessageHandler_jcall(const void* this_arg) {
13843         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
13844         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 124, 0, 0, 0, 0, 0, 0);
13845         LDKNodeFeatures ret_conv;
13846         ret_conv.inner = untag_ptr(ret);
13847         ret_conv.is_owned = ptr_is_owned(ret);
13848         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
13849         return ret_conv;
13850 }
13851 LDKInitFeatures provided_init_features_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
13852         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
13853         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13854         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13855         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 125, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
13856         LDKInitFeatures ret_conv;
13857         ret_conv.inner = untag_ptr(ret);
13858         ret_conv.is_owned = ptr_is_owned(ret);
13859         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
13860         return ret_conv;
13861 }
13862 static void LDKOnionMessageHandler_JCalls_cloned(LDKOnionMessageHandler* new_obj) {
13863         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) new_obj->this_arg;
13864         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13865         atomic_fetch_add_explicit(&j_calls->OnionMessageProvider->refcnt, 1, memory_order_release);
13866 }
13867 static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (JSValue o, JSValue OnionMessageProvider) {
13868         LDKOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOnionMessageHandler_JCalls), "LDKOnionMessageHandler_JCalls");
13869         atomic_init(&calls->refcnt, 1);
13870         calls->instance_ptr = o;
13871
13872         LDKOnionMessageHandler ret = {
13873                 .this_arg = (void*) calls,
13874                 .handle_onion_message = handle_onion_message_LDKOnionMessageHandler_jcall,
13875                 .peer_connected = peer_connected_LDKOnionMessageHandler_jcall,
13876                 .peer_disconnected = peer_disconnected_LDKOnionMessageHandler_jcall,
13877                 .provided_node_features = provided_node_features_LDKOnionMessageHandler_jcall,
13878                 .provided_init_features = provided_init_features_LDKOnionMessageHandler_jcall,
13879                 .free = LDKOnionMessageHandler_JCalls_free,
13880                 .OnionMessageProvider = LDKOnionMessageProvider_init(OnionMessageProvider),
13881         };
13882         calls->OnionMessageProvider = ret.OnionMessageProvider.this_arg;
13883         return ret;
13884 }
13885 uint64_t  __attribute__((export_name("TS_LDKOnionMessageHandler_new"))) TS_LDKOnionMessageHandler_new(JSValue o, JSValue OnionMessageProvider) {
13886         LDKOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
13887         *res_ptr = LDKOnionMessageHandler_init(o, OnionMessageProvider);
13888         return tag_ptr(res_ptr, true);
13889 }
13890 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) {
13891         void* this_arg_ptr = untag_ptr(this_arg);
13892         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13893         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
13894         LDKPublicKey peer_node_id_ref;
13895         CHECK(peer_node_id->arr_len == 33);
13896         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
13897         LDKOnionMessage msg_conv;
13898         msg_conv.inner = untag_ptr(msg);
13899         msg_conv.is_owned = ptr_is_owned(msg);
13900         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13901         msg_conv.is_owned = false;
13902         (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv);
13903 }
13904
13905 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) {
13906         void* this_arg_ptr = untag_ptr(this_arg);
13907         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13908         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
13909         LDKPublicKey their_node_id_ref;
13910         CHECK(their_node_id->arr_len == 33);
13911         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13912         LDKInit init_conv;
13913         init_conv.inner = untag_ptr(init);
13914         init_conv.is_owned = ptr_is_owned(init);
13915         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
13916         init_conv.is_owned = false;
13917         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
13918         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
13919         return tag_ptr(ret_conv, true);
13920 }
13921
13922 void  __attribute__((export_name("TS_OnionMessageHandler_peer_disconnected"))) TS_OnionMessageHandler_peer_disconnected(uint64_t this_arg, int8_tArray their_node_id) {
13923         void* this_arg_ptr = untag_ptr(this_arg);
13924         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13925         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
13926         LDKPublicKey their_node_id_ref;
13927         CHECK(their_node_id->arr_len == 33);
13928         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13929         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
13930 }
13931
13932 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_node_features"))) TS_OnionMessageHandler_provided_node_features(uint64_t this_arg) {
13933         void* this_arg_ptr = untag_ptr(this_arg);
13934         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13935         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
13936         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
13937         uint64_t ret_ref = 0;
13938         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13939         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13940         return ret_ref;
13941 }
13942
13943 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_init_features"))) TS_OnionMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
13944         void* this_arg_ptr = untag_ptr(this_arg);
13945         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13946         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
13947         LDKPublicKey their_node_id_ref;
13948         CHECK(their_node_id->arr_len == 33);
13949         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13950         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
13951         uint64_t ret_ref = 0;
13952         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13953         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13954         return ret_ref;
13955 }
13956
13957 typedef struct LDKCustomMessageReader_JCalls {
13958         atomic_size_t refcnt;
13959         uint32_t instance_ptr;
13960 } LDKCustomMessageReader_JCalls;
13961 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
13962         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
13963         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13964                 FREE(j_calls);
13965         }
13966 }
13967 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
13968         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
13969         int16_t message_type_conv = message_type;
13970         LDKu8slice buffer_var = buffer;
13971         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
13972         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
13973         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 126, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
13974         void* ret_ptr = untag_ptr(ret);
13975         CHECK_ACCESS(ret_ptr);
13976         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
13977         FREE(untag_ptr(ret));
13978         return ret_conv;
13979 }
13980 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
13981         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
13982         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13983 }
13984 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JSValue o) {
13985         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
13986         atomic_init(&calls->refcnt, 1);
13987         calls->instance_ptr = o;
13988
13989         LDKCustomMessageReader ret = {
13990                 .this_arg = (void*) calls,
13991                 .read = read_LDKCustomMessageReader_jcall,
13992                 .free = LDKCustomMessageReader_JCalls_free,
13993         };
13994         return ret;
13995 }
13996 uint64_t  __attribute__((export_name("TS_LDKCustomMessageReader_new"))) TS_LDKCustomMessageReader_new(JSValue o) {
13997         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
13998         *res_ptr = LDKCustomMessageReader_init(o);
13999         return tag_ptr(res_ptr, true);
14000 }
14001 uint64_t  __attribute__((export_name("TS_CustomMessageReader_read"))) TS_CustomMessageReader_read(uint64_t this_arg, int16_t message_type, int8_tArray buffer) {
14002         void* this_arg_ptr = untag_ptr(this_arg);
14003         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14004         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
14005         LDKu8slice buffer_ref;
14006         buffer_ref.datalen = buffer->arr_len;
14007         buffer_ref.data = buffer->elems;
14008         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
14009         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
14010         FREE(buffer);
14011         return tag_ptr(ret_conv, true);
14012 }
14013
14014 typedef struct LDKCustomMessageHandler_JCalls {
14015         atomic_size_t refcnt;
14016         uint32_t instance_ptr;
14017         LDKCustomMessageReader_JCalls* CustomMessageReader;
14018 } LDKCustomMessageHandler_JCalls;
14019 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
14020         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
14021         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14022                 FREE(j_calls);
14023         }
14024 }
14025 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
14026         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
14027         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
14028         *msg_ret = msg;
14029         int8_tArray sender_node_id_arr = init_int8_tArray(33, __LINE__);
14030         memcpy(sender_node_id_arr->elems, sender_node_id.compressed_form, 33);
14031         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);
14032         void* ret_ptr = untag_ptr(ret);
14033         CHECK_ACCESS(ret_ptr);
14034         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
14035         FREE(untag_ptr(ret));
14036         return ret_conv;
14037 }
14038 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
14039         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
14040         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 128, 0, 0, 0, 0, 0, 0);
14041         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
14042         ret_constr.datalen = ret->arr_len;
14043         if (ret_constr.datalen > 0)
14044                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
14045         else
14046                 ret_constr.data = NULL;
14047         uint64_t* ret_vals = ret->elems;
14048         for (size_t z = 0; z < ret_constr.datalen; z++) {
14049                 uint64_t ret_conv_25 = ret_vals[z];
14050                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
14051                 CHECK_ACCESS(ret_conv_25_ptr);
14052                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
14053                 FREE(untag_ptr(ret_conv_25));
14054                 ret_constr.data[z] = ret_conv_25_conv;
14055         }
14056         FREE(ret);
14057         return ret_constr;
14058 }
14059 LDKNodeFeatures provided_node_features_LDKCustomMessageHandler_jcall(const void* this_arg) {
14060         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
14061         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 129, 0, 0, 0, 0, 0, 0);
14062         LDKNodeFeatures ret_conv;
14063         ret_conv.inner = untag_ptr(ret);
14064         ret_conv.is_owned = ptr_is_owned(ret);
14065         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
14066         return ret_conv;
14067 }
14068 LDKInitFeatures provided_init_features_LDKCustomMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
14069         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
14070         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14071         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14072         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 130, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
14073         LDKInitFeatures ret_conv;
14074         ret_conv.inner = untag_ptr(ret);
14075         ret_conv.is_owned = ptr_is_owned(ret);
14076         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
14077         return ret_conv;
14078 }
14079 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
14080         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
14081         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14082         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
14083 }
14084 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JSValue o, JSValue CustomMessageReader) {
14085         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
14086         atomic_init(&calls->refcnt, 1);
14087         calls->instance_ptr = o;
14088
14089         LDKCustomMessageHandler ret = {
14090                 .this_arg = (void*) calls,
14091                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
14092                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
14093                 .provided_node_features = provided_node_features_LDKCustomMessageHandler_jcall,
14094                 .provided_init_features = provided_init_features_LDKCustomMessageHandler_jcall,
14095                 .free = LDKCustomMessageHandler_JCalls_free,
14096                 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
14097         };
14098         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
14099         return ret;
14100 }
14101 uint64_t  __attribute__((export_name("TS_LDKCustomMessageHandler_new"))) TS_LDKCustomMessageHandler_new(JSValue o, JSValue CustomMessageReader) {
14102         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
14103         *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
14104         return tag_ptr(res_ptr, true);
14105 }
14106 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) {
14107         void* this_arg_ptr = untag_ptr(this_arg);
14108         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14109         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
14110         void* msg_ptr = untag_ptr(msg);
14111         CHECK_ACCESS(msg_ptr);
14112         LDKType msg_conv = *(LDKType*)(msg_ptr);
14113         if (msg_conv.free == LDKType_JCalls_free) {
14114                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14115                 LDKType_JCalls_cloned(&msg_conv);
14116         }
14117         LDKPublicKey sender_node_id_ref;
14118         CHECK(sender_node_id->arr_len == 33);
14119         memcpy(sender_node_id_ref.compressed_form, sender_node_id->elems, 33); FREE(sender_node_id);
14120         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14121         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
14122         return tag_ptr(ret_conv, true);
14123 }
14124
14125 uint64_tArray  __attribute__((export_name("TS_CustomMessageHandler_get_and_clear_pending_msg"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint64_t this_arg) {
14126         void* this_arg_ptr = untag_ptr(this_arg);
14127         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14128         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
14129         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
14130         uint64_tArray ret_arr = NULL;
14131         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
14132         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
14133         for (size_t z = 0; z < ret_var.datalen; z++) {
14134                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
14135                 *ret_conv_25_conv = ret_var.data[z];
14136                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
14137         }
14138         
14139         FREE(ret_var.data);
14140         return ret_arr;
14141 }
14142
14143 uint64_t  __attribute__((export_name("TS_CustomMessageHandler_provided_node_features"))) TS_CustomMessageHandler_provided_node_features(uint64_t this_arg) {
14144         void* this_arg_ptr = untag_ptr(this_arg);
14145         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14146         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
14147         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
14148         uint64_t ret_ref = 0;
14149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14151         return ret_ref;
14152 }
14153
14154 uint64_t  __attribute__((export_name("TS_CustomMessageHandler_provided_init_features"))) TS_CustomMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
14155         void* this_arg_ptr = untag_ptr(this_arg);
14156         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14157         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
14158         LDKPublicKey their_node_id_ref;
14159         CHECK(their_node_id->arr_len == 33);
14160         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14161         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
14162         uint64_t ret_ref = 0;
14163         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14164         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14165         return ret_ref;
14166 }
14167
14168 typedef struct LDKOffersMessageHandler_JCalls {
14169         atomic_size_t refcnt;
14170         uint32_t instance_ptr;
14171 } LDKOffersMessageHandler_JCalls;
14172 static void LDKOffersMessageHandler_JCalls_free(void* this_arg) {
14173         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
14174         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14175                 FREE(j_calls);
14176         }
14177 }
14178 LDKCOption_OffersMessageZ handle_message_LDKOffersMessageHandler_jcall(const void* this_arg, LDKOffersMessage message) {
14179         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
14180         LDKOffersMessage *message_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
14181         *message_copy = message;
14182         uint64_t message_ref = tag_ptr(message_copy, true);
14183         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 131, message_ref, 0, 0, 0, 0, 0);
14184         void* ret_ptr = untag_ptr(ret);
14185         CHECK_ACCESS(ret_ptr);
14186         LDKCOption_OffersMessageZ ret_conv = *(LDKCOption_OffersMessageZ*)(ret_ptr);
14187         FREE(untag_ptr(ret));
14188         return ret_conv;
14189 }
14190 static void LDKOffersMessageHandler_JCalls_cloned(LDKOffersMessageHandler* new_obj) {
14191         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) new_obj->this_arg;
14192         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14193 }
14194 static inline LDKOffersMessageHandler LDKOffersMessageHandler_init (JSValue o) {
14195         LDKOffersMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOffersMessageHandler_JCalls), "LDKOffersMessageHandler_JCalls");
14196         atomic_init(&calls->refcnt, 1);
14197         calls->instance_ptr = o;
14198
14199         LDKOffersMessageHandler ret = {
14200                 .this_arg = (void*) calls,
14201                 .handle_message = handle_message_LDKOffersMessageHandler_jcall,
14202                 .free = LDKOffersMessageHandler_JCalls_free,
14203         };
14204         return ret;
14205 }
14206 uint64_t  __attribute__((export_name("TS_LDKOffersMessageHandler_new"))) TS_LDKOffersMessageHandler_new(JSValue o) {
14207         LDKOffersMessageHandler *res_ptr = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
14208         *res_ptr = LDKOffersMessageHandler_init(o);
14209         return tag_ptr(res_ptr, true);
14210 }
14211 uint64_t  __attribute__((export_name("TS_OffersMessageHandler_handle_message"))) TS_OffersMessageHandler_handle_message(uint64_t this_arg, uint64_t message) {
14212         void* this_arg_ptr = untag_ptr(this_arg);
14213         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14214         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
14215         void* message_ptr = untag_ptr(message);
14216         CHECK_ACCESS(message_ptr);
14217         LDKOffersMessage message_conv = *(LDKOffersMessage*)(message_ptr);
14218         message_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(message));
14219         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
14220         *ret_copy = (this_arg_conv->handle_message)(this_arg_conv->this_arg, message_conv);
14221         uint64_t ret_ref = tag_ptr(ret_copy, true);
14222         return ret_ref;
14223 }
14224
14225 typedef struct LDKCustomOnionMessageHandler_JCalls {
14226         atomic_size_t refcnt;
14227         uint32_t instance_ptr;
14228 } LDKCustomOnionMessageHandler_JCalls;
14229 static void LDKCustomOnionMessageHandler_JCalls_free(void* this_arg) {
14230         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
14231         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14232                 FREE(j_calls);
14233         }
14234 }
14235 LDKCOption_CustomOnionMessageContentsZ handle_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, LDKCustomOnionMessageContents msg) {
14236         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
14237         LDKCustomOnionMessageContents* msg_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
14238         *msg_ret = msg;
14239         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 132, tag_ptr(msg_ret, true), 0, 0, 0, 0, 0);
14240         void* ret_ptr = untag_ptr(ret);
14241         CHECK_ACCESS(ret_ptr);
14242         LDKCOption_CustomOnionMessageContentsZ ret_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(ret_ptr);
14243         FREE(untag_ptr(ret));
14244         return ret_conv;
14245 }
14246 LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ read_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, uint64_t message_type, LDKu8slice buffer) {
14247         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
14248         int64_t message_type_conv = message_type;
14249         LDKu8slice buffer_var = buffer;
14250         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
14251         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
14252         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 133, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
14253         void* ret_ptr = untag_ptr(ret);
14254         CHECK_ACCESS(ret_ptr);
14255         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ ret_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(ret_ptr);
14256         FREE(untag_ptr(ret));
14257         return ret_conv;
14258 }
14259 static void LDKCustomOnionMessageHandler_JCalls_cloned(LDKCustomOnionMessageHandler* new_obj) {
14260         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) new_obj->this_arg;
14261         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14262 }
14263 static inline LDKCustomOnionMessageHandler LDKCustomOnionMessageHandler_init (JSValue o) {
14264         LDKCustomOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageHandler_JCalls), "LDKCustomOnionMessageHandler_JCalls");
14265         atomic_init(&calls->refcnt, 1);
14266         calls->instance_ptr = o;
14267
14268         LDKCustomOnionMessageHandler ret = {
14269                 .this_arg = (void*) calls,
14270                 .handle_custom_message = handle_custom_message_LDKCustomOnionMessageHandler_jcall,
14271                 .read_custom_message = read_custom_message_LDKCustomOnionMessageHandler_jcall,
14272                 .free = LDKCustomOnionMessageHandler_JCalls_free,
14273         };
14274         return ret;
14275 }
14276 uint64_t  __attribute__((export_name("TS_LDKCustomOnionMessageHandler_new"))) TS_LDKCustomOnionMessageHandler_new(JSValue o) {
14277         LDKCustomOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
14278         *res_ptr = LDKCustomOnionMessageHandler_init(o);
14279         return tag_ptr(res_ptr, true);
14280 }
14281 uint64_t  __attribute__((export_name("TS_CustomOnionMessageHandler_handle_custom_message"))) TS_CustomOnionMessageHandler_handle_custom_message(uint64_t this_arg, uint64_t msg) {
14282         void* this_arg_ptr = untag_ptr(this_arg);
14283         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14284         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
14285         void* msg_ptr = untag_ptr(msg);
14286         CHECK_ACCESS(msg_ptr);
14287         LDKCustomOnionMessageContents msg_conv = *(LDKCustomOnionMessageContents*)(msg_ptr);
14288         if (msg_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
14289                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14290                 LDKCustomOnionMessageContents_JCalls_cloned(&msg_conv);
14291         }
14292         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
14293         *ret_copy = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv);
14294         uint64_t ret_ref = tag_ptr(ret_copy, true);
14295         return ret_ref;
14296 }
14297
14298 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) {
14299         void* this_arg_ptr = untag_ptr(this_arg);
14300         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14301         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
14302         LDKu8slice buffer_ref;
14303         buffer_ref.datalen = buffer->arr_len;
14304         buffer_ref.data = buffer->elems;
14305         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
14306         *ret_conv = (this_arg_conv->read_custom_message)(this_arg_conv->this_arg, message_type, buffer_ref);
14307         FREE(buffer);
14308         return tag_ptr(ret_conv, true);
14309 }
14310
14311 typedef struct LDKSocketDescriptor_JCalls {
14312         atomic_size_t refcnt;
14313         uint32_t instance_ptr;
14314 } LDKSocketDescriptor_JCalls;
14315 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
14316         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
14317         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14318                 FREE(j_calls);
14319         }
14320 }
14321 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
14322         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
14323         LDKu8slice data_var = data;
14324         int8_tArray data_arr = init_int8_tArray(data_var.datalen, __LINE__);
14325         memcpy(data_arr->elems, data_var.data, data_var.datalen);
14326         jboolean resume_read_conv = resume_read;
14327         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 134, (uint32_t)data_arr, resume_read_conv, 0, 0, 0, 0);
14328 }
14329 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
14330         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
14331         js_invoke_function_uuuuuu(j_calls->instance_ptr, 135, 0, 0, 0, 0, 0, 0);
14332 }
14333 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
14334         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
14335         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
14336         *other_arg_clone = SocketDescriptor_clone(other_arg);
14337         return js_invoke_function_buuuuu(j_calls->instance_ptr, 136, tag_ptr(other_arg_clone, true), 0, 0, 0, 0, 0);
14338 }
14339 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
14340         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
14341         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 137, 0, 0, 0, 0, 0, 0);
14342 }
14343 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
14344         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
14345         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14346 }
14347 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JSValue o) {
14348         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
14349         atomic_init(&calls->refcnt, 1);
14350         calls->instance_ptr = o;
14351
14352         LDKSocketDescriptor ret = {
14353                 .this_arg = (void*) calls,
14354                 .send_data = send_data_LDKSocketDescriptor_jcall,
14355                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
14356                 .eq = eq_LDKSocketDescriptor_jcall,
14357                 .hash = hash_LDKSocketDescriptor_jcall,
14358                 .cloned = LDKSocketDescriptor_JCalls_cloned,
14359                 .free = LDKSocketDescriptor_JCalls_free,
14360         };
14361         return ret;
14362 }
14363 uint64_t  __attribute__((export_name("TS_LDKSocketDescriptor_new"))) TS_LDKSocketDescriptor_new(JSValue o) {
14364         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
14365         *res_ptr = LDKSocketDescriptor_init(o);
14366         return tag_ptr(res_ptr, true);
14367 }
14368 uint32_t  __attribute__((export_name("TS_SocketDescriptor_send_data"))) TS_SocketDescriptor_send_data(uint64_t this_arg, int8_tArray data, jboolean resume_read) {
14369         void* this_arg_ptr = untag_ptr(this_arg);
14370         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14371         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
14372         LDKu8slice data_ref;
14373         data_ref.datalen = data->arr_len;
14374         data_ref.data = data->elems;
14375         uint32_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
14376         FREE(data);
14377         return ret_conv;
14378 }
14379
14380 void  __attribute__((export_name("TS_SocketDescriptor_disconnect_socket"))) TS_SocketDescriptor_disconnect_socket(uint64_t this_arg) {
14381         void* this_arg_ptr = untag_ptr(this_arg);
14382         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14383         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
14384         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
14385 }
14386
14387 int64_t  __attribute__((export_name("TS_SocketDescriptor_hash"))) TS_SocketDescriptor_hash(uint64_t this_arg) {
14388         void* this_arg_ptr = untag_ptr(this_arg);
14389         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14390         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
14391         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
14392         return ret_conv;
14393 }
14394
14395 uint32_t __attribute__((export_name("TS_LDKEffectiveCapacity_ty_from_ptr"))) TS_LDKEffectiveCapacity_ty_from_ptr(uint64_t ptr) {
14396         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
14397         switch(obj->tag) {
14398                 case LDKEffectiveCapacity_ExactLiquidity: return 0;
14399                 case LDKEffectiveCapacity_AdvertisedMaxHTLC: return 1;
14400                 case LDKEffectiveCapacity_Total: return 2;
14401                 case LDKEffectiveCapacity_Infinite: return 3;
14402                 case LDKEffectiveCapacity_HintMaxHTLC: return 4;
14403                 case LDKEffectiveCapacity_Unknown: return 5;
14404                 default: abort();
14405         }
14406 }
14407 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat"))) TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat(uint64_t ptr) {
14408         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
14409         assert(obj->tag == LDKEffectiveCapacity_ExactLiquidity);
14410                         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
14411         return liquidity_msat_conv;
14412 }
14413 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_AdvertisedMaxHTLC_get_amount_msat"))) TS_LDKEffectiveCapacity_AdvertisedMaxHTLC_get_amount_msat(uint64_t ptr) {
14414         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
14415         assert(obj->tag == LDKEffectiveCapacity_AdvertisedMaxHTLC);
14416                         int64_t amount_msat_conv = obj->advertised_max_htlc.amount_msat;
14417         return amount_msat_conv;
14418 }
14419 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_capacity_msat"))) TS_LDKEffectiveCapacity_Total_get_capacity_msat(uint64_t ptr) {
14420         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
14421         assert(obj->tag == LDKEffectiveCapacity_Total);
14422                         int64_t capacity_msat_conv = obj->total.capacity_msat;
14423         return capacity_msat_conv;
14424 }
14425 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat"))) TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat(uint64_t ptr) {
14426         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
14427         assert(obj->tag == LDKEffectiveCapacity_Total);
14428                         int64_t htlc_maximum_msat_conv = obj->total.htlc_maximum_msat;
14429         return htlc_maximum_msat_conv;
14430 }
14431 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_HintMaxHTLC_get_amount_msat"))) TS_LDKEffectiveCapacity_HintMaxHTLC_get_amount_msat(uint64_t ptr) {
14432         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
14433         assert(obj->tag == LDKEffectiveCapacity_HintMaxHTLC);
14434                         int64_t amount_msat_conv = obj->hint_max_htlc.amount_msat;
14435         return amount_msat_conv;
14436 }
14437 uint32_t __attribute__((export_name("TS_LDKPayee_ty_from_ptr"))) TS_LDKPayee_ty_from_ptr(uint64_t ptr) {
14438         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
14439         switch(obj->tag) {
14440                 case LDKPayee_Blinded: return 0;
14441                 case LDKPayee_Clear: return 1;
14442                 default: abort();
14443         }
14444 }
14445 uint64_tArray __attribute__((export_name("TS_LDKPayee_Blinded_get_route_hints"))) TS_LDKPayee_Blinded_get_route_hints(uint64_t ptr) {
14446         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
14447         assert(obj->tag == LDKPayee_Blinded);
14448                         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_var = obj->blinded.route_hints;
14449                         uint64_tArray route_hints_arr = NULL;
14450                         route_hints_arr = init_uint64_tArray(route_hints_var.datalen, __LINE__);
14451                         uint64_t *route_hints_arr_ptr = (uint64_t*)(((uint8_t*)route_hints_arr) + 8);
14452                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
14453                                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* route_hints_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
14454                                 *route_hints_conv_37_conv = route_hints_var.data[l];
14455                                 *route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(route_hints_conv_37_conv);
14456                                 route_hints_arr_ptr[l] = tag_ptr(route_hints_conv_37_conv, true);
14457                         }
14458                         
14459         return route_hints_arr;
14460 }
14461 uint64_t __attribute__((export_name("TS_LDKPayee_Blinded_get_features"))) TS_LDKPayee_Blinded_get_features(uint64_t ptr) {
14462         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
14463         assert(obj->tag == LDKPayee_Blinded);
14464                         LDKBolt12InvoiceFeatures features_var = obj->blinded.features;
14465                         uint64_t features_ref = 0;
14466                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
14467                         features_ref = tag_ptr(features_var.inner, false);
14468         return features_ref;
14469 }
14470 int8_tArray __attribute__((export_name("TS_LDKPayee_Clear_get_node_id"))) TS_LDKPayee_Clear_get_node_id(uint64_t ptr) {
14471         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
14472         assert(obj->tag == LDKPayee_Clear);
14473                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
14474                         memcpy(node_id_arr->elems, obj->clear.node_id.compressed_form, 33);
14475         return node_id_arr;
14476 }
14477 uint64_tArray __attribute__((export_name("TS_LDKPayee_Clear_get_route_hints"))) TS_LDKPayee_Clear_get_route_hints(uint64_t ptr) {
14478         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
14479         assert(obj->tag == LDKPayee_Clear);
14480                         LDKCVec_RouteHintZ route_hints_var = obj->clear.route_hints;
14481                         uint64_tArray route_hints_arr = NULL;
14482                         route_hints_arr = init_uint64_tArray(route_hints_var.datalen, __LINE__);
14483                         uint64_t *route_hints_arr_ptr = (uint64_t*)(((uint8_t*)route_hints_arr) + 8);
14484                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
14485                                 LDKRouteHint route_hints_conv_11_var = route_hints_var.data[l];
14486                                 uint64_t route_hints_conv_11_ref = 0;
14487                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_var);
14488                                 route_hints_conv_11_ref = tag_ptr(route_hints_conv_11_var.inner, false);
14489                                 route_hints_arr_ptr[l] = route_hints_conv_11_ref;
14490                         }
14491                         
14492         return route_hints_arr;
14493 }
14494 uint64_t __attribute__((export_name("TS_LDKPayee_Clear_get_features"))) TS_LDKPayee_Clear_get_features(uint64_t ptr) {
14495         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
14496         assert(obj->tag == LDKPayee_Clear);
14497                         LDKBolt11InvoiceFeatures features_var = obj->clear.features;
14498                         uint64_t features_ref = 0;
14499                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
14500                         features_ref = tag_ptr(features_var.inner, false);
14501         return features_ref;
14502 }
14503 int32_t __attribute__((export_name("TS_LDKPayee_Clear_get_final_cltv_expiry_delta"))) TS_LDKPayee_Clear_get_final_cltv_expiry_delta(uint64_t ptr) {
14504         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
14505         assert(obj->tag == LDKPayee_Clear);
14506                         int32_t final_cltv_expiry_delta_conv = obj->clear.final_cltv_expiry_delta;
14507         return final_cltv_expiry_delta_conv;
14508 }
14509 typedef struct LDKScore_JCalls {
14510         atomic_size_t refcnt;
14511         uint32_t instance_ptr;
14512         LDKScoreLookUp_JCalls* ScoreLookUp;
14513         LDKScoreUpdate_JCalls* ScoreUpdate;
14514 } LDKScore_JCalls;
14515 static void LDKScore_JCalls_free(void* this_arg) {
14516         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
14517         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14518                 FREE(j_calls);
14519         }
14520 }
14521 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
14522         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
14523         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 138, 0, 0, 0, 0, 0, 0);
14524         LDKCVec_u8Z ret_ref;
14525         ret_ref.datalen = ret->arr_len;
14526         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
14527         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
14528         return ret_ref;
14529 }
14530 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
14531         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
14532         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14533         atomic_fetch_add_explicit(&j_calls->ScoreLookUp->refcnt, 1, memory_order_release);
14534         atomic_fetch_add_explicit(&j_calls->ScoreUpdate->refcnt, 1, memory_order_release);
14535 }
14536 static inline LDKScore LDKScore_init (JSValue o, JSValue ScoreLookUp, JSValue ScoreUpdate) {
14537         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
14538         atomic_init(&calls->refcnt, 1);
14539         calls->instance_ptr = o;
14540
14541         LDKScore ret = {
14542                 .this_arg = (void*) calls,
14543                 .write = write_LDKScore_jcall,
14544                 .free = LDKScore_JCalls_free,
14545                 .ScoreLookUp = LDKScoreLookUp_init(ScoreLookUp),
14546                 .ScoreUpdate = LDKScoreUpdate_init(ScoreUpdate),
14547         };
14548         calls->ScoreLookUp = ret.ScoreLookUp.this_arg;
14549         calls->ScoreUpdate = ret.ScoreUpdate.this_arg;
14550         return ret;
14551 }
14552 uint64_t  __attribute__((export_name("TS_LDKScore_new"))) TS_LDKScore_new(JSValue o, JSValue ScoreLookUp, JSValue ScoreUpdate) {
14553         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
14554         *res_ptr = LDKScore_init(o, ScoreLookUp, ScoreUpdate);
14555         return tag_ptr(res_ptr, true);
14556 }
14557 int8_tArray  __attribute__((export_name("TS_Score_write"))) TS_Score_write(uint64_t this_arg) {
14558         void* this_arg_ptr = untag_ptr(this_arg);
14559         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14560         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
14561         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
14562         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
14563         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
14564         CVec_u8Z_free(ret_var);
14565         return ret_arr;
14566 }
14567
14568 uint32_t __attribute__((export_name("TS_LDKDestination_ty_from_ptr"))) TS_LDKDestination_ty_from_ptr(uint64_t ptr) {
14569         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
14570         switch(obj->tag) {
14571                 case LDKDestination_Node: return 0;
14572                 case LDKDestination_BlindedPath: return 1;
14573                 default: abort();
14574         }
14575 }
14576 int8_tArray __attribute__((export_name("TS_LDKDestination_Node_get_node"))) TS_LDKDestination_Node_get_node(uint64_t ptr) {
14577         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
14578         assert(obj->tag == LDKDestination_Node);
14579                         int8_tArray node_arr = init_int8_tArray(33, __LINE__);
14580                         memcpy(node_arr->elems, obj->node.compressed_form, 33);
14581         return node_arr;
14582 }
14583 uint64_t __attribute__((export_name("TS_LDKDestination_BlindedPath_get_blinded_path"))) TS_LDKDestination_BlindedPath_get_blinded_path(uint64_t ptr) {
14584         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
14585         assert(obj->tag == LDKDestination_BlindedPath);
14586                         LDKBlindedPath blinded_path_var = obj->blinded_path;
14587                         uint64_t blinded_path_ref = 0;
14588                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_path_var);
14589                         blinded_path_ref = tag_ptr(blinded_path_var.inner, false);
14590         return blinded_path_ref;
14591 }
14592 typedef struct LDKMessageRouter_JCalls {
14593         atomic_size_t refcnt;
14594         uint32_t instance_ptr;
14595 } LDKMessageRouter_JCalls;
14596 static void LDKMessageRouter_JCalls_free(void* this_arg) {
14597         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
14598         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14599                 FREE(j_calls);
14600         }
14601 }
14602 LDKCResult_OnionMessagePathNoneZ find_path_LDKMessageRouter_jcall(const void* this_arg, LDKPublicKey sender, LDKCVec_PublicKeyZ peers, LDKDestination destination) {
14603         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
14604         int8_tArray sender_arr = init_int8_tArray(33, __LINE__);
14605         memcpy(sender_arr->elems, sender.compressed_form, 33);
14606         LDKCVec_PublicKeyZ peers_var = peers;
14607         ptrArray peers_arr = NULL;
14608         peers_arr = init_ptrArray(peers_var.datalen, __LINE__);
14609         int8_tArray *peers_arr_ptr = (int8_tArray*)(((uint8_t*)peers_arr) + 8);
14610         for (size_t m = 0; m < peers_var.datalen; m++) {
14611                 int8_tArray peers_conv_12_arr = init_int8_tArray(33, __LINE__);
14612                 memcpy(peers_conv_12_arr->elems, peers_var.data[m].compressed_form, 33);
14613                 peers_arr_ptr[m] = peers_conv_12_arr;
14614         }
14615         
14616         FREE(peers_var.data);
14617         LDKDestination *destination_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
14618         *destination_copy = destination;
14619         uint64_t destination_ref = tag_ptr(destination_copy, true);
14620         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);
14621         void* ret_ptr = untag_ptr(ret);
14622         CHECK_ACCESS(ret_ptr);
14623         LDKCResult_OnionMessagePathNoneZ ret_conv = *(LDKCResult_OnionMessagePathNoneZ*)(ret_ptr);
14624         FREE(untag_ptr(ret));
14625         return ret_conv;
14626 }
14627 static void LDKMessageRouter_JCalls_cloned(LDKMessageRouter* new_obj) {
14628         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) new_obj->this_arg;
14629         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14630 }
14631 static inline LDKMessageRouter LDKMessageRouter_init (JSValue o) {
14632         LDKMessageRouter_JCalls *calls = MALLOC(sizeof(LDKMessageRouter_JCalls), "LDKMessageRouter_JCalls");
14633         atomic_init(&calls->refcnt, 1);
14634         calls->instance_ptr = o;
14635
14636         LDKMessageRouter ret = {
14637                 .this_arg = (void*) calls,
14638                 .find_path = find_path_LDKMessageRouter_jcall,
14639                 .free = LDKMessageRouter_JCalls_free,
14640         };
14641         return ret;
14642 }
14643 uint64_t  __attribute__((export_name("TS_LDKMessageRouter_new"))) TS_LDKMessageRouter_new(JSValue o) {
14644         LDKMessageRouter *res_ptr = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
14645         *res_ptr = LDKMessageRouter_init(o);
14646         return tag_ptr(res_ptr, true);
14647 }
14648 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) {
14649         void* this_arg_ptr = untag_ptr(this_arg);
14650         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14651         LDKMessageRouter* this_arg_conv = (LDKMessageRouter*)this_arg_ptr;
14652         LDKPublicKey sender_ref;
14653         CHECK(sender->arr_len == 33);
14654         memcpy(sender_ref.compressed_form, sender->elems, 33); FREE(sender);
14655         LDKCVec_PublicKeyZ peers_constr;
14656         peers_constr.datalen = peers->arr_len;
14657         if (peers_constr.datalen > 0)
14658                 peers_constr.data = MALLOC(peers_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
14659         else
14660                 peers_constr.data = NULL;
14661         int8_tArray* peers_vals = (void*) peers->elems;
14662         for (size_t m = 0; m < peers_constr.datalen; m++) {
14663                 int8_tArray peers_conv_12 = peers_vals[m];
14664                 LDKPublicKey peers_conv_12_ref;
14665                 CHECK(peers_conv_12->arr_len == 33);
14666                 memcpy(peers_conv_12_ref.compressed_form, peers_conv_12->elems, 33); FREE(peers_conv_12);
14667                 peers_constr.data[m] = peers_conv_12_ref;
14668         }
14669         FREE(peers);
14670         void* destination_ptr = untag_ptr(destination);
14671         CHECK_ACCESS(destination_ptr);
14672         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
14673         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
14674         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
14675         *ret_conv = (this_arg_conv->find_path)(this_arg_conv->this_arg, sender_ref, peers_constr, destination_conv);
14676         return tag_ptr(ret_conv, true);
14677 }
14678
14679 uint32_t __attribute__((export_name("TS_LDKOnionMessageContents_ty_from_ptr"))) TS_LDKOnionMessageContents_ty_from_ptr(uint64_t ptr) {
14680         LDKOnionMessageContents *obj = (LDKOnionMessageContents*)untag_ptr(ptr);
14681         switch(obj->tag) {
14682                 case LDKOnionMessageContents_Offers: return 0;
14683                 case LDKOnionMessageContents_Custom: return 1;
14684                 default: abort();
14685         }
14686 }
14687 uint64_t __attribute__((export_name("TS_LDKOnionMessageContents_Offers_get_offers"))) TS_LDKOnionMessageContents_Offers_get_offers(uint64_t ptr) {
14688         LDKOnionMessageContents *obj = (LDKOnionMessageContents*)untag_ptr(ptr);
14689         assert(obj->tag == LDKOnionMessageContents_Offers);
14690                         uint64_t offers_ref = tag_ptr(&obj->offers, false);
14691         return offers_ref;
14692 }
14693 uint64_t __attribute__((export_name("TS_LDKOnionMessageContents_Custom_get_custom"))) TS_LDKOnionMessageContents_Custom_get_custom(uint64_t ptr) {
14694         LDKOnionMessageContents *obj = (LDKOnionMessageContents*)untag_ptr(ptr);
14695         assert(obj->tag == LDKOnionMessageContents_Custom);
14696                         LDKCustomOnionMessageContents* custom_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
14697                         *custom_ret = CustomOnionMessageContents_clone(&obj->custom);
14698         return tag_ptr(custom_ret, true);
14699 }
14700 typedef struct LDKCoinSelectionSource_JCalls {
14701         atomic_size_t refcnt;
14702         uint32_t instance_ptr;
14703 } LDKCoinSelectionSource_JCalls;
14704 static void LDKCoinSelectionSource_JCalls_free(void* this_arg) {
14705         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
14706         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14707                 FREE(j_calls);
14708         }
14709 }
14710 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) {
14711         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
14712         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
14713         memcpy(claim_id_arr->elems, claim_id.data, 32);
14714         LDKCVec_InputZ must_spend_var = must_spend;
14715         uint64_tArray must_spend_arr = NULL;
14716         must_spend_arr = init_uint64_tArray(must_spend_var.datalen, __LINE__);
14717         uint64_t *must_spend_arr_ptr = (uint64_t*)(((uint8_t*)must_spend_arr) + 8);
14718         for (size_t h = 0; h < must_spend_var.datalen; h++) {
14719                 LDKInput must_spend_conv_7_var = must_spend_var.data[h];
14720                 uint64_t must_spend_conv_7_ref = 0;
14721                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_var);
14722                 must_spend_conv_7_ref = tag_ptr(must_spend_conv_7_var.inner, must_spend_conv_7_var.is_owned);
14723                 must_spend_arr_ptr[h] = must_spend_conv_7_ref;
14724         }
14725         
14726         FREE(must_spend_var.data);
14727         LDKCVec_TxOutZ must_pay_to_var = must_pay_to;
14728         uint64_tArray must_pay_to_arr = NULL;
14729         must_pay_to_arr = init_uint64_tArray(must_pay_to_var.datalen, __LINE__);
14730         uint64_t *must_pay_to_arr_ptr = (uint64_t*)(((uint8_t*)must_pay_to_arr) + 8);
14731         for (size_t h = 0; h < must_pay_to_var.datalen; h++) {
14732                 LDKTxOut* must_pay_to_conv_7_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
14733                 *must_pay_to_conv_7_ref = must_pay_to_var.data[h];
14734                 must_pay_to_arr_ptr[h] = tag_ptr(must_pay_to_conv_7_ref, true);
14735         }
14736         
14737         FREE(must_pay_to_var.data);
14738         int32_t target_feerate_sat_per_1000_weight_conv = target_feerate_sat_per_1000_weight;
14739         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);
14740         void* ret_ptr = untag_ptr(ret);
14741         CHECK_ACCESS(ret_ptr);
14742         LDKCResult_CoinSelectionNoneZ ret_conv = *(LDKCResult_CoinSelectionNoneZ*)(ret_ptr);
14743         FREE(untag_ptr(ret));
14744         return ret_conv;
14745 }
14746 LDKCResult_TransactionNoneZ sign_tx_LDKCoinSelectionSource_jcall(const void* this_arg, LDKTransaction tx) {
14747         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
14748         LDKTransaction tx_var = tx;
14749         int8_tArray tx_arr = init_int8_tArray(tx_var.datalen, __LINE__);
14750         memcpy(tx_arr->elems, tx_var.data, tx_var.datalen);
14751         Transaction_free(tx_var);
14752         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 141, (uint32_t)tx_arr, 0, 0, 0, 0, 0);
14753         void* ret_ptr = untag_ptr(ret);
14754         CHECK_ACCESS(ret_ptr);
14755         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
14756         FREE(untag_ptr(ret));
14757         return ret_conv;
14758 }
14759 static void LDKCoinSelectionSource_JCalls_cloned(LDKCoinSelectionSource* new_obj) {
14760         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) new_obj->this_arg;
14761         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14762 }
14763 static inline LDKCoinSelectionSource LDKCoinSelectionSource_init (JSValue o) {
14764         LDKCoinSelectionSource_JCalls *calls = MALLOC(sizeof(LDKCoinSelectionSource_JCalls), "LDKCoinSelectionSource_JCalls");
14765         atomic_init(&calls->refcnt, 1);
14766         calls->instance_ptr = o;
14767
14768         LDKCoinSelectionSource ret = {
14769                 .this_arg = (void*) calls,
14770                 .select_confirmed_utxos = select_confirmed_utxos_LDKCoinSelectionSource_jcall,
14771                 .sign_tx = sign_tx_LDKCoinSelectionSource_jcall,
14772                 .free = LDKCoinSelectionSource_JCalls_free,
14773         };
14774         return ret;
14775 }
14776 uint64_t  __attribute__((export_name("TS_LDKCoinSelectionSource_new"))) TS_LDKCoinSelectionSource_new(JSValue o) {
14777         LDKCoinSelectionSource *res_ptr = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
14778         *res_ptr = LDKCoinSelectionSource_init(o);
14779         return tag_ptr(res_ptr, true);
14780 }
14781 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) {
14782         void* this_arg_ptr = untag_ptr(this_arg);
14783         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14784         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
14785         LDKThirtyTwoBytes claim_id_ref;
14786         CHECK(claim_id->arr_len == 32);
14787         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
14788         LDKCVec_InputZ must_spend_constr;
14789         must_spend_constr.datalen = must_spend->arr_len;
14790         if (must_spend_constr.datalen > 0)
14791                 must_spend_constr.data = MALLOC(must_spend_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
14792         else
14793                 must_spend_constr.data = NULL;
14794         uint64_t* must_spend_vals = must_spend->elems;
14795         for (size_t h = 0; h < must_spend_constr.datalen; h++) {
14796                 uint64_t must_spend_conv_7 = must_spend_vals[h];
14797                 LDKInput must_spend_conv_7_conv;
14798                 must_spend_conv_7_conv.inner = untag_ptr(must_spend_conv_7);
14799                 must_spend_conv_7_conv.is_owned = ptr_is_owned(must_spend_conv_7);
14800                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_conv);
14801                 must_spend_conv_7_conv = Input_clone(&must_spend_conv_7_conv);
14802                 must_spend_constr.data[h] = must_spend_conv_7_conv;
14803         }
14804         FREE(must_spend);
14805         LDKCVec_TxOutZ must_pay_to_constr;
14806         must_pay_to_constr.datalen = must_pay_to->arr_len;
14807         if (must_pay_to_constr.datalen > 0)
14808                 must_pay_to_constr.data = MALLOC(must_pay_to_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
14809         else
14810                 must_pay_to_constr.data = NULL;
14811         uint64_t* must_pay_to_vals = must_pay_to->elems;
14812         for (size_t h = 0; h < must_pay_to_constr.datalen; h++) {
14813                 uint64_t must_pay_to_conv_7 = must_pay_to_vals[h];
14814                 void* must_pay_to_conv_7_ptr = untag_ptr(must_pay_to_conv_7);
14815                 CHECK_ACCESS(must_pay_to_conv_7_ptr);
14816                 LDKTxOut must_pay_to_conv_7_conv = *(LDKTxOut*)(must_pay_to_conv_7_ptr);
14817                 must_pay_to_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(must_pay_to_conv_7));
14818                 must_pay_to_constr.data[h] = must_pay_to_conv_7_conv;
14819         }
14820         FREE(must_pay_to);
14821         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
14822         *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);
14823         return tag_ptr(ret_conv, true);
14824 }
14825
14826 uint64_t  __attribute__((export_name("TS_CoinSelectionSource_sign_tx"))) TS_CoinSelectionSource_sign_tx(uint64_t this_arg, int8_tArray tx) {
14827         void* this_arg_ptr = untag_ptr(this_arg);
14828         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14829         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
14830         LDKTransaction tx_ref;
14831         tx_ref.datalen = tx->arr_len;
14832         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
14833         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
14834         tx_ref.data_is_owned = true;
14835         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
14836         *ret_conv = (this_arg_conv->sign_tx)(this_arg_conv->this_arg, tx_ref);
14837         return tag_ptr(ret_conv, true);
14838 }
14839
14840 typedef struct LDKWalletSource_JCalls {
14841         atomic_size_t refcnt;
14842         uint32_t instance_ptr;
14843 } LDKWalletSource_JCalls;
14844 static void LDKWalletSource_JCalls_free(void* this_arg) {
14845         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
14846         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14847                 FREE(j_calls);
14848         }
14849 }
14850 LDKCResult_CVec_UtxoZNoneZ list_confirmed_utxos_LDKWalletSource_jcall(const void* this_arg) {
14851         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
14852         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 142, 0, 0, 0, 0, 0, 0);
14853         void* ret_ptr = untag_ptr(ret);
14854         CHECK_ACCESS(ret_ptr);
14855         LDKCResult_CVec_UtxoZNoneZ ret_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(ret_ptr);
14856         FREE(untag_ptr(ret));
14857         return ret_conv;
14858 }
14859 LDKCResult_CVec_u8ZNoneZ get_change_script_LDKWalletSource_jcall(const void* this_arg) {
14860         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
14861         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 143, 0, 0, 0, 0, 0, 0);
14862         void* ret_ptr = untag_ptr(ret);
14863         CHECK_ACCESS(ret_ptr);
14864         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
14865         FREE(untag_ptr(ret));
14866         return ret_conv;
14867 }
14868 LDKCResult_TransactionNoneZ sign_tx_LDKWalletSource_jcall(const void* this_arg, LDKTransaction tx) {
14869         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
14870         LDKTransaction tx_var = tx;
14871         int8_tArray tx_arr = init_int8_tArray(tx_var.datalen, __LINE__);
14872         memcpy(tx_arr->elems, tx_var.data, tx_var.datalen);
14873         Transaction_free(tx_var);
14874         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 144, (uint32_t)tx_arr, 0, 0, 0, 0, 0);
14875         void* ret_ptr = untag_ptr(ret);
14876         CHECK_ACCESS(ret_ptr);
14877         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
14878         FREE(untag_ptr(ret));
14879         return ret_conv;
14880 }
14881 static void LDKWalletSource_JCalls_cloned(LDKWalletSource* new_obj) {
14882         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) new_obj->this_arg;
14883         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14884 }
14885 static inline LDKWalletSource LDKWalletSource_init (JSValue o) {
14886         LDKWalletSource_JCalls *calls = MALLOC(sizeof(LDKWalletSource_JCalls), "LDKWalletSource_JCalls");
14887         atomic_init(&calls->refcnt, 1);
14888         calls->instance_ptr = o;
14889
14890         LDKWalletSource ret = {
14891                 .this_arg = (void*) calls,
14892                 .list_confirmed_utxos = list_confirmed_utxos_LDKWalletSource_jcall,
14893                 .get_change_script = get_change_script_LDKWalletSource_jcall,
14894                 .sign_tx = sign_tx_LDKWalletSource_jcall,
14895                 .free = LDKWalletSource_JCalls_free,
14896         };
14897         return ret;
14898 }
14899 uint64_t  __attribute__((export_name("TS_LDKWalletSource_new"))) TS_LDKWalletSource_new(JSValue o) {
14900         LDKWalletSource *res_ptr = MALLOC(sizeof(LDKWalletSource), "LDKWalletSource");
14901         *res_ptr = LDKWalletSource_init(o);
14902         return tag_ptr(res_ptr, true);
14903 }
14904 uint64_t  __attribute__((export_name("TS_WalletSource_list_confirmed_utxos"))) TS_WalletSource_list_confirmed_utxos(uint64_t this_arg) {
14905         void* this_arg_ptr = untag_ptr(this_arg);
14906         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14907         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
14908         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
14909         *ret_conv = (this_arg_conv->list_confirmed_utxos)(this_arg_conv->this_arg);
14910         return tag_ptr(ret_conv, true);
14911 }
14912
14913 uint64_t  __attribute__((export_name("TS_WalletSource_get_change_script"))) TS_WalletSource_get_change_script(uint64_t this_arg) {
14914         void* this_arg_ptr = untag_ptr(this_arg);
14915         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14916         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
14917         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
14918         *ret_conv = (this_arg_conv->get_change_script)(this_arg_conv->this_arg);
14919         return tag_ptr(ret_conv, true);
14920 }
14921
14922 uint64_t  __attribute__((export_name("TS_WalletSource_sign_tx"))) TS_WalletSource_sign_tx(uint64_t this_arg, int8_tArray tx) {
14923         void* this_arg_ptr = untag_ptr(this_arg);
14924         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14925         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
14926         LDKTransaction tx_ref;
14927         tx_ref.datalen = tx->arr_len;
14928         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
14929         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
14930         tx_ref.data_is_owned = true;
14931         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
14932         *ret_conv = (this_arg_conv->sign_tx)(this_arg_conv->this_arg, tx_ref);
14933         return tag_ptr(ret_conv, true);
14934 }
14935
14936 uint32_t __attribute__((export_name("TS_LDKGossipSync_ty_from_ptr"))) TS_LDKGossipSync_ty_from_ptr(uint64_t ptr) {
14937         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
14938         switch(obj->tag) {
14939                 case LDKGossipSync_P2P: return 0;
14940                 case LDKGossipSync_Rapid: return 1;
14941                 case LDKGossipSync_None: return 2;
14942                 default: abort();
14943         }
14944 }
14945 uint64_t __attribute__((export_name("TS_LDKGossipSync_P2P_get_p2p"))) TS_LDKGossipSync_P2P_get_p2p(uint64_t ptr) {
14946         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
14947         assert(obj->tag == LDKGossipSync_P2P);
14948                         LDKP2PGossipSync p2p_var = obj->p2p;
14949                         uint64_t p2p_ref = 0;
14950                         CHECK_INNER_FIELD_ACCESS_OR_NULL(p2p_var);
14951                         p2p_ref = tag_ptr(p2p_var.inner, false);
14952         return p2p_ref;
14953 }
14954 uint64_t __attribute__((export_name("TS_LDKGossipSync_Rapid_get_rapid"))) TS_LDKGossipSync_Rapid_get_rapid(uint64_t ptr) {
14955         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
14956         assert(obj->tag == LDKGossipSync_Rapid);
14957                         LDKRapidGossipSync rapid_var = obj->rapid;
14958                         uint64_t rapid_ref = 0;
14959                         CHECK_INNER_FIELD_ACCESS_OR_NULL(rapid_var);
14960                         rapid_ref = tag_ptr(rapid_var.inner, false);
14961         return rapid_ref;
14962 }
14963 uint32_t __attribute__((export_name("TS_LDKFallback_ty_from_ptr"))) TS_LDKFallback_ty_from_ptr(uint64_t ptr) {
14964         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
14965         switch(obj->tag) {
14966                 case LDKFallback_SegWitProgram: return 0;
14967                 case LDKFallback_PubKeyHash: return 1;
14968                 case LDKFallback_ScriptHash: return 2;
14969                 default: abort();
14970         }
14971 }
14972 int8_t __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_version"))) TS_LDKFallback_SegWitProgram_get_version(uint64_t ptr) {
14973         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
14974         assert(obj->tag == LDKFallback_SegWitProgram);
14975                         uint8_t version_val = obj->seg_wit_program.version._0;
14976         return version_val;
14977 }
14978 int8_tArray __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_program"))) TS_LDKFallback_SegWitProgram_get_program(uint64_t ptr) {
14979         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
14980         assert(obj->tag == LDKFallback_SegWitProgram);
14981                         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
14982                         int8_tArray program_arr = init_int8_tArray(program_var.datalen, __LINE__);
14983                         memcpy(program_arr->elems, program_var.data, program_var.datalen);
14984         return program_arr;
14985 }
14986 int8_tArray __attribute__((export_name("TS_LDKFallback_PubKeyHash_get_pub_key_hash"))) TS_LDKFallback_PubKeyHash_get_pub_key_hash(uint64_t ptr) {
14987         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
14988         assert(obj->tag == LDKFallback_PubKeyHash);
14989                         int8_tArray pub_key_hash_arr = init_int8_tArray(20, __LINE__);
14990                         memcpy(pub_key_hash_arr->elems, obj->pub_key_hash.data, 20);
14991         return pub_key_hash_arr;
14992 }
14993 int8_tArray __attribute__((export_name("TS_LDKFallback_ScriptHash_get_script_hash"))) TS_LDKFallback_ScriptHash_get_script_hash(uint64_t ptr) {
14994         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
14995         assert(obj->tag == LDKFallback_ScriptHash);
14996                         int8_tArray script_hash_arr = init_int8_tArray(20, __LINE__);
14997                         memcpy(script_hash_arr->elems, obj->script_hash.data, 20);
14998         return script_hash_arr;
14999 }
15000 jstring  __attribute__((export_name("TS__ldk_get_compiled_version"))) TS__ldk_get_compiled_version() {
15001         LDKStr ret_str = _ldk_get_compiled_version();
15002         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
15003         Str_free(ret_str);
15004         return ret_conv;
15005 }
15006
15007 jstring  __attribute__((export_name("TS__ldk_c_bindings_get_compiled_version"))) TS__ldk_c_bindings_get_compiled_version() {
15008         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
15009         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
15010         Str_free(ret_str);
15011         return ret_conv;
15012 }
15013
15014 int8_tArray  __attribute__((export_name("TS_U128_le_bytes"))) TS_U128_le_bytes(int8_tArray val) {
15015         LDKU128 val_ref;
15016         CHECK(val->arr_len == 16);
15017         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
15018         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
15019         memcpy(ret_arr->elems, U128_le_bytes(val_ref).data, 16);
15020         return ret_arr;
15021 }
15022
15023 int8_tArray  __attribute__((export_name("TS_U128_new"))) TS_U128_new(int8_tArray le_bytes) {
15024         LDKSixteenBytes le_bytes_ref;
15025         CHECK(le_bytes->arr_len == 16);
15026         memcpy(le_bytes_ref.data, le_bytes->elems, 16); FREE(le_bytes);
15027         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
15028         memcpy(ret_arr->elems, U128_new(le_bytes_ref).le_bytes, 16);
15029         return ret_arr;
15030 }
15031
15032 uint64_t  __attribute__((export_name("TS_BigEndianScalar_new"))) TS_BigEndianScalar_new(int8_tArray big_endian_bytes) {
15033         LDKThirtyTwoBytes big_endian_bytes_ref;
15034         CHECK(big_endian_bytes->arr_len == 32);
15035         memcpy(big_endian_bytes_ref.data, big_endian_bytes->elems, 32); FREE(big_endian_bytes);
15036         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
15037         *ret_ref = BigEndianScalar_new(big_endian_bytes_ref);
15038         return tag_ptr(ret_ref, true);
15039 }
15040
15041 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
15042         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
15043         *ret_copy = Bech32Error_clone(arg);
15044         uint64_t ret_ref = tag_ptr(ret_copy, true);
15045         return ret_ref;
15046 }
15047 int64_t  __attribute__((export_name("TS_Bech32Error_clone_ptr"))) TS_Bech32Error_clone_ptr(uint64_t arg) {
15048         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
15049         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
15050         return ret_conv;
15051 }
15052
15053 uint64_t  __attribute__((export_name("TS_Bech32Error_clone"))) TS_Bech32Error_clone(uint64_t orig) {
15054         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
15055         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
15056         *ret_copy = Bech32Error_clone(orig_conv);
15057         uint64_t ret_ref = tag_ptr(ret_copy, true);
15058         return ret_ref;
15059 }
15060
15061 void  __attribute__((export_name("TS_Bech32Error_free"))) TS_Bech32Error_free(uint64_t o) {
15062         if (!ptr_is_owned(o)) return;
15063         void* o_ptr = untag_ptr(o);
15064         CHECK_ACCESS(o_ptr);
15065         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
15066         FREE(untag_ptr(o));
15067         Bech32Error_free(o_conv);
15068 }
15069
15070 void  __attribute__((export_name("TS_Transaction_free"))) TS_Transaction_free(int8_tArray _res) {
15071         LDKTransaction _res_ref;
15072         _res_ref.datalen = _res->arr_len;
15073         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
15074         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
15075         _res_ref.data_is_owned = true;
15076         Transaction_free(_res_ref);
15077 }
15078
15079 void  __attribute__((export_name("TS_Witness_free"))) TS_Witness_free(int8_tArray _res) {
15080         LDKWitness _res_ref;
15081         _res_ref.datalen = _res->arr_len;
15082         _res_ref.data = MALLOC(_res_ref.datalen, "LDKWitness Bytes");
15083         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
15084         _res_ref.data_is_owned = true;
15085         Witness_free(_res_ref);
15086 }
15087
15088 void  __attribute__((export_name("TS_TxIn_free"))) TS_TxIn_free(uint64_t _res) {
15089         if (!ptr_is_owned(_res)) return;
15090         void* _res_ptr = untag_ptr(_res);
15091         CHECK_ACCESS(_res_ptr);
15092         LDKTxIn _res_conv = *(LDKTxIn*)(_res_ptr);
15093         FREE(untag_ptr(_res));
15094         TxIn_free(_res_conv);
15095 }
15096
15097 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) {
15098         LDKWitness witness_ref;
15099         witness_ref.datalen = witness->arr_len;
15100         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
15101         memcpy(witness_ref.data, witness->elems, witness_ref.datalen); FREE(witness);
15102         witness_ref.data_is_owned = true;
15103         LDKCVec_u8Z script_sig_ref;
15104         script_sig_ref.datalen = script_sig->arr_len;
15105         script_sig_ref.data = MALLOC(script_sig_ref.datalen, "LDKCVec_u8Z Bytes");
15106         memcpy(script_sig_ref.data, script_sig->elems, script_sig_ref.datalen); FREE(script_sig);
15107         LDKThirtyTwoBytes previous_txid_ref;
15108         CHECK(previous_txid->arr_len == 32);
15109         memcpy(previous_txid_ref.data, previous_txid->elems, 32); FREE(previous_txid);
15110         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
15111         *ret_ref = TxIn_new(witness_ref, script_sig_ref, sequence, previous_txid_ref, previous_vout);
15112         return tag_ptr(ret_ref, true);
15113 }
15114
15115 uint64_t  __attribute__((export_name("TS_TxOut_new"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
15116         LDKCVec_u8Z script_pubkey_ref;
15117         script_pubkey_ref.datalen = script_pubkey->arr_len;
15118         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
15119         memcpy(script_pubkey_ref.data, script_pubkey->elems, script_pubkey_ref.datalen); FREE(script_pubkey);
15120         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
15121         *ret_ref = TxOut_new(script_pubkey_ref, value);
15122         return tag_ptr(ret_ref, true);
15123 }
15124
15125 void  __attribute__((export_name("TS_TxOut_free"))) TS_TxOut_free(uint64_t _res) {
15126         if (!ptr_is_owned(_res)) return;
15127         void* _res_ptr = untag_ptr(_res);
15128         CHECK_ACCESS(_res_ptr);
15129         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
15130         FREE(untag_ptr(_res));
15131         TxOut_free(_res_conv);
15132 }
15133
15134 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
15135         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
15136         *ret_ref = TxOut_clone(arg);
15137         return tag_ptr(ret_ref, true);
15138 }
15139 int64_t  __attribute__((export_name("TS_TxOut_clone_ptr"))) TS_TxOut_clone_ptr(uint64_t arg) {
15140         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
15141         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
15142         return ret_conv;
15143 }
15144
15145 uint64_t  __attribute__((export_name("TS_TxOut_clone"))) TS_TxOut_clone(uint64_t orig) {
15146         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
15147         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
15148         *ret_ref = TxOut_clone(orig_conv);
15149         return tag_ptr(ret_ref, true);
15150 }
15151
15152 void  __attribute__((export_name("TS_Str_free"))) TS_Str_free(jstring _res) {
15153         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
15154         Str_free(dummy);
15155 }
15156
15157 uint64_t  __attribute__((export_name("TS_COption_u64Z_some"))) TS_COption_u64Z_some(int64_t o) {
15158         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15159         *ret_copy = COption_u64Z_some(o);
15160         uint64_t ret_ref = tag_ptr(ret_copy, true);
15161         return ret_ref;
15162 }
15163
15164 uint64_t  __attribute__((export_name("TS_COption_u64Z_none"))) TS_COption_u64Z_none() {
15165         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15166         *ret_copy = COption_u64Z_none();
15167         uint64_t ret_ref = tag_ptr(ret_copy, true);
15168         return ret_ref;
15169 }
15170
15171 void  __attribute__((export_name("TS_COption_u64Z_free"))) TS_COption_u64Z_free(uint64_t _res) {
15172         if (!ptr_is_owned(_res)) return;
15173         void* _res_ptr = untag_ptr(_res);
15174         CHECK_ACCESS(_res_ptr);
15175         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
15176         FREE(untag_ptr(_res));
15177         COption_u64Z_free(_res_conv);
15178 }
15179
15180 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
15181         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15182         *ret_copy = COption_u64Z_clone(arg);
15183         uint64_t ret_ref = tag_ptr(ret_copy, true);
15184         return ret_ref;
15185 }
15186 int64_t  __attribute__((export_name("TS_COption_u64Z_clone_ptr"))) TS_COption_u64Z_clone_ptr(uint64_t arg) {
15187         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
15188         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
15189         return ret_conv;
15190 }
15191
15192 uint64_t  __attribute__((export_name("TS_COption_u64Z_clone"))) TS_COption_u64Z_clone(uint64_t orig) {
15193         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
15194         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15195         *ret_copy = COption_u64Z_clone(orig_conv);
15196         uint64_t ret_ref = tag_ptr(ret_copy, true);
15197         return ret_ref;
15198 }
15199
15200 void  __attribute__((export_name("TS_CVec_BlindedPathZ_free"))) TS_CVec_BlindedPathZ_free(uint64_tArray _res) {
15201         LDKCVec_BlindedPathZ _res_constr;
15202         _res_constr.datalen = _res->arr_len;
15203         if (_res_constr.datalen > 0)
15204                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
15205         else
15206                 _res_constr.data = NULL;
15207         uint64_t* _res_vals = _res->elems;
15208         for (size_t n = 0; n < _res_constr.datalen; n++) {
15209                 uint64_t _res_conv_13 = _res_vals[n];
15210                 LDKBlindedPath _res_conv_13_conv;
15211                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
15212                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
15213                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
15214                 _res_constr.data[n] = _res_conv_13_conv;
15215         }
15216         FREE(_res);
15217         CVec_BlindedPathZ_free(_res_constr);
15218 }
15219
15220 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_ok"))) TS_CResult_RefundBolt12ParseErrorZ_ok(uint64_t o) {
15221         LDKRefund o_conv;
15222         o_conv.inner = untag_ptr(o);
15223         o_conv.is_owned = ptr_is_owned(o);
15224         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15225         o_conv = Refund_clone(&o_conv);
15226         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
15227         *ret_conv = CResult_RefundBolt12ParseErrorZ_ok(o_conv);
15228         return tag_ptr(ret_conv, true);
15229 }
15230
15231 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_err"))) TS_CResult_RefundBolt12ParseErrorZ_err(uint64_t e) {
15232         LDKBolt12ParseError e_conv;
15233         e_conv.inner = untag_ptr(e);
15234         e_conv.is_owned = ptr_is_owned(e);
15235         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15236         e_conv = Bolt12ParseError_clone(&e_conv);
15237         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
15238         *ret_conv = CResult_RefundBolt12ParseErrorZ_err(e_conv);
15239         return tag_ptr(ret_conv, true);
15240 }
15241
15242 jboolean  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_is_ok"))) TS_CResult_RefundBolt12ParseErrorZ_is_ok(uint64_t o) {
15243         LDKCResult_RefundBolt12ParseErrorZ* o_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(o);
15244         jboolean ret_conv = CResult_RefundBolt12ParseErrorZ_is_ok(o_conv);
15245         return ret_conv;
15246 }
15247
15248 void  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_free"))) TS_CResult_RefundBolt12ParseErrorZ_free(uint64_t _res) {
15249         if (!ptr_is_owned(_res)) return;
15250         void* _res_ptr = untag_ptr(_res);
15251         CHECK_ACCESS(_res_ptr);
15252         LDKCResult_RefundBolt12ParseErrorZ _res_conv = *(LDKCResult_RefundBolt12ParseErrorZ*)(_res_ptr);
15253         FREE(untag_ptr(_res));
15254         CResult_RefundBolt12ParseErrorZ_free(_res_conv);
15255 }
15256
15257 static inline uint64_t CResult_RefundBolt12ParseErrorZ_clone_ptr(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR arg) {
15258         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
15259         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(arg);
15260         return tag_ptr(ret_conv, true);
15261 }
15262 int64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_clone_ptr"))) TS_CResult_RefundBolt12ParseErrorZ_clone_ptr(uint64_t arg) {
15263         LDKCResult_RefundBolt12ParseErrorZ* arg_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(arg);
15264         int64_t ret_conv = CResult_RefundBolt12ParseErrorZ_clone_ptr(arg_conv);
15265         return ret_conv;
15266 }
15267
15268 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_clone"))) TS_CResult_RefundBolt12ParseErrorZ_clone(uint64_t orig) {
15269         LDKCResult_RefundBolt12ParseErrorZ* orig_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(orig);
15270         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
15271         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(orig_conv);
15272         return tag_ptr(ret_conv, true);
15273 }
15274
15275 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_ok"))) TS_CResult_RetryDecodeErrorZ_ok(uint64_t o) {
15276         void* o_ptr = untag_ptr(o);
15277         CHECK_ACCESS(o_ptr);
15278         LDKRetry o_conv = *(LDKRetry*)(o_ptr);
15279         o_conv = Retry_clone((LDKRetry*)untag_ptr(o));
15280         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
15281         *ret_conv = CResult_RetryDecodeErrorZ_ok(o_conv);
15282         return tag_ptr(ret_conv, true);
15283 }
15284
15285 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_err"))) TS_CResult_RetryDecodeErrorZ_err(uint64_t e) {
15286         void* e_ptr = untag_ptr(e);
15287         CHECK_ACCESS(e_ptr);
15288         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15289         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15290         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
15291         *ret_conv = CResult_RetryDecodeErrorZ_err(e_conv);
15292         return tag_ptr(ret_conv, true);
15293 }
15294
15295 jboolean  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_is_ok"))) TS_CResult_RetryDecodeErrorZ_is_ok(uint64_t o) {
15296         LDKCResult_RetryDecodeErrorZ* o_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(o);
15297         jboolean ret_conv = CResult_RetryDecodeErrorZ_is_ok(o_conv);
15298         return ret_conv;
15299 }
15300
15301 void  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_free"))) TS_CResult_RetryDecodeErrorZ_free(uint64_t _res) {
15302         if (!ptr_is_owned(_res)) return;
15303         void* _res_ptr = untag_ptr(_res);
15304         CHECK_ACCESS(_res_ptr);
15305         LDKCResult_RetryDecodeErrorZ _res_conv = *(LDKCResult_RetryDecodeErrorZ*)(_res_ptr);
15306         FREE(untag_ptr(_res));
15307         CResult_RetryDecodeErrorZ_free(_res_conv);
15308 }
15309
15310 static inline uint64_t CResult_RetryDecodeErrorZ_clone_ptr(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR arg) {
15311         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
15312         *ret_conv = CResult_RetryDecodeErrorZ_clone(arg);
15313         return tag_ptr(ret_conv, true);
15314 }
15315 int64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_clone_ptr"))) TS_CResult_RetryDecodeErrorZ_clone_ptr(uint64_t arg) {
15316         LDKCResult_RetryDecodeErrorZ* arg_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(arg);
15317         int64_t ret_conv = CResult_RetryDecodeErrorZ_clone_ptr(arg_conv);
15318         return ret_conv;
15319 }
15320
15321 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_clone"))) TS_CResult_RetryDecodeErrorZ_clone(uint64_t orig) {
15322         LDKCResult_RetryDecodeErrorZ* orig_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(orig);
15323         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
15324         *ret_conv = CResult_RetryDecodeErrorZ_clone(orig_conv);
15325         return tag_ptr(ret_conv, true);
15326 }
15327
15328 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_ok"))) TS_CResult_NoneAPIErrorZ_ok() {
15329         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15330         *ret_conv = CResult_NoneAPIErrorZ_ok();
15331         return tag_ptr(ret_conv, true);
15332 }
15333
15334 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_err"))) TS_CResult_NoneAPIErrorZ_err(uint64_t e) {
15335         void* e_ptr = untag_ptr(e);
15336         CHECK_ACCESS(e_ptr);
15337         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15338         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
15339         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15340         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
15341         return tag_ptr(ret_conv, true);
15342 }
15343
15344 jboolean  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_is_ok"))) TS_CResult_NoneAPIErrorZ_is_ok(uint64_t o) {
15345         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
15346         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
15347         return ret_conv;
15348 }
15349
15350 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_free"))) TS_CResult_NoneAPIErrorZ_free(uint64_t _res) {
15351         if (!ptr_is_owned(_res)) return;
15352         void* _res_ptr = untag_ptr(_res);
15353         CHECK_ACCESS(_res_ptr);
15354         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
15355         FREE(untag_ptr(_res));
15356         CResult_NoneAPIErrorZ_free(_res_conv);
15357 }
15358
15359 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
15360         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15361         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
15362         return tag_ptr(ret_conv, true);
15363 }
15364 int64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone_ptr"))) TS_CResult_NoneAPIErrorZ_clone_ptr(uint64_t arg) {
15365         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
15366         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
15367         return ret_conv;
15368 }
15369
15370 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone"))) TS_CResult_NoneAPIErrorZ_clone(uint64_t orig) {
15371         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
15372         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15373         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
15374         return tag_ptr(ret_conv, true);
15375 }
15376
15377 void  __attribute__((export_name("TS_CVec_CResult_NoneAPIErrorZZ_free"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint64_tArray _res) {
15378         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
15379         _res_constr.datalen = _res->arr_len;
15380         if (_res_constr.datalen > 0)
15381                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
15382         else
15383                 _res_constr.data = NULL;
15384         uint64_t* _res_vals = _res->elems;
15385         for (size_t w = 0; w < _res_constr.datalen; w++) {
15386                 uint64_t _res_conv_22 = _res_vals[w];
15387                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
15388                 CHECK_ACCESS(_res_conv_22_ptr);
15389                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
15390                 FREE(untag_ptr(_res_conv_22));
15391                 _res_constr.data[w] = _res_conv_22_conv;
15392         }
15393         FREE(_res);
15394         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
15395 }
15396
15397 void  __attribute__((export_name("TS_CVec_APIErrorZ_free"))) TS_CVec_APIErrorZ_free(uint64_tArray _res) {
15398         LDKCVec_APIErrorZ _res_constr;
15399         _res_constr.datalen = _res->arr_len;
15400         if (_res_constr.datalen > 0)
15401                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
15402         else
15403                 _res_constr.data = NULL;
15404         uint64_t* _res_vals = _res->elems;
15405         for (size_t k = 0; k < _res_constr.datalen; k++) {
15406                 uint64_t _res_conv_10 = _res_vals[k];
15407                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
15408                 CHECK_ACCESS(_res_conv_10_ptr);
15409                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
15410                 FREE(untag_ptr(_res_conv_10));
15411                 _res_constr.data[k] = _res_conv_10_conv;
15412         }
15413         FREE(_res);
15414         CVec_APIErrorZ_free(_res_constr);
15415 }
15416
15417 uint64_t  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_some"))) TS_COption_ThirtyTwoBytesZ_some(int8_tArray o) {
15418         LDKThirtyTwoBytes o_ref;
15419         CHECK(o->arr_len == 32);
15420         memcpy(o_ref.data, o->elems, 32); FREE(o);
15421         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
15422         *ret_copy = COption_ThirtyTwoBytesZ_some(o_ref);
15423         uint64_t ret_ref = tag_ptr(ret_copy, true);
15424         return ret_ref;
15425 }
15426
15427 uint64_t  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_none"))) TS_COption_ThirtyTwoBytesZ_none() {
15428         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
15429         *ret_copy = COption_ThirtyTwoBytesZ_none();
15430         uint64_t ret_ref = tag_ptr(ret_copy, true);
15431         return ret_ref;
15432 }
15433
15434 void  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_free"))) TS_COption_ThirtyTwoBytesZ_free(uint64_t _res) {
15435         if (!ptr_is_owned(_res)) return;
15436         void* _res_ptr = untag_ptr(_res);
15437         CHECK_ACCESS(_res_ptr);
15438         LDKCOption_ThirtyTwoBytesZ _res_conv = *(LDKCOption_ThirtyTwoBytesZ*)(_res_ptr);
15439         FREE(untag_ptr(_res));
15440         COption_ThirtyTwoBytesZ_free(_res_conv);
15441 }
15442
15443 static inline uint64_t COption_ThirtyTwoBytesZ_clone_ptr(LDKCOption_ThirtyTwoBytesZ *NONNULL_PTR arg) {
15444         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
15445         *ret_copy = COption_ThirtyTwoBytesZ_clone(arg);
15446         uint64_t ret_ref = tag_ptr(ret_copy, true);
15447         return ret_ref;
15448 }
15449 int64_t  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_clone_ptr"))) TS_COption_ThirtyTwoBytesZ_clone_ptr(uint64_t arg) {
15450         LDKCOption_ThirtyTwoBytesZ* arg_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(arg);
15451         int64_t ret_conv = COption_ThirtyTwoBytesZ_clone_ptr(arg_conv);
15452         return ret_conv;
15453 }
15454
15455 uint64_t  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_clone"))) TS_COption_ThirtyTwoBytesZ_clone(uint64_t orig) {
15456         LDKCOption_ThirtyTwoBytesZ* orig_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(orig);
15457         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
15458         *ret_copy = COption_ThirtyTwoBytesZ_clone(orig_conv);
15459         uint64_t ret_ref = tag_ptr(ret_copy, true);
15460         return ret_ref;
15461 }
15462
15463 void  __attribute__((export_name("TS_CVec_u8Z_free"))) TS_CVec_u8Z_free(int8_tArray _res) {
15464         LDKCVec_u8Z _res_ref;
15465         _res_ref.datalen = _res->arr_len;
15466         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
15467         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
15468         CVec_u8Z_free(_res_ref);
15469 }
15470
15471 uint64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_some"))) TS_COption_CVec_u8ZZ_some(int8_tArray o) {
15472         LDKCVec_u8Z o_ref;
15473         o_ref.datalen = o->arr_len;
15474         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
15475         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
15476         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
15477         *ret_copy = COption_CVec_u8ZZ_some(o_ref);
15478         uint64_t ret_ref = tag_ptr(ret_copy, true);
15479         return ret_ref;
15480 }
15481
15482 uint64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_none"))) TS_COption_CVec_u8ZZ_none() {
15483         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
15484         *ret_copy = COption_CVec_u8ZZ_none();
15485         uint64_t ret_ref = tag_ptr(ret_copy, true);
15486         return ret_ref;
15487 }
15488
15489 void  __attribute__((export_name("TS_COption_CVec_u8ZZ_free"))) TS_COption_CVec_u8ZZ_free(uint64_t _res) {
15490         if (!ptr_is_owned(_res)) return;
15491         void* _res_ptr = untag_ptr(_res);
15492         CHECK_ACCESS(_res_ptr);
15493         LDKCOption_CVec_u8ZZ _res_conv = *(LDKCOption_CVec_u8ZZ*)(_res_ptr);
15494         FREE(untag_ptr(_res));
15495         COption_CVec_u8ZZ_free(_res_conv);
15496 }
15497
15498 static inline uint64_t COption_CVec_u8ZZ_clone_ptr(LDKCOption_CVec_u8ZZ *NONNULL_PTR arg) {
15499         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
15500         *ret_copy = COption_CVec_u8ZZ_clone(arg);
15501         uint64_t ret_ref = tag_ptr(ret_copy, true);
15502         return ret_ref;
15503 }
15504 int64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_clone_ptr"))) TS_COption_CVec_u8ZZ_clone_ptr(uint64_t arg) {
15505         LDKCOption_CVec_u8ZZ* arg_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(arg);
15506         int64_t ret_conv = COption_CVec_u8ZZ_clone_ptr(arg_conv);
15507         return ret_conv;
15508 }
15509
15510 uint64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_clone"))) TS_COption_CVec_u8ZZ_clone(uint64_t orig) {
15511         LDKCOption_CVec_u8ZZ* orig_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(orig);
15512         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
15513         *ret_copy = COption_CVec_u8ZZ_clone(orig_conv);
15514         uint64_t ret_ref = tag_ptr(ret_copy, true);
15515         return ret_ref;
15516 }
15517
15518 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_ok"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_ok(uint64_t o) {
15519         LDKRecipientOnionFields o_conv;
15520         o_conv.inner = untag_ptr(o);
15521         o_conv.is_owned = ptr_is_owned(o);
15522         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15523         o_conv = RecipientOnionFields_clone(&o_conv);
15524         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
15525         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_ok(o_conv);
15526         return tag_ptr(ret_conv, true);
15527 }
15528
15529 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_err"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_err(uint64_t e) {
15530         void* e_ptr = untag_ptr(e);
15531         CHECK_ACCESS(e_ptr);
15532         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15533         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15534         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
15535         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_err(e_conv);
15536         return tag_ptr(ret_conv, true);
15537 }
15538
15539 jboolean  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_is_ok"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(uint64_t o) {
15540         LDKCResult_RecipientOnionFieldsDecodeErrorZ* o_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(o);
15541         jboolean ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(o_conv);
15542         return ret_conv;
15543 }
15544
15545 void  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_free"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_free(uint64_t _res) {
15546         if (!ptr_is_owned(_res)) return;
15547         void* _res_ptr = untag_ptr(_res);
15548         CHECK_ACCESS(_res_ptr);
15549         LDKCResult_RecipientOnionFieldsDecodeErrorZ _res_conv = *(LDKCResult_RecipientOnionFieldsDecodeErrorZ*)(_res_ptr);
15550         FREE(untag_ptr(_res));
15551         CResult_RecipientOnionFieldsDecodeErrorZ_free(_res_conv);
15552 }
15553
15554 static inline uint64_t CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR arg) {
15555         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
15556         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(arg);
15557         return tag_ptr(ret_conv, true);
15558 }
15559 int64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(uint64_t arg) {
15560         LDKCResult_RecipientOnionFieldsDecodeErrorZ* arg_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(arg);
15561         int64_t ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(arg_conv);
15562         return ret_conv;
15563 }
15564
15565 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone(uint64_t orig) {
15566         LDKCResult_RecipientOnionFieldsDecodeErrorZ* orig_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(orig);
15567         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
15568         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(orig_conv);
15569         return tag_ptr(ret_conv, true);
15570 }
15571
15572 static inline uint64_t C2Tuple_u64CVec_u8ZZ_clone_ptr(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR arg) {
15573         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
15574         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(arg);
15575         return tag_ptr(ret_conv, true);
15576 }
15577 int64_t  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_clone_ptr"))) TS_C2Tuple_u64CVec_u8ZZ_clone_ptr(uint64_t arg) {
15578         LDKC2Tuple_u64CVec_u8ZZ* arg_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(arg);
15579         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_clone_ptr(arg_conv);
15580         return ret_conv;
15581 }
15582
15583 uint64_t  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_clone"))) TS_C2Tuple_u64CVec_u8ZZ_clone(uint64_t orig) {
15584         LDKC2Tuple_u64CVec_u8ZZ* orig_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(orig);
15585         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
15586         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(orig_conv);
15587         return tag_ptr(ret_conv, true);
15588 }
15589
15590 uint64_t  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_new"))) TS_C2Tuple_u64CVec_u8ZZ_new(int64_t a, int8_tArray b) {
15591         LDKCVec_u8Z b_ref;
15592         b_ref.datalen = b->arr_len;
15593         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
15594         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
15595         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
15596         *ret_conv = C2Tuple_u64CVec_u8ZZ_new(a, b_ref);
15597         return tag_ptr(ret_conv, true);
15598 }
15599
15600 void  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_free"))) TS_C2Tuple_u64CVec_u8ZZ_free(uint64_t _res) {
15601         if (!ptr_is_owned(_res)) return;
15602         void* _res_ptr = untag_ptr(_res);
15603         CHECK_ACCESS(_res_ptr);
15604         LDKC2Tuple_u64CVec_u8ZZ _res_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_ptr);
15605         FREE(untag_ptr(_res));
15606         C2Tuple_u64CVec_u8ZZ_free(_res_conv);
15607 }
15608
15609 void  __attribute__((export_name("TS_CVec_C2Tuple_u64CVec_u8ZZZ_free"))) TS_CVec_C2Tuple_u64CVec_u8ZZZ_free(uint64_tArray _res) {
15610         LDKCVec_C2Tuple_u64CVec_u8ZZZ _res_constr;
15611         _res_constr.datalen = _res->arr_len;
15612         if (_res_constr.datalen > 0)
15613                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
15614         else
15615                 _res_constr.data = NULL;
15616         uint64_t* _res_vals = _res->elems;
15617         for (size_t x = 0; x < _res_constr.datalen; x++) {
15618                 uint64_t _res_conv_23 = _res_vals[x];
15619                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
15620                 CHECK_ACCESS(_res_conv_23_ptr);
15621                 LDKC2Tuple_u64CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_conv_23_ptr);
15622                 FREE(untag_ptr(_res_conv_23));
15623                 _res_constr.data[x] = _res_conv_23_conv;
15624         }
15625         FREE(_res);
15626         CVec_C2Tuple_u64CVec_u8ZZZ_free(_res_constr);
15627 }
15628
15629 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_ok"))) TS_CResult_RecipientOnionFieldsNoneZ_ok(uint64_t o) {
15630         LDKRecipientOnionFields o_conv;
15631         o_conv.inner = untag_ptr(o);
15632         o_conv.is_owned = ptr_is_owned(o);
15633         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15634         o_conv = RecipientOnionFields_clone(&o_conv);
15635         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
15636         *ret_conv = CResult_RecipientOnionFieldsNoneZ_ok(o_conv);
15637         return tag_ptr(ret_conv, true);
15638 }
15639
15640 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_err"))) TS_CResult_RecipientOnionFieldsNoneZ_err() {
15641         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
15642         *ret_conv = CResult_RecipientOnionFieldsNoneZ_err();
15643         return tag_ptr(ret_conv, true);
15644 }
15645
15646 jboolean  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_is_ok"))) TS_CResult_RecipientOnionFieldsNoneZ_is_ok(uint64_t o) {
15647         LDKCResult_RecipientOnionFieldsNoneZ* o_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(o);
15648         jboolean ret_conv = CResult_RecipientOnionFieldsNoneZ_is_ok(o_conv);
15649         return ret_conv;
15650 }
15651
15652 void  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_free"))) TS_CResult_RecipientOnionFieldsNoneZ_free(uint64_t _res) {
15653         if (!ptr_is_owned(_res)) return;
15654         void* _res_ptr = untag_ptr(_res);
15655         CHECK_ACCESS(_res_ptr);
15656         LDKCResult_RecipientOnionFieldsNoneZ _res_conv = *(LDKCResult_RecipientOnionFieldsNoneZ*)(_res_ptr);
15657         FREE(untag_ptr(_res));
15658         CResult_RecipientOnionFieldsNoneZ_free(_res_conv);
15659 }
15660
15661 static inline uint64_t CResult_RecipientOnionFieldsNoneZ_clone_ptr(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR arg) {
15662         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
15663         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(arg);
15664         return tag_ptr(ret_conv, true);
15665 }
15666 int64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_clone_ptr"))) TS_CResult_RecipientOnionFieldsNoneZ_clone_ptr(uint64_t arg) {
15667         LDKCResult_RecipientOnionFieldsNoneZ* arg_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(arg);
15668         int64_t ret_conv = CResult_RecipientOnionFieldsNoneZ_clone_ptr(arg_conv);
15669         return ret_conv;
15670 }
15671
15672 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_clone"))) TS_CResult_RecipientOnionFieldsNoneZ_clone(uint64_t orig) {
15673         LDKCResult_RecipientOnionFieldsNoneZ* orig_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(orig);
15674         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
15675         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(orig_conv);
15676         return tag_ptr(ret_conv, true);
15677 }
15678
15679 void  __attribute__((export_name("TS_CVec_ThirtyTwoBytesZ_free"))) TS_CVec_ThirtyTwoBytesZ_free(ptrArray _res) {
15680         LDKCVec_ThirtyTwoBytesZ _res_constr;
15681         _res_constr.datalen = _res->arr_len;
15682         if (_res_constr.datalen > 0)
15683                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
15684         else
15685                 _res_constr.data = NULL;
15686         int8_tArray* _res_vals = (void*) _res->elems;
15687         for (size_t m = 0; m < _res_constr.datalen; m++) {
15688                 int8_tArray _res_conv_12 = _res_vals[m];
15689                 LDKThirtyTwoBytes _res_conv_12_ref;
15690                 CHECK(_res_conv_12->arr_len == 32);
15691                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
15692                 _res_constr.data[m] = _res_conv_12_ref;
15693         }
15694         FREE(_res);
15695         CVec_ThirtyTwoBytesZ_free(_res_constr);
15696 }
15697
15698 uint64_t  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_some"))) TS_COption_CVec_ThirtyTwoBytesZZ_some(ptrArray o) {
15699         LDKCVec_ThirtyTwoBytesZ o_constr;
15700         o_constr.datalen = o->arr_len;
15701         if (o_constr.datalen > 0)
15702                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
15703         else
15704                 o_constr.data = NULL;
15705         int8_tArray* o_vals = (void*) o->elems;
15706         for (size_t m = 0; m < o_constr.datalen; m++) {
15707                 int8_tArray o_conv_12 = o_vals[m];
15708                 LDKThirtyTwoBytes o_conv_12_ref;
15709                 CHECK(o_conv_12->arr_len == 32);
15710                 memcpy(o_conv_12_ref.data, o_conv_12->elems, 32); FREE(o_conv_12);
15711                 o_constr.data[m] = o_conv_12_ref;
15712         }
15713         FREE(o);
15714         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
15715         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_some(o_constr);
15716         uint64_t ret_ref = tag_ptr(ret_copy, true);
15717         return ret_ref;
15718 }
15719
15720 uint64_t  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_none"))) TS_COption_CVec_ThirtyTwoBytesZZ_none() {
15721         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
15722         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_none();
15723         uint64_t ret_ref = tag_ptr(ret_copy, true);
15724         return ret_ref;
15725 }
15726
15727 void  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_free"))) TS_COption_CVec_ThirtyTwoBytesZZ_free(uint64_t _res) {
15728         if (!ptr_is_owned(_res)) return;
15729         void* _res_ptr = untag_ptr(_res);
15730         CHECK_ACCESS(_res_ptr);
15731         LDKCOption_CVec_ThirtyTwoBytesZZ _res_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(_res_ptr);
15732         FREE(untag_ptr(_res));
15733         COption_CVec_ThirtyTwoBytesZZ_free(_res_conv);
15734 }
15735
15736 static inline uint64_t COption_CVec_ThirtyTwoBytesZZ_clone_ptr(LDKCOption_CVec_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
15737         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
15738         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(arg);
15739         uint64_t ret_ref = tag_ptr(ret_copy, true);
15740         return ret_ref;
15741 }
15742 int64_t  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_clone_ptr"))) TS_COption_CVec_ThirtyTwoBytesZZ_clone_ptr(uint64_t arg) {
15743         LDKCOption_CVec_ThirtyTwoBytesZZ* arg_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(arg);
15744         int64_t ret_conv = COption_CVec_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
15745         return ret_conv;
15746 }
15747
15748 uint64_t  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_clone"))) TS_COption_CVec_ThirtyTwoBytesZZ_clone(uint64_t orig) {
15749         LDKCOption_CVec_ThirtyTwoBytesZZ* orig_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(orig);
15750         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
15751         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(orig_conv);
15752         uint64_t ret_ref = tag_ptr(ret_copy, true);
15753         return ret_ref;
15754 }
15755
15756 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_ok"))) TS_CResult_ThirtyTwoBytesNoneZ_ok(int8_tArray o) {
15757         LDKThirtyTwoBytes o_ref;
15758         CHECK(o->arr_len == 32);
15759         memcpy(o_ref.data, o->elems, 32); FREE(o);
15760         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
15761         *ret_conv = CResult_ThirtyTwoBytesNoneZ_ok(o_ref);
15762         return tag_ptr(ret_conv, true);
15763 }
15764
15765 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_err"))) TS_CResult_ThirtyTwoBytesNoneZ_err() {
15766         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
15767         *ret_conv = CResult_ThirtyTwoBytesNoneZ_err();
15768         return tag_ptr(ret_conv, true);
15769 }
15770
15771 jboolean  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_is_ok"))) TS_CResult_ThirtyTwoBytesNoneZ_is_ok(uint64_t o) {
15772         LDKCResult_ThirtyTwoBytesNoneZ* o_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(o);
15773         jboolean ret_conv = CResult_ThirtyTwoBytesNoneZ_is_ok(o_conv);
15774         return ret_conv;
15775 }
15776
15777 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_free"))) TS_CResult_ThirtyTwoBytesNoneZ_free(uint64_t _res) {
15778         if (!ptr_is_owned(_res)) return;
15779         void* _res_ptr = untag_ptr(_res);
15780         CHECK_ACCESS(_res_ptr);
15781         LDKCResult_ThirtyTwoBytesNoneZ _res_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(_res_ptr);
15782         FREE(untag_ptr(_res));
15783         CResult_ThirtyTwoBytesNoneZ_free(_res_conv);
15784 }
15785
15786 static inline uint64_t CResult_ThirtyTwoBytesNoneZ_clone_ptr(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR arg) {
15787         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
15788         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(arg);
15789         return tag_ptr(ret_conv, true);
15790 }
15791 int64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_clone_ptr"))) TS_CResult_ThirtyTwoBytesNoneZ_clone_ptr(uint64_t arg) {
15792         LDKCResult_ThirtyTwoBytesNoneZ* arg_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(arg);
15793         int64_t ret_conv = CResult_ThirtyTwoBytesNoneZ_clone_ptr(arg_conv);
15794         return ret_conv;
15795 }
15796
15797 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_clone"))) TS_CResult_ThirtyTwoBytesNoneZ_clone(uint64_t orig) {
15798         LDKCResult_ThirtyTwoBytesNoneZ* orig_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(orig);
15799         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
15800         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(orig_conv);
15801         return tag_ptr(ret_conv, true);
15802 }
15803
15804 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_ok"))) TS_CResult_BlindedPayInfoDecodeErrorZ_ok(uint64_t o) {
15805         LDKBlindedPayInfo o_conv;
15806         o_conv.inner = untag_ptr(o);
15807         o_conv.is_owned = ptr_is_owned(o);
15808         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15809         o_conv = BlindedPayInfo_clone(&o_conv);
15810         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
15811         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_ok(o_conv);
15812         return tag_ptr(ret_conv, true);
15813 }
15814
15815 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_err"))) TS_CResult_BlindedPayInfoDecodeErrorZ_err(uint64_t e) {
15816         void* e_ptr = untag_ptr(e);
15817         CHECK_ACCESS(e_ptr);
15818         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15819         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15820         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
15821         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_err(e_conv);
15822         return tag_ptr(ret_conv, true);
15823 }
15824
15825 jboolean  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_is_ok"))) TS_CResult_BlindedPayInfoDecodeErrorZ_is_ok(uint64_t o) {
15826         LDKCResult_BlindedPayInfoDecodeErrorZ* o_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(o);
15827         jboolean ret_conv = CResult_BlindedPayInfoDecodeErrorZ_is_ok(o_conv);
15828         return ret_conv;
15829 }
15830
15831 void  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_free"))) TS_CResult_BlindedPayInfoDecodeErrorZ_free(uint64_t _res) {
15832         if (!ptr_is_owned(_res)) return;
15833         void* _res_ptr = untag_ptr(_res);
15834         CHECK_ACCESS(_res_ptr);
15835         LDKCResult_BlindedPayInfoDecodeErrorZ _res_conv = *(LDKCResult_BlindedPayInfoDecodeErrorZ*)(_res_ptr);
15836         FREE(untag_ptr(_res));
15837         CResult_BlindedPayInfoDecodeErrorZ_free(_res_conv);
15838 }
15839
15840 static inline uint64_t CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR arg) {
15841         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
15842         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(arg);
15843         return tag_ptr(ret_conv, true);
15844 }
15845 int64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
15846         LDKCResult_BlindedPayInfoDecodeErrorZ* arg_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(arg);
15847         int64_t ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(arg_conv);
15848         return ret_conv;
15849 }
15850
15851 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_clone"))) TS_CResult_BlindedPayInfoDecodeErrorZ_clone(uint64_t orig) {
15852         LDKCResult_BlindedPayInfoDecodeErrorZ* orig_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(orig);
15853         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
15854         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(orig_conv);
15855         return tag_ptr(ret_conv, true);
15856 }
15857
15858 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
15859         LDKDelayedPaymentOutputDescriptor o_conv;
15860         o_conv.inner = untag_ptr(o);
15861         o_conv.is_owned = ptr_is_owned(o);
15862         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15863         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
15864         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15865         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
15866         return tag_ptr(ret_conv, true);
15867 }
15868
15869 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
15870         void* e_ptr = untag_ptr(e);
15871         CHECK_ACCESS(e_ptr);
15872         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15873         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15874         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15875         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
15876         return tag_ptr(ret_conv, true);
15877 }
15878
15879 jboolean  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
15880         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
15881         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
15882         return ret_conv;
15883 }
15884
15885 void  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
15886         if (!ptr_is_owned(_res)) return;
15887         void* _res_ptr = untag_ptr(_res);
15888         CHECK_ACCESS(_res_ptr);
15889         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
15890         FREE(untag_ptr(_res));
15891         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
15892 }
15893
15894 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
15895         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15896         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
15897         return tag_ptr(ret_conv, true);
15898 }
15899 int64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
15900         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
15901         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
15902         return ret_conv;
15903 }
15904
15905 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
15906         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
15907         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15908         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
15909         return tag_ptr(ret_conv, true);
15910 }
15911
15912 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
15913         LDKStaticPaymentOutputDescriptor o_conv;
15914         o_conv.inner = untag_ptr(o);
15915         o_conv.is_owned = ptr_is_owned(o);
15916         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15917         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
15918         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15919         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
15920         return tag_ptr(ret_conv, true);
15921 }
15922
15923 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
15924         void* e_ptr = untag_ptr(e);
15925         CHECK_ACCESS(e_ptr);
15926         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15927         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15928         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15929         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
15930         return tag_ptr(ret_conv, true);
15931 }
15932
15933 jboolean  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
15934         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
15935         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
15936         return ret_conv;
15937 }
15938
15939 void  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
15940         if (!ptr_is_owned(_res)) return;
15941         void* _res_ptr = untag_ptr(_res);
15942         CHECK_ACCESS(_res_ptr);
15943         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
15944         FREE(untag_ptr(_res));
15945         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
15946 }
15947
15948 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
15949         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15950         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
15951         return tag_ptr(ret_conv, true);
15952 }
15953 int64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
15954         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
15955         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
15956         return ret_conv;
15957 }
15958
15959 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
15960         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
15961         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15962         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
15963         return tag_ptr(ret_conv, true);
15964 }
15965
15966 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
15967         void* o_ptr = untag_ptr(o);
15968         CHECK_ACCESS(o_ptr);
15969         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
15970         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
15971         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15972         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
15973         return tag_ptr(ret_conv, true);
15974 }
15975
15976 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint64_t e) {
15977         void* e_ptr = untag_ptr(e);
15978         CHECK_ACCESS(e_ptr);
15979         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15980         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15981         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15982         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
15983         return tag_ptr(ret_conv, true);
15984 }
15985
15986 jboolean  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
15987         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
15988         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
15989         return ret_conv;
15990 }
15991
15992 void  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
15993         if (!ptr_is_owned(_res)) return;
15994         void* _res_ptr = untag_ptr(_res);
15995         CHECK_ACCESS(_res_ptr);
15996         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
15997         FREE(untag_ptr(_res));
15998         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
15999 }
16000
16001 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
16002         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
16003         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
16004         return tag_ptr(ret_conv, true);
16005 }
16006 int64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
16007         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
16008         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
16009         return ret_conv;
16010 }
16011
16012 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
16013         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
16014         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
16015         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
16016         return tag_ptr(ret_conv, true);
16017 }
16018
16019 void  __attribute__((export_name("TS_CVec_SpendableOutputDescriptorZ_free"))) TS_CVec_SpendableOutputDescriptorZ_free(uint64_tArray _res) {
16020         LDKCVec_SpendableOutputDescriptorZ _res_constr;
16021         _res_constr.datalen = _res->arr_len;
16022         if (_res_constr.datalen > 0)
16023                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
16024         else
16025                 _res_constr.data = NULL;
16026         uint64_t* _res_vals = _res->elems;
16027         for (size_t b = 0; b < _res_constr.datalen; b++) {
16028                 uint64_t _res_conv_27 = _res_vals[b];
16029                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
16030                 CHECK_ACCESS(_res_conv_27_ptr);
16031                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
16032                 FREE(untag_ptr(_res_conv_27));
16033                 _res_constr.data[b] = _res_conv_27_conv;
16034         }
16035         FREE(_res);
16036         CVec_SpendableOutputDescriptorZ_free(_res_constr);
16037 }
16038
16039 void  __attribute__((export_name("TS_CVec_TxOutZ_free"))) TS_CVec_TxOutZ_free(uint64_tArray _res) {
16040         LDKCVec_TxOutZ _res_constr;
16041         _res_constr.datalen = _res->arr_len;
16042         if (_res_constr.datalen > 0)
16043                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
16044         else
16045                 _res_constr.data = NULL;
16046         uint64_t* _res_vals = _res->elems;
16047         for (size_t h = 0; h < _res_constr.datalen; h++) {
16048                 uint64_t _res_conv_7 = _res_vals[h];
16049                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
16050                 CHECK_ACCESS(_res_conv_7_ptr);
16051                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
16052                 FREE(untag_ptr(_res_conv_7));
16053                 _res_constr.data[h] = _res_conv_7_conv;
16054         }
16055         FREE(_res);
16056         CVec_TxOutZ_free(_res_constr);
16057 }
16058
16059 uint64_t  __attribute__((export_name("TS_COption_u32Z_some"))) TS_COption_u32Z_some(int32_t o) {
16060         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
16061         *ret_copy = COption_u32Z_some(o);
16062         uint64_t ret_ref = tag_ptr(ret_copy, true);
16063         return ret_ref;
16064 }
16065
16066 uint64_t  __attribute__((export_name("TS_COption_u32Z_none"))) TS_COption_u32Z_none() {
16067         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
16068         *ret_copy = COption_u32Z_none();
16069         uint64_t ret_ref = tag_ptr(ret_copy, true);
16070         return ret_ref;
16071 }
16072
16073 void  __attribute__((export_name("TS_COption_u32Z_free"))) TS_COption_u32Z_free(uint64_t _res) {
16074         if (!ptr_is_owned(_res)) return;
16075         void* _res_ptr = untag_ptr(_res);
16076         CHECK_ACCESS(_res_ptr);
16077         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
16078         FREE(untag_ptr(_res));
16079         COption_u32Z_free(_res_conv);
16080 }
16081
16082 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
16083         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
16084         *ret_copy = COption_u32Z_clone(arg);
16085         uint64_t ret_ref = tag_ptr(ret_copy, true);
16086         return ret_ref;
16087 }
16088 int64_t  __attribute__((export_name("TS_COption_u32Z_clone_ptr"))) TS_COption_u32Z_clone_ptr(uint64_t arg) {
16089         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
16090         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
16091         return ret_conv;
16092 }
16093
16094 uint64_t  __attribute__((export_name("TS_COption_u32Z_clone"))) TS_COption_u32Z_clone(uint64_t orig) {
16095         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
16096         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
16097         *ret_copy = COption_u32Z_clone(orig_conv);
16098         uint64_t ret_ref = tag_ptr(ret_copy, true);
16099         return ret_ref;
16100 }
16101
16102 static inline uint64_t C2Tuple_CVec_u8ZusizeZ_clone_ptr(LDKC2Tuple_CVec_u8ZusizeZ *NONNULL_PTR arg) {
16103         LDKC2Tuple_CVec_u8ZusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8ZusizeZ), "LDKC2Tuple_CVec_u8ZusizeZ");
16104         *ret_conv = C2Tuple_CVec_u8ZusizeZ_clone(arg);
16105         return tag_ptr(ret_conv, true);
16106 }
16107 int64_t  __attribute__((export_name("TS_C2Tuple_CVec_u8ZusizeZ_clone_ptr"))) TS_C2Tuple_CVec_u8ZusizeZ_clone_ptr(uint64_t arg) {
16108         LDKC2Tuple_CVec_u8ZusizeZ* arg_conv = (LDKC2Tuple_CVec_u8ZusizeZ*)untag_ptr(arg);
16109         int64_t ret_conv = C2Tuple_CVec_u8ZusizeZ_clone_ptr(arg_conv);
16110         return ret_conv;
16111 }
16112
16113 uint64_t  __attribute__((export_name("TS_C2Tuple_CVec_u8ZusizeZ_clone"))) TS_C2Tuple_CVec_u8ZusizeZ_clone(uint64_t orig) {
16114         LDKC2Tuple_CVec_u8ZusizeZ* orig_conv = (LDKC2Tuple_CVec_u8ZusizeZ*)untag_ptr(orig);
16115         LDKC2Tuple_CVec_u8ZusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8ZusizeZ), "LDKC2Tuple_CVec_u8ZusizeZ");
16116         *ret_conv = C2Tuple_CVec_u8ZusizeZ_clone(orig_conv);
16117         return tag_ptr(ret_conv, true);
16118 }
16119
16120 uint64_t  __attribute__((export_name("TS_C2Tuple_CVec_u8ZusizeZ_new"))) TS_C2Tuple_CVec_u8ZusizeZ_new(int8_tArray a, uint32_t b) {
16121         LDKCVec_u8Z a_ref;
16122         a_ref.datalen = a->arr_len;
16123         a_ref.data = MALLOC(a_ref.datalen, "LDKCVec_u8Z Bytes");
16124         memcpy(a_ref.data, a->elems, a_ref.datalen); FREE(a);
16125         LDKC2Tuple_CVec_u8ZusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8ZusizeZ), "LDKC2Tuple_CVec_u8ZusizeZ");
16126         *ret_conv = C2Tuple_CVec_u8ZusizeZ_new(a_ref, b);
16127         return tag_ptr(ret_conv, true);
16128 }
16129
16130 void  __attribute__((export_name("TS_C2Tuple_CVec_u8ZusizeZ_free"))) TS_C2Tuple_CVec_u8ZusizeZ_free(uint64_t _res) {
16131         if (!ptr_is_owned(_res)) return;
16132         void* _res_ptr = untag_ptr(_res);
16133         CHECK_ACCESS(_res_ptr);
16134         LDKC2Tuple_CVec_u8ZusizeZ _res_conv = *(LDKC2Tuple_CVec_u8ZusizeZ*)(_res_ptr);
16135         FREE(untag_ptr(_res));
16136         C2Tuple_CVec_u8ZusizeZ_free(_res_conv);
16137 }
16138
16139 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_ok"))) TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_ok(uint64_t o) {
16140         void* o_ptr = untag_ptr(o);
16141         CHECK_ACCESS(o_ptr);
16142         LDKC2Tuple_CVec_u8ZusizeZ o_conv = *(LDKC2Tuple_CVec_u8ZusizeZ*)(o_ptr);
16143         o_conv = C2Tuple_CVec_u8ZusizeZ_clone((LDKC2Tuple_CVec_u8ZusizeZ*)untag_ptr(o));
16144         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ), "LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ");
16145         *ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_ok(o_conv);
16146         return tag_ptr(ret_conv, true);
16147 }
16148
16149 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_err"))) TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_err() {
16150         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ), "LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ");
16151         *ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_err();
16152         return tag_ptr(ret_conv, true);
16153 }
16154
16155 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_is_ok"))) TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_is_ok(uint64_t o) {
16156         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* o_conv = (LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)untag_ptr(o);
16157         jboolean ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_is_ok(o_conv);
16158         return ret_conv;
16159 }
16160
16161 void  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_free"))) TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_free(uint64_t _res) {
16162         if (!ptr_is_owned(_res)) return;
16163         void* _res_ptr = untag_ptr(_res);
16164         CHECK_ACCESS(_res_ptr);
16165         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ _res_conv = *(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)(_res_ptr);
16166         FREE(untag_ptr(_res));
16167         CResult_C2Tuple_CVec_u8ZusizeZNoneZ_free(_res_conv);
16168 }
16169
16170 static inline uint64_t CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone_ptr(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ *NONNULL_PTR arg) {
16171         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ), "LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ");
16172         *ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone(arg);
16173         return tag_ptr(ret_conv, true);
16174 }
16175 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone_ptr(uint64_t arg) {
16176         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* arg_conv = (LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)untag_ptr(arg);
16177         int64_t ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone_ptr(arg_conv);
16178         return ret_conv;
16179 }
16180
16181 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone"))) TS_CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone(uint64_t orig) {
16182         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* orig_conv = (LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)untag_ptr(orig);
16183         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ), "LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ");
16184         *ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone(orig_conv);
16185         return tag_ptr(ret_conv, true);
16186 }
16187
16188 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_ok"))) TS_CResult_NoneNoneZ_ok() {
16189         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
16190         *ret_conv = CResult_NoneNoneZ_ok();
16191         return tag_ptr(ret_conv, true);
16192 }
16193
16194 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_err"))) TS_CResult_NoneNoneZ_err() {
16195         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
16196         *ret_conv = CResult_NoneNoneZ_err();
16197         return tag_ptr(ret_conv, true);
16198 }
16199
16200 jboolean  __attribute__((export_name("TS_CResult_NoneNoneZ_is_ok"))) TS_CResult_NoneNoneZ_is_ok(uint64_t o) {
16201         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
16202         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
16203         return ret_conv;
16204 }
16205
16206 void  __attribute__((export_name("TS_CResult_NoneNoneZ_free"))) TS_CResult_NoneNoneZ_free(uint64_t _res) {
16207         if (!ptr_is_owned(_res)) return;
16208         void* _res_ptr = untag_ptr(_res);
16209         CHECK_ACCESS(_res_ptr);
16210         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
16211         FREE(untag_ptr(_res));
16212         CResult_NoneNoneZ_free(_res_conv);
16213 }
16214
16215 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
16216         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
16217         *ret_conv = CResult_NoneNoneZ_clone(arg);
16218         return tag_ptr(ret_conv, true);
16219 }
16220 int64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone_ptr"))) TS_CResult_NoneNoneZ_clone_ptr(uint64_t arg) {
16221         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
16222         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
16223         return ret_conv;
16224 }
16225
16226 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone"))) TS_CResult_NoneNoneZ_clone(uint64_t orig) {
16227         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
16228         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
16229         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
16230         return tag_ptr(ret_conv, true);
16231 }
16232
16233 void  __attribute__((export_name("TS_CVec_ECDSASignatureZ_free"))) TS_CVec_ECDSASignatureZ_free(ptrArray _res) {
16234         LDKCVec_ECDSASignatureZ _res_constr;
16235         _res_constr.datalen = _res->arr_len;
16236         if (_res_constr.datalen > 0)
16237                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
16238         else
16239                 _res_constr.data = NULL;
16240         int8_tArray* _res_vals = (void*) _res->elems;
16241         for (size_t m = 0; m < _res_constr.datalen; m++) {
16242                 int8_tArray _res_conv_12 = _res_vals[m];
16243                 LDKECDSASignature _res_conv_12_ref;
16244                 CHECK(_res_conv_12->arr_len == 64);
16245                 memcpy(_res_conv_12_ref.compact_form, _res_conv_12->elems, 64); FREE(_res_conv_12);
16246                 _res_constr.data[m] = _res_conv_12_ref;
16247         }
16248         FREE(_res);
16249         CVec_ECDSASignatureZ_free(_res_constr);
16250 }
16251
16252 static inline uint64_t C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR arg) {
16253         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
16254         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(arg);
16255         return tag_ptr(ret_conv, true);
16256 }
16257 int64_t  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(uint64_t arg) {
16258         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* arg_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(arg);
16259         int64_t ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(arg_conv);
16260         return ret_conv;
16261 }
16262
16263 uint64_t  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(uint64_t orig) {
16264         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* orig_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(orig);
16265         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
16266         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(orig_conv);
16267         return tag_ptr(ret_conv, true);
16268 }
16269
16270 uint64_t  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(int8_tArray a, ptrArray b) {
16271         LDKECDSASignature a_ref;
16272         CHECK(a->arr_len == 64);
16273         memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
16274         LDKCVec_ECDSASignatureZ b_constr;
16275         b_constr.datalen = b->arr_len;
16276         if (b_constr.datalen > 0)
16277                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
16278         else
16279                 b_constr.data = NULL;
16280         int8_tArray* b_vals = (void*) b->elems;
16281         for (size_t m = 0; m < b_constr.datalen; m++) {
16282                 int8_tArray b_conv_12 = b_vals[m];
16283                 LDKECDSASignature b_conv_12_ref;
16284                 CHECK(b_conv_12->arr_len == 64);
16285                 memcpy(b_conv_12_ref.compact_form, b_conv_12->elems, 64); FREE(b_conv_12);
16286                 b_constr.data[m] = b_conv_12_ref;
16287         }
16288         FREE(b);
16289         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
16290         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(a_ref, b_constr);
16291         return tag_ptr(ret_conv, true);
16292 }
16293
16294 void  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(uint64_t _res) {
16295         if (!ptr_is_owned(_res)) return;
16296         void* _res_ptr = untag_ptr(_res);
16297         CHECK_ACCESS(_res_ptr);
16298         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ _res_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(_res_ptr);
16299         FREE(untag_ptr(_res));
16300         C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(_res_conv);
16301 }
16302
16303 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(uint64_t o) {
16304         void* o_ptr = untag_ptr(o);
16305         CHECK_ACCESS(o_ptr);
16306         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ o_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(o_ptr);
16307         o_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone((LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(o));
16308         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
16309         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(o_conv);
16310         return tag_ptr(ret_conv, true);
16311 }
16312
16313 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err() {
16314         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
16315         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err();
16316         return tag_ptr(ret_conv, true);
16317 }
16318
16319 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(uint64_t o) {
16320         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(o);
16321         jboolean ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(o_conv);
16322         return ret_conv;
16323 }
16324
16325 void  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(uint64_t _res) {
16326         if (!ptr_is_owned(_res)) return;
16327         void* _res_ptr = untag_ptr(_res);
16328         CHECK_ACCESS(_res_ptr);
16329         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(_res_ptr);
16330         FREE(untag_ptr(_res));
16331         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(_res_conv);
16332 }
16333
16334 static inline uint64_t CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR arg) {
16335         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
16336         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(arg);
16337         return tag_ptr(ret_conv, true);
16338 }
16339 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(uint64_t arg) {
16340         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(arg);
16341         int64_t ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(arg_conv);
16342         return ret_conv;
16343 }
16344
16345 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(uint64_t orig) {
16346         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(orig);
16347         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
16348         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(orig_conv);
16349         return tag_ptr(ret_conv, true);
16350 }
16351
16352 uint64_t  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_ok"))) TS_CResult_ECDSASignatureNoneZ_ok(int8_tArray o) {
16353         LDKECDSASignature o_ref;
16354         CHECK(o->arr_len == 64);
16355         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
16356         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
16357         *ret_conv = CResult_ECDSASignatureNoneZ_ok(o_ref);
16358         return tag_ptr(ret_conv, true);
16359 }
16360
16361 uint64_t  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_err"))) TS_CResult_ECDSASignatureNoneZ_err() {
16362         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
16363         *ret_conv = CResult_ECDSASignatureNoneZ_err();
16364         return tag_ptr(ret_conv, true);
16365 }
16366
16367 jboolean  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_is_ok"))) TS_CResult_ECDSASignatureNoneZ_is_ok(uint64_t o) {
16368         LDKCResult_ECDSASignatureNoneZ* o_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(o);
16369         jboolean ret_conv = CResult_ECDSASignatureNoneZ_is_ok(o_conv);
16370         return ret_conv;
16371 }
16372
16373 void  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_free"))) TS_CResult_ECDSASignatureNoneZ_free(uint64_t _res) {
16374         if (!ptr_is_owned(_res)) return;
16375         void* _res_ptr = untag_ptr(_res);
16376         CHECK_ACCESS(_res_ptr);
16377         LDKCResult_ECDSASignatureNoneZ _res_conv = *(LDKCResult_ECDSASignatureNoneZ*)(_res_ptr);
16378         FREE(untag_ptr(_res));
16379         CResult_ECDSASignatureNoneZ_free(_res_conv);
16380 }
16381
16382 static inline uint64_t CResult_ECDSASignatureNoneZ_clone_ptr(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR arg) {
16383         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
16384         *ret_conv = CResult_ECDSASignatureNoneZ_clone(arg);
16385         return tag_ptr(ret_conv, true);
16386 }
16387 int64_t  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_clone_ptr"))) TS_CResult_ECDSASignatureNoneZ_clone_ptr(uint64_t arg) {
16388         LDKCResult_ECDSASignatureNoneZ* arg_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(arg);
16389         int64_t ret_conv = CResult_ECDSASignatureNoneZ_clone_ptr(arg_conv);
16390         return ret_conv;
16391 }
16392
16393 uint64_t  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_clone"))) TS_CResult_ECDSASignatureNoneZ_clone(uint64_t orig) {
16394         LDKCResult_ECDSASignatureNoneZ* orig_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(orig);
16395         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
16396         *ret_conv = CResult_ECDSASignatureNoneZ_clone(orig_conv);
16397         return tag_ptr(ret_conv, true);
16398 }
16399
16400 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_ok"))) TS_CResult_PublicKeyNoneZ_ok(int8_tArray o) {
16401         LDKPublicKey o_ref;
16402         CHECK(o->arr_len == 33);
16403         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
16404         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
16405         *ret_conv = CResult_PublicKeyNoneZ_ok(o_ref);
16406         return tag_ptr(ret_conv, true);
16407 }
16408
16409 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_err"))) TS_CResult_PublicKeyNoneZ_err() {
16410         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
16411         *ret_conv = CResult_PublicKeyNoneZ_err();
16412         return tag_ptr(ret_conv, true);
16413 }
16414
16415 jboolean  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_is_ok"))) TS_CResult_PublicKeyNoneZ_is_ok(uint64_t o) {
16416         LDKCResult_PublicKeyNoneZ* o_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(o);
16417         jboolean ret_conv = CResult_PublicKeyNoneZ_is_ok(o_conv);
16418         return ret_conv;
16419 }
16420
16421 void  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_free"))) TS_CResult_PublicKeyNoneZ_free(uint64_t _res) {
16422         if (!ptr_is_owned(_res)) return;
16423         void* _res_ptr = untag_ptr(_res);
16424         CHECK_ACCESS(_res_ptr);
16425         LDKCResult_PublicKeyNoneZ _res_conv = *(LDKCResult_PublicKeyNoneZ*)(_res_ptr);
16426         FREE(untag_ptr(_res));
16427         CResult_PublicKeyNoneZ_free(_res_conv);
16428 }
16429
16430 static inline uint64_t CResult_PublicKeyNoneZ_clone_ptr(LDKCResult_PublicKeyNoneZ *NONNULL_PTR arg) {
16431         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
16432         *ret_conv = CResult_PublicKeyNoneZ_clone(arg);
16433         return tag_ptr(ret_conv, true);
16434 }
16435 int64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_clone_ptr"))) TS_CResult_PublicKeyNoneZ_clone_ptr(uint64_t arg) {
16436         LDKCResult_PublicKeyNoneZ* arg_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(arg);
16437         int64_t ret_conv = CResult_PublicKeyNoneZ_clone_ptr(arg_conv);
16438         return ret_conv;
16439 }
16440
16441 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_clone"))) TS_CResult_PublicKeyNoneZ_clone(uint64_t orig) {
16442         LDKCResult_PublicKeyNoneZ* orig_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(orig);
16443         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
16444         *ret_conv = CResult_PublicKeyNoneZ_clone(orig_conv);
16445         return tag_ptr(ret_conv, true);
16446 }
16447
16448 uint64_t  __attribute__((export_name("TS_COption_BigEndianScalarZ_some"))) TS_COption_BigEndianScalarZ_some(uint64_t o) {
16449         void* o_ptr = untag_ptr(o);
16450         CHECK_ACCESS(o_ptr);
16451         LDKBigEndianScalar o_conv = *(LDKBigEndianScalar*)(o_ptr);
16452         // WARNING: we may need a move here but no clone is available for LDKBigEndianScalar
16453         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
16454         *ret_copy = COption_BigEndianScalarZ_some(o_conv);
16455         uint64_t ret_ref = tag_ptr(ret_copy, true);
16456         return ret_ref;
16457 }
16458
16459 uint64_t  __attribute__((export_name("TS_COption_BigEndianScalarZ_none"))) TS_COption_BigEndianScalarZ_none() {
16460         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
16461         *ret_copy = COption_BigEndianScalarZ_none();
16462         uint64_t ret_ref = tag_ptr(ret_copy, true);
16463         return ret_ref;
16464 }
16465
16466 void  __attribute__((export_name("TS_COption_BigEndianScalarZ_free"))) TS_COption_BigEndianScalarZ_free(uint64_t _res) {
16467         if (!ptr_is_owned(_res)) return;
16468         void* _res_ptr = untag_ptr(_res);
16469         CHECK_ACCESS(_res_ptr);
16470         LDKCOption_BigEndianScalarZ _res_conv = *(LDKCOption_BigEndianScalarZ*)(_res_ptr);
16471         FREE(untag_ptr(_res));
16472         COption_BigEndianScalarZ_free(_res_conv);
16473 }
16474
16475 static inline uint64_t COption_BigEndianScalarZ_clone_ptr(LDKCOption_BigEndianScalarZ *NONNULL_PTR arg) {
16476         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
16477         *ret_copy = COption_BigEndianScalarZ_clone(arg);
16478         uint64_t ret_ref = tag_ptr(ret_copy, true);
16479         return ret_ref;
16480 }
16481 int64_t  __attribute__((export_name("TS_COption_BigEndianScalarZ_clone_ptr"))) TS_COption_BigEndianScalarZ_clone_ptr(uint64_t arg) {
16482         LDKCOption_BigEndianScalarZ* arg_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(arg);
16483         int64_t ret_conv = COption_BigEndianScalarZ_clone_ptr(arg_conv);
16484         return ret_conv;
16485 }
16486
16487 uint64_t  __attribute__((export_name("TS_COption_BigEndianScalarZ_clone"))) TS_COption_BigEndianScalarZ_clone(uint64_t orig) {
16488         LDKCOption_BigEndianScalarZ* orig_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(orig);
16489         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
16490         *ret_copy = COption_BigEndianScalarZ_clone(orig_conv);
16491         uint64_t ret_ref = tag_ptr(ret_copy, true);
16492         return ret_ref;
16493 }
16494
16495 void  __attribute__((export_name("TS_CVec_U5Z_free"))) TS_CVec_U5Z_free(ptrArray _res) {
16496         LDKCVec_U5Z _res_constr;
16497         _res_constr.datalen = _res->arr_len;
16498         if (_res_constr.datalen > 0)
16499                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
16500         else
16501                 _res_constr.data = NULL;
16502         int8_t* _res_vals = (void*) _res->elems;
16503         for (size_t h = 0; h < _res_constr.datalen; h++) {
16504                 int8_t _res_conv_7 = _res_vals[h];
16505                 
16506                 _res_constr.data[h] = (LDKU5){ ._0 = _res_conv_7 };
16507         }
16508         FREE(_res);
16509         CVec_U5Z_free(_res_constr);
16510 }
16511
16512 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_ok"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray o) {
16513         LDKRecoverableSignature o_ref;
16514         CHECK(o->arr_len == 68);
16515         memcpy(o_ref.serialized_form, o->elems, 68); FREE(o);
16516         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16517         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
16518         return tag_ptr(ret_conv, true);
16519 }
16520
16521 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_err"))) TS_CResult_RecoverableSignatureNoneZ_err() {
16522         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16523         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
16524         return tag_ptr(ret_conv, true);
16525 }
16526
16527 jboolean  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_is_ok"))) TS_CResult_RecoverableSignatureNoneZ_is_ok(uint64_t o) {
16528         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
16529         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
16530         return ret_conv;
16531 }
16532
16533 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_free"))) TS_CResult_RecoverableSignatureNoneZ_free(uint64_t _res) {
16534         if (!ptr_is_owned(_res)) return;
16535         void* _res_ptr = untag_ptr(_res);
16536         CHECK_ACCESS(_res_ptr);
16537         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
16538         FREE(untag_ptr(_res));
16539         CResult_RecoverableSignatureNoneZ_free(_res_conv);
16540 }
16541
16542 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
16543         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16544         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
16545         return tag_ptr(ret_conv, true);
16546 }
16547 int64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone_ptr"))) TS_CResult_RecoverableSignatureNoneZ_clone_ptr(uint64_t arg) {
16548         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
16549         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
16550         return ret_conv;
16551 }
16552
16553 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint64_t orig) {
16554         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
16555         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16556         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
16557         return tag_ptr(ret_conv, true);
16558 }
16559
16560 uint64_t  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_ok"))) TS_CResult_SchnorrSignatureNoneZ_ok(int8_tArray o) {
16561         LDKSchnorrSignature o_ref;
16562         CHECK(o->arr_len == 64);
16563         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
16564         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
16565         *ret_conv = CResult_SchnorrSignatureNoneZ_ok(o_ref);
16566         return tag_ptr(ret_conv, true);
16567 }
16568
16569 uint64_t  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_err"))) TS_CResult_SchnorrSignatureNoneZ_err() {
16570         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
16571         *ret_conv = CResult_SchnorrSignatureNoneZ_err();
16572         return tag_ptr(ret_conv, true);
16573 }
16574
16575 jboolean  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_is_ok"))) TS_CResult_SchnorrSignatureNoneZ_is_ok(uint64_t o) {
16576         LDKCResult_SchnorrSignatureNoneZ* o_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(o);
16577         jboolean ret_conv = CResult_SchnorrSignatureNoneZ_is_ok(o_conv);
16578         return ret_conv;
16579 }
16580
16581 void  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_free"))) TS_CResult_SchnorrSignatureNoneZ_free(uint64_t _res) {
16582         if (!ptr_is_owned(_res)) return;
16583         void* _res_ptr = untag_ptr(_res);
16584         CHECK_ACCESS(_res_ptr);
16585         LDKCResult_SchnorrSignatureNoneZ _res_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(_res_ptr);
16586         FREE(untag_ptr(_res));
16587         CResult_SchnorrSignatureNoneZ_free(_res_conv);
16588 }
16589
16590 static inline uint64_t CResult_SchnorrSignatureNoneZ_clone_ptr(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR arg) {
16591         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
16592         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(arg);
16593         return tag_ptr(ret_conv, true);
16594 }
16595 int64_t  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_clone_ptr"))) TS_CResult_SchnorrSignatureNoneZ_clone_ptr(uint64_t arg) {
16596         LDKCResult_SchnorrSignatureNoneZ* arg_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(arg);
16597         int64_t ret_conv = CResult_SchnorrSignatureNoneZ_clone_ptr(arg_conv);
16598         return ret_conv;
16599 }
16600
16601 uint64_t  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_clone"))) TS_CResult_SchnorrSignatureNoneZ_clone(uint64_t orig) {
16602         LDKCResult_SchnorrSignatureNoneZ* orig_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(orig);
16603         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
16604         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(orig_conv);
16605         return tag_ptr(ret_conv, true);
16606 }
16607
16608 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(uint64_t o) {
16609         void* o_ptr = untag_ptr(o);
16610         CHECK_ACCESS(o_ptr);
16611         LDKWriteableEcdsaChannelSigner o_conv = *(LDKWriteableEcdsaChannelSigner*)(o_ptr);
16612         if (o_conv.free == LDKWriteableEcdsaChannelSigner_JCalls_free) {
16613                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16614                 LDKWriteableEcdsaChannelSigner_JCalls_cloned(&o_conv);
16615         }
16616         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16617         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o_conv);
16618         return tag_ptr(ret_conv, true);
16619 }
16620
16621 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(uint64_t e) {
16622         void* e_ptr = untag_ptr(e);
16623         CHECK_ACCESS(e_ptr);
16624         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16625         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16626         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16627         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e_conv);
16628         return tag_ptr(ret_conv, true);
16629 }
16630
16631 jboolean  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(uint64_t o) {
16632         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* o_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(o);
16633         jboolean ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o_conv);
16634         return ret_conv;
16635 }
16636
16637 void  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(uint64_t _res) {
16638         if (!ptr_is_owned(_res)) return;
16639         void* _res_ptr = untag_ptr(_res);
16640         CHECK_ACCESS(_res_ptr);
16641         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(_res_ptr);
16642         FREE(untag_ptr(_res));
16643         CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res_conv);
16644 }
16645
16646 static inline uint64_t CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR arg) {
16647         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16648         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(arg);
16649         return tag_ptr(ret_conv, true);
16650 }
16651 int64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(uint64_t arg) {
16652         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* arg_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(arg);
16653         int64_t ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(arg_conv);
16654         return ret_conv;
16655 }
16656
16657 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(uint64_t orig) {
16658         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* orig_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(orig);
16659         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16660         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig_conv);
16661         return tag_ptr(ret_conv, true);
16662 }
16663
16664 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_ok"))) TS_CResult_CVec_u8ZNoneZ_ok(int8_tArray o) {
16665         LDKCVec_u8Z o_ref;
16666         o_ref.datalen = o->arr_len;
16667         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
16668         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
16669         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
16670         *ret_conv = CResult_CVec_u8ZNoneZ_ok(o_ref);
16671         return tag_ptr(ret_conv, true);
16672 }
16673
16674 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_err"))) TS_CResult_CVec_u8ZNoneZ_err() {
16675         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
16676         *ret_conv = CResult_CVec_u8ZNoneZ_err();
16677         return tag_ptr(ret_conv, true);
16678 }
16679
16680 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_is_ok"))) TS_CResult_CVec_u8ZNoneZ_is_ok(uint64_t o) {
16681         LDKCResult_CVec_u8ZNoneZ* o_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(o);
16682         jboolean ret_conv = CResult_CVec_u8ZNoneZ_is_ok(o_conv);
16683         return ret_conv;
16684 }
16685
16686 void  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_free"))) TS_CResult_CVec_u8ZNoneZ_free(uint64_t _res) {
16687         if (!ptr_is_owned(_res)) return;
16688         void* _res_ptr = untag_ptr(_res);
16689         CHECK_ACCESS(_res_ptr);
16690         LDKCResult_CVec_u8ZNoneZ _res_conv = *(LDKCResult_CVec_u8ZNoneZ*)(_res_ptr);
16691         FREE(untag_ptr(_res));
16692         CResult_CVec_u8ZNoneZ_free(_res_conv);
16693 }
16694
16695 static inline uint64_t CResult_CVec_u8ZNoneZ_clone_ptr(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR arg) {
16696         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
16697         *ret_conv = CResult_CVec_u8ZNoneZ_clone(arg);
16698         return tag_ptr(ret_conv, true);
16699 }
16700 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_clone_ptr"))) TS_CResult_CVec_u8ZNoneZ_clone_ptr(uint64_t arg) {
16701         LDKCResult_CVec_u8ZNoneZ* arg_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(arg);
16702         int64_t ret_conv = CResult_CVec_u8ZNoneZ_clone_ptr(arg_conv);
16703         return ret_conv;
16704 }
16705
16706 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_clone"))) TS_CResult_CVec_u8ZNoneZ_clone(uint64_t orig) {
16707         LDKCResult_CVec_u8ZNoneZ* orig_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(orig);
16708         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
16709         *ret_conv = CResult_CVec_u8ZNoneZ_clone(orig_conv);
16710         return tag_ptr(ret_conv, true);
16711 }
16712
16713 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_ok"))) TS_CResult_ShutdownScriptNoneZ_ok(uint64_t o) {
16714         LDKShutdownScript o_conv;
16715         o_conv.inner = untag_ptr(o);
16716         o_conv.is_owned = ptr_is_owned(o);
16717         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16718         o_conv = ShutdownScript_clone(&o_conv);
16719         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
16720         *ret_conv = CResult_ShutdownScriptNoneZ_ok(o_conv);
16721         return tag_ptr(ret_conv, true);
16722 }
16723
16724 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_err"))) TS_CResult_ShutdownScriptNoneZ_err() {
16725         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
16726         *ret_conv = CResult_ShutdownScriptNoneZ_err();
16727         return tag_ptr(ret_conv, true);
16728 }
16729
16730 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_is_ok"))) TS_CResult_ShutdownScriptNoneZ_is_ok(uint64_t o) {
16731         LDKCResult_ShutdownScriptNoneZ* o_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(o);
16732         jboolean ret_conv = CResult_ShutdownScriptNoneZ_is_ok(o_conv);
16733         return ret_conv;
16734 }
16735
16736 void  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_free"))) TS_CResult_ShutdownScriptNoneZ_free(uint64_t _res) {
16737         if (!ptr_is_owned(_res)) return;
16738         void* _res_ptr = untag_ptr(_res);
16739         CHECK_ACCESS(_res_ptr);
16740         LDKCResult_ShutdownScriptNoneZ _res_conv = *(LDKCResult_ShutdownScriptNoneZ*)(_res_ptr);
16741         FREE(untag_ptr(_res));
16742         CResult_ShutdownScriptNoneZ_free(_res_conv);
16743 }
16744
16745 static inline uint64_t CResult_ShutdownScriptNoneZ_clone_ptr(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR arg) {
16746         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
16747         *ret_conv = CResult_ShutdownScriptNoneZ_clone(arg);
16748         return tag_ptr(ret_conv, true);
16749 }
16750 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_clone_ptr"))) TS_CResult_ShutdownScriptNoneZ_clone_ptr(uint64_t arg) {
16751         LDKCResult_ShutdownScriptNoneZ* arg_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(arg);
16752         int64_t ret_conv = CResult_ShutdownScriptNoneZ_clone_ptr(arg_conv);
16753         return ret_conv;
16754 }
16755
16756 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_clone"))) TS_CResult_ShutdownScriptNoneZ_clone(uint64_t orig) {
16757         LDKCResult_ShutdownScriptNoneZ* orig_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(orig);
16758         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
16759         *ret_conv = CResult_ShutdownScriptNoneZ_clone(orig_conv);
16760         return tag_ptr(ret_conv, true);
16761 }
16762
16763 uint64_t  __attribute__((export_name("TS_COption_u16Z_some"))) TS_COption_u16Z_some(int16_t o) {
16764         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
16765         *ret_copy = COption_u16Z_some(o);
16766         uint64_t ret_ref = tag_ptr(ret_copy, true);
16767         return ret_ref;
16768 }
16769
16770 uint64_t  __attribute__((export_name("TS_COption_u16Z_none"))) TS_COption_u16Z_none() {
16771         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
16772         *ret_copy = COption_u16Z_none();
16773         uint64_t ret_ref = tag_ptr(ret_copy, true);
16774         return ret_ref;
16775 }
16776
16777 void  __attribute__((export_name("TS_COption_u16Z_free"))) TS_COption_u16Z_free(uint64_t _res) {
16778         if (!ptr_is_owned(_res)) return;
16779         void* _res_ptr = untag_ptr(_res);
16780         CHECK_ACCESS(_res_ptr);
16781         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
16782         FREE(untag_ptr(_res));
16783         COption_u16Z_free(_res_conv);
16784 }
16785
16786 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
16787         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
16788         *ret_copy = COption_u16Z_clone(arg);
16789         uint64_t ret_ref = tag_ptr(ret_copy, true);
16790         return ret_ref;
16791 }
16792 int64_t  __attribute__((export_name("TS_COption_u16Z_clone_ptr"))) TS_COption_u16Z_clone_ptr(uint64_t arg) {
16793         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
16794         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
16795         return ret_conv;
16796 }
16797
16798 uint64_t  __attribute__((export_name("TS_COption_u16Z_clone"))) TS_COption_u16Z_clone(uint64_t orig) {
16799         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
16800         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
16801         *ret_copy = COption_u16Z_clone(orig_conv);
16802         uint64_t ret_ref = tag_ptr(ret_copy, true);
16803         return ret_ref;
16804 }
16805
16806 uint64_t  __attribute__((export_name("TS_COption_boolZ_some"))) TS_COption_boolZ_some(jboolean o) {
16807         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
16808         *ret_copy = COption_boolZ_some(o);
16809         uint64_t ret_ref = tag_ptr(ret_copy, true);
16810         return ret_ref;
16811 }
16812
16813 uint64_t  __attribute__((export_name("TS_COption_boolZ_none"))) TS_COption_boolZ_none() {
16814         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
16815         *ret_copy = COption_boolZ_none();
16816         uint64_t ret_ref = tag_ptr(ret_copy, true);
16817         return ret_ref;
16818 }
16819
16820 void  __attribute__((export_name("TS_COption_boolZ_free"))) TS_COption_boolZ_free(uint64_t _res) {
16821         if (!ptr_is_owned(_res)) return;
16822         void* _res_ptr = untag_ptr(_res);
16823         CHECK_ACCESS(_res_ptr);
16824         LDKCOption_boolZ _res_conv = *(LDKCOption_boolZ*)(_res_ptr);
16825         FREE(untag_ptr(_res));
16826         COption_boolZ_free(_res_conv);
16827 }
16828
16829 static inline uint64_t COption_boolZ_clone_ptr(LDKCOption_boolZ *NONNULL_PTR arg) {
16830         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
16831         *ret_copy = COption_boolZ_clone(arg);
16832         uint64_t ret_ref = tag_ptr(ret_copy, true);
16833         return ret_ref;
16834 }
16835 int64_t  __attribute__((export_name("TS_COption_boolZ_clone_ptr"))) TS_COption_boolZ_clone_ptr(uint64_t arg) {
16836         LDKCOption_boolZ* arg_conv = (LDKCOption_boolZ*)untag_ptr(arg);
16837         int64_t ret_conv = COption_boolZ_clone_ptr(arg_conv);
16838         return ret_conv;
16839 }
16840
16841 uint64_t  __attribute__((export_name("TS_COption_boolZ_clone"))) TS_COption_boolZ_clone(uint64_t orig) {
16842         LDKCOption_boolZ* orig_conv = (LDKCOption_boolZ*)untag_ptr(orig);
16843         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
16844         *ret_copy = COption_boolZ_clone(orig_conv);
16845         uint64_t ret_ref = tag_ptr(ret_copy, true);
16846         return ret_ref;
16847 }
16848
16849 void  __attribute__((export_name("TS_CVec_CVec_u8ZZ_free"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
16850         LDKCVec_CVec_u8ZZ _res_constr;
16851         _res_constr.datalen = _res->arr_len;
16852         if (_res_constr.datalen > 0)
16853                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
16854         else
16855                 _res_constr.data = NULL;
16856         int8_tArray* _res_vals = (void*) _res->elems;
16857         for (size_t m = 0; m < _res_constr.datalen; m++) {
16858                 int8_tArray _res_conv_12 = _res_vals[m];
16859                 LDKCVec_u8Z _res_conv_12_ref;
16860                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
16861                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
16862                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
16863                 _res_constr.data[m] = _res_conv_12_ref;
16864         }
16865         FREE(_res);
16866         CVec_CVec_u8ZZ_free(_res_constr);
16867 }
16868
16869 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
16870         LDKCVec_CVec_u8ZZ o_constr;
16871         o_constr.datalen = o->arr_len;
16872         if (o_constr.datalen > 0)
16873                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
16874         else
16875                 o_constr.data = NULL;
16876         int8_tArray* o_vals = (void*) o->elems;
16877         for (size_t m = 0; m < o_constr.datalen; m++) {
16878                 int8_tArray o_conv_12 = o_vals[m];
16879                 LDKCVec_u8Z o_conv_12_ref;
16880                 o_conv_12_ref.datalen = o_conv_12->arr_len;
16881                 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
16882                 memcpy(o_conv_12_ref.data, o_conv_12->elems, o_conv_12_ref.datalen); FREE(o_conv_12);
16883                 o_constr.data[m] = o_conv_12_ref;
16884         }
16885         FREE(o);
16886         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16887         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
16888         return tag_ptr(ret_conv, true);
16889 }
16890
16891 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
16892         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16893         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
16894         return tag_ptr(ret_conv, true);
16895 }
16896
16897 jboolean  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok(uint64_t o) {
16898         LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(o);
16899         jboolean ret_conv = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
16900         return ret_conv;
16901 }
16902
16903 void  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_free"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint64_t _res) {
16904         if (!ptr_is_owned(_res)) return;
16905         void* _res_ptr = untag_ptr(_res);
16906         CHECK_ACCESS(_res_ptr);
16907         LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
16908         FREE(untag_ptr(_res));
16909         CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
16910 }
16911
16912 static inline uint64_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
16913         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16914         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
16915         return tag_ptr(ret_conv, true);
16916 }
16917 int64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(uint64_t arg) {
16918         LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(arg);
16919         int64_t ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
16920         return ret_conv;
16921 }
16922
16923 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint64_t orig) {
16924         LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(orig);
16925         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16926         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
16927         return tag_ptr(ret_conv, true);
16928 }
16929
16930 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint64_t o) {
16931         LDKInMemorySigner o_conv;
16932         o_conv.inner = untag_ptr(o);
16933         o_conv.is_owned = ptr_is_owned(o);
16934         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16935         o_conv = InMemorySigner_clone(&o_conv);
16936         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16937         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
16938         return tag_ptr(ret_conv, true);
16939 }
16940
16941 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_err"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint64_t e) {
16942         void* e_ptr = untag_ptr(e);
16943         CHECK_ACCESS(e_ptr);
16944         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16945         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16946         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16947         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
16948         return tag_ptr(ret_conv, true);
16949 }
16950
16951 jboolean  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_is_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_is_ok(uint64_t o) {
16952         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
16953         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
16954         return ret_conv;
16955 }
16956
16957 void  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_free"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint64_t _res) {
16958         if (!ptr_is_owned(_res)) return;
16959         void* _res_ptr = untag_ptr(_res);
16960         CHECK_ACCESS(_res_ptr);
16961         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
16962         FREE(untag_ptr(_res));
16963         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
16964 }
16965
16966 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
16967         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16968         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
16969         return tag_ptr(ret_conv, true);
16970 }
16971 int64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr"))) TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr(uint64_t arg) {
16972         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
16973         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
16974         return ret_conv;
16975 }
16976
16977 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint64_t orig) {
16978         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
16979         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16980         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
16981         return tag_ptr(ret_conv, true);
16982 }
16983
16984 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_ok"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
16985         LDKTransaction o_ref;
16986         o_ref.datalen = o->arr_len;
16987         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
16988         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
16989         o_ref.data_is_owned = true;
16990         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16991         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
16992         return tag_ptr(ret_conv, true);
16993 }
16994
16995 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_err"))) TS_CResult_TransactionNoneZ_err() {
16996         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16997         *ret_conv = CResult_TransactionNoneZ_err();
16998         return tag_ptr(ret_conv, true);
16999 }
17000
17001 jboolean  __attribute__((export_name("TS_CResult_TransactionNoneZ_is_ok"))) TS_CResult_TransactionNoneZ_is_ok(uint64_t o) {
17002         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
17003         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
17004         return ret_conv;
17005 }
17006
17007 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_free"))) TS_CResult_TransactionNoneZ_free(uint64_t _res) {
17008         if (!ptr_is_owned(_res)) return;
17009         void* _res_ptr = untag_ptr(_res);
17010         CHECK_ACCESS(_res_ptr);
17011         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
17012         FREE(untag_ptr(_res));
17013         CResult_TransactionNoneZ_free(_res_conv);
17014 }
17015
17016 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
17017         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17018         *ret_conv = CResult_TransactionNoneZ_clone(arg);
17019         return tag_ptr(ret_conv, true);
17020 }
17021 int64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone_ptr"))) TS_CResult_TransactionNoneZ_clone_ptr(uint64_t arg) {
17022         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
17023         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
17024         return ret_conv;
17025 }
17026
17027 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone"))) TS_CResult_TransactionNoneZ_clone(uint64_t orig) {
17028         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
17029         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17030         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
17031         return tag_ptr(ret_conv, true);
17032 }
17033
17034 void  __attribute__((export_name("TS_CVec_ChannelDetailsZ_free"))) TS_CVec_ChannelDetailsZ_free(uint64_tArray _res) {
17035         LDKCVec_ChannelDetailsZ _res_constr;
17036         _res_constr.datalen = _res->arr_len;
17037         if (_res_constr.datalen > 0)
17038                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
17039         else
17040                 _res_constr.data = NULL;
17041         uint64_t* _res_vals = _res->elems;
17042         for (size_t q = 0; q < _res_constr.datalen; q++) {
17043                 uint64_t _res_conv_16 = _res_vals[q];
17044                 LDKChannelDetails _res_conv_16_conv;
17045                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
17046                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
17047                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
17048                 _res_constr.data[q] = _res_conv_16_conv;
17049         }
17050         FREE(_res);
17051         CVec_ChannelDetailsZ_free(_res_constr);
17052 }
17053
17054 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_ok"))) TS_CResult_RouteLightningErrorZ_ok(uint64_t o) {
17055         LDKRoute o_conv;
17056         o_conv.inner = untag_ptr(o);
17057         o_conv.is_owned = ptr_is_owned(o);
17058         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17059         o_conv = Route_clone(&o_conv);
17060         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
17061         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
17062         return tag_ptr(ret_conv, true);
17063 }
17064
17065 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_err"))) TS_CResult_RouteLightningErrorZ_err(uint64_t e) {
17066         LDKLightningError e_conv;
17067         e_conv.inner = untag_ptr(e);
17068         e_conv.is_owned = ptr_is_owned(e);
17069         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17070         e_conv = LightningError_clone(&e_conv);
17071         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
17072         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
17073         return tag_ptr(ret_conv, true);
17074 }
17075
17076 jboolean  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_is_ok"))) TS_CResult_RouteLightningErrorZ_is_ok(uint64_t o) {
17077         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
17078         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
17079         return ret_conv;
17080 }
17081
17082 void  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_free"))) TS_CResult_RouteLightningErrorZ_free(uint64_t _res) {
17083         if (!ptr_is_owned(_res)) return;
17084         void* _res_ptr = untag_ptr(_res);
17085         CHECK_ACCESS(_res_ptr);
17086         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
17087         FREE(untag_ptr(_res));
17088         CResult_RouteLightningErrorZ_free(_res_conv);
17089 }
17090
17091 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
17092         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
17093         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
17094         return tag_ptr(ret_conv, true);
17095 }
17096 int64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone_ptr"))) TS_CResult_RouteLightningErrorZ_clone_ptr(uint64_t arg) {
17097         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
17098         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
17099         return ret_conv;
17100 }
17101
17102 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone"))) TS_CResult_RouteLightningErrorZ_clone(uint64_t orig) {
17103         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
17104         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
17105         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
17106         return tag_ptr(ret_conv, true);
17107 }
17108
17109 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_ok(uint64_t o) {
17110         LDKInFlightHtlcs o_conv;
17111         o_conv.inner = untag_ptr(o);
17112         o_conv.is_owned = ptr_is_owned(o);
17113         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17114         o_conv = InFlightHtlcs_clone(&o_conv);
17115         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
17116         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_ok(o_conv);
17117         return tag_ptr(ret_conv, true);
17118 }
17119
17120 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_err(uint64_t e) {
17121         void* e_ptr = untag_ptr(e);
17122         CHECK_ACCESS(e_ptr);
17123         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17124         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17125         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
17126         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_err(e_conv);
17127         return tag_ptr(ret_conv, true);
17128 }
17129
17130 jboolean  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok(uint64_t o) {
17131         LDKCResult_InFlightHtlcsDecodeErrorZ* o_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(o);
17132         jboolean ret_conv = CResult_InFlightHtlcsDecodeErrorZ_is_ok(o_conv);
17133         return ret_conv;
17134 }
17135
17136 void  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_free"))) TS_CResult_InFlightHtlcsDecodeErrorZ_free(uint64_t _res) {
17137         if (!ptr_is_owned(_res)) return;
17138         void* _res_ptr = untag_ptr(_res);
17139         CHECK_ACCESS(_res_ptr);
17140         LDKCResult_InFlightHtlcsDecodeErrorZ _res_conv = *(LDKCResult_InFlightHtlcsDecodeErrorZ*)(_res_ptr);
17141         FREE(untag_ptr(_res));
17142         CResult_InFlightHtlcsDecodeErrorZ_free(_res_conv);
17143 }
17144
17145 static inline uint64_t CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR arg) {
17146         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
17147         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(arg);
17148         return tag_ptr(ret_conv, true);
17149 }
17150 int64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_clone_ptr"))) TS_CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(uint64_t arg) {
17151         LDKCResult_InFlightHtlcsDecodeErrorZ* arg_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(arg);
17152         int64_t ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(arg_conv);
17153         return ret_conv;
17154 }
17155
17156 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_clone"))) TS_CResult_InFlightHtlcsDecodeErrorZ_clone(uint64_t orig) {
17157         LDKCResult_InFlightHtlcsDecodeErrorZ* orig_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(orig);
17158         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
17159         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(orig_conv);
17160         return tag_ptr(ret_conv, true);
17161 }
17162
17163 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_ok"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint64_t o) {
17164         LDKRouteHop o_conv;
17165         o_conv.inner = untag_ptr(o);
17166         o_conv.is_owned = ptr_is_owned(o);
17167         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17168         o_conv = RouteHop_clone(&o_conv);
17169         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
17170         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
17171         return tag_ptr(ret_conv, true);
17172 }
17173
17174 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_err"))) TS_CResult_RouteHopDecodeErrorZ_err(uint64_t e) {
17175         void* e_ptr = untag_ptr(e);
17176         CHECK_ACCESS(e_ptr);
17177         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17178         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17179         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
17180         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
17181         return tag_ptr(ret_conv, true);
17182 }
17183
17184 jboolean  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHopDecodeErrorZ_is_ok(uint64_t o) {
17185         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
17186         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
17187         return ret_conv;
17188 }
17189
17190 void  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_free"))) TS_CResult_RouteHopDecodeErrorZ_free(uint64_t _res) {
17191         if (!ptr_is_owned(_res)) return;
17192         void* _res_ptr = untag_ptr(_res);
17193         CHECK_ACCESS(_res_ptr);
17194         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
17195         FREE(untag_ptr(_res));
17196         CResult_RouteHopDecodeErrorZ_free(_res_conv);
17197 }
17198
17199 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
17200         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
17201         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
17202         return tag_ptr(ret_conv, true);
17203 }
17204 int64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHopDecodeErrorZ_clone_ptr(uint64_t arg) {
17205         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
17206         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
17207         return ret_conv;
17208 }
17209
17210 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint64_t orig) {
17211         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
17212         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
17213         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
17214         return tag_ptr(ret_conv, true);
17215 }
17216
17217 void  __attribute__((export_name("TS_CVec_BlindedHopZ_free"))) TS_CVec_BlindedHopZ_free(uint64_tArray _res) {
17218         LDKCVec_BlindedHopZ _res_constr;
17219         _res_constr.datalen = _res->arr_len;
17220         if (_res_constr.datalen > 0)
17221                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
17222         else
17223                 _res_constr.data = NULL;
17224         uint64_t* _res_vals = _res->elems;
17225         for (size_t m = 0; m < _res_constr.datalen; m++) {
17226                 uint64_t _res_conv_12 = _res_vals[m];
17227                 LDKBlindedHop _res_conv_12_conv;
17228                 _res_conv_12_conv.inner = untag_ptr(_res_conv_12);
17229                 _res_conv_12_conv.is_owned = ptr_is_owned(_res_conv_12);
17230                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv);
17231                 _res_constr.data[m] = _res_conv_12_conv;
17232         }
17233         FREE(_res);
17234         CVec_BlindedHopZ_free(_res_constr);
17235 }
17236
17237 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_ok"))) TS_CResult_BlindedTailDecodeErrorZ_ok(uint64_t o) {
17238         LDKBlindedTail o_conv;
17239         o_conv.inner = untag_ptr(o);
17240         o_conv.is_owned = ptr_is_owned(o);
17241         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17242         o_conv = BlindedTail_clone(&o_conv);
17243         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
17244         *ret_conv = CResult_BlindedTailDecodeErrorZ_ok(o_conv);
17245         return tag_ptr(ret_conv, true);
17246 }
17247
17248 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_err"))) TS_CResult_BlindedTailDecodeErrorZ_err(uint64_t e) {
17249         void* e_ptr = untag_ptr(e);
17250         CHECK_ACCESS(e_ptr);
17251         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17252         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17253         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
17254         *ret_conv = CResult_BlindedTailDecodeErrorZ_err(e_conv);
17255         return tag_ptr(ret_conv, true);
17256 }
17257
17258 jboolean  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_is_ok"))) TS_CResult_BlindedTailDecodeErrorZ_is_ok(uint64_t o) {
17259         LDKCResult_BlindedTailDecodeErrorZ* o_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(o);
17260         jboolean ret_conv = CResult_BlindedTailDecodeErrorZ_is_ok(o_conv);
17261         return ret_conv;
17262 }
17263
17264 void  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_free"))) TS_CResult_BlindedTailDecodeErrorZ_free(uint64_t _res) {
17265         if (!ptr_is_owned(_res)) return;
17266         void* _res_ptr = untag_ptr(_res);
17267         CHECK_ACCESS(_res_ptr);
17268         LDKCResult_BlindedTailDecodeErrorZ _res_conv = *(LDKCResult_BlindedTailDecodeErrorZ*)(_res_ptr);
17269         FREE(untag_ptr(_res));
17270         CResult_BlindedTailDecodeErrorZ_free(_res_conv);
17271 }
17272
17273 static inline uint64_t CResult_BlindedTailDecodeErrorZ_clone_ptr(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR arg) {
17274         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
17275         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(arg);
17276         return tag_ptr(ret_conv, true);
17277 }
17278 int64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedTailDecodeErrorZ_clone_ptr(uint64_t arg) {
17279         LDKCResult_BlindedTailDecodeErrorZ* arg_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(arg);
17280         int64_t ret_conv = CResult_BlindedTailDecodeErrorZ_clone_ptr(arg_conv);
17281         return ret_conv;
17282 }
17283
17284 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_clone"))) TS_CResult_BlindedTailDecodeErrorZ_clone(uint64_t orig) {
17285         LDKCResult_BlindedTailDecodeErrorZ* orig_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(orig);
17286         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
17287         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(orig_conv);
17288         return tag_ptr(ret_conv, true);
17289 }
17290
17291 void  __attribute__((export_name("TS_CVec_RouteHopZ_free"))) TS_CVec_RouteHopZ_free(uint64_tArray _res) {
17292         LDKCVec_RouteHopZ _res_constr;
17293         _res_constr.datalen = _res->arr_len;
17294         if (_res_constr.datalen > 0)
17295                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
17296         else
17297                 _res_constr.data = NULL;
17298         uint64_t* _res_vals = _res->elems;
17299         for (size_t k = 0; k < _res_constr.datalen; k++) {
17300                 uint64_t _res_conv_10 = _res_vals[k];
17301                 LDKRouteHop _res_conv_10_conv;
17302                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
17303                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
17304                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
17305                 _res_constr.data[k] = _res_conv_10_conv;
17306         }
17307         FREE(_res);
17308         CVec_RouteHopZ_free(_res_constr);
17309 }
17310
17311 void  __attribute__((export_name("TS_CVec_PathZ_free"))) TS_CVec_PathZ_free(uint64_tArray _res) {
17312         LDKCVec_PathZ _res_constr;
17313         _res_constr.datalen = _res->arr_len;
17314         if (_res_constr.datalen > 0)
17315                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
17316         else
17317                 _res_constr.data = NULL;
17318         uint64_t* _res_vals = _res->elems;
17319         for (size_t g = 0; g < _res_constr.datalen; g++) {
17320                 uint64_t _res_conv_6 = _res_vals[g];
17321                 LDKPath _res_conv_6_conv;
17322                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
17323                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
17324                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
17325                 _res_constr.data[g] = _res_conv_6_conv;
17326         }
17327         FREE(_res);
17328         CVec_PathZ_free(_res_constr);
17329 }
17330
17331 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_ok"))) TS_CResult_RouteDecodeErrorZ_ok(uint64_t o) {
17332         LDKRoute o_conv;
17333         o_conv.inner = untag_ptr(o);
17334         o_conv.is_owned = ptr_is_owned(o);
17335         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17336         o_conv = Route_clone(&o_conv);
17337         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
17338         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
17339         return tag_ptr(ret_conv, true);
17340 }
17341
17342 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_err"))) TS_CResult_RouteDecodeErrorZ_err(uint64_t e) {
17343         void* e_ptr = untag_ptr(e);
17344         CHECK_ACCESS(e_ptr);
17345         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17346         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17347         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
17348         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
17349         return tag_ptr(ret_conv, true);
17350 }
17351
17352 jboolean  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_is_ok"))) TS_CResult_RouteDecodeErrorZ_is_ok(uint64_t o) {
17353         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
17354         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
17355         return ret_conv;
17356 }
17357
17358 void  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_free"))) TS_CResult_RouteDecodeErrorZ_free(uint64_t _res) {
17359         if (!ptr_is_owned(_res)) return;
17360         void* _res_ptr = untag_ptr(_res);
17361         CHECK_ACCESS(_res_ptr);
17362         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
17363         FREE(untag_ptr(_res));
17364         CResult_RouteDecodeErrorZ_free(_res_conv);
17365 }
17366
17367 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
17368         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
17369         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
17370         return tag_ptr(ret_conv, true);
17371 }
17372 int64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone_ptr"))) TS_CResult_RouteDecodeErrorZ_clone_ptr(uint64_t arg) {
17373         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
17374         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
17375         return ret_conv;
17376 }
17377
17378 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone"))) TS_CResult_RouteDecodeErrorZ_clone(uint64_t orig) {
17379         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
17380         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
17381         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
17382         return tag_ptr(ret_conv, true);
17383 }
17384
17385 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_ok"))) TS_CResult_RouteParametersDecodeErrorZ_ok(uint64_t o) {
17386         LDKRouteParameters o_conv;
17387         o_conv.inner = untag_ptr(o);
17388         o_conv.is_owned = ptr_is_owned(o);
17389         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17390         o_conv = RouteParameters_clone(&o_conv);
17391         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
17392         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
17393         return tag_ptr(ret_conv, true);
17394 }
17395
17396 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_err"))) TS_CResult_RouteParametersDecodeErrorZ_err(uint64_t e) {
17397         void* e_ptr = untag_ptr(e);
17398         CHECK_ACCESS(e_ptr);
17399         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17400         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17401         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
17402         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
17403         return tag_ptr(ret_conv, true);
17404 }
17405
17406 jboolean  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_is_ok"))) TS_CResult_RouteParametersDecodeErrorZ_is_ok(uint64_t o) {
17407         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
17408         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
17409         return ret_conv;
17410 }
17411
17412 void  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_free"))) TS_CResult_RouteParametersDecodeErrorZ_free(uint64_t _res) {
17413         if (!ptr_is_owned(_res)) return;
17414         void* _res_ptr = untag_ptr(_res);
17415         CHECK_ACCESS(_res_ptr);
17416         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
17417         FREE(untag_ptr(_res));
17418         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
17419 }
17420
17421 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
17422         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
17423         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
17424         return tag_ptr(ret_conv, true);
17425 }
17426 int64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone_ptr"))) TS_CResult_RouteParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
17427         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
17428         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
17429         return ret_conv;
17430 }
17431
17432 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone"))) TS_CResult_RouteParametersDecodeErrorZ_clone(uint64_t orig) {
17433         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
17434         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
17435         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
17436         return tag_ptr(ret_conv, true);
17437 }
17438
17439 void  __attribute__((export_name("TS_CVec_u64Z_free"))) TS_CVec_u64Z_free(int64_tArray _res) {
17440         LDKCVec_u64Z _res_constr;
17441         _res_constr.datalen = _res->arr_len;
17442         if (_res_constr.datalen > 0)
17443                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
17444         else
17445                 _res_constr.data = NULL;
17446         int64_t* _res_vals = _res->elems;
17447         for (size_t i = 0; i < _res_constr.datalen; i++) {
17448                 int64_t _res_conv_8 = _res_vals[i];
17449                 _res_constr.data[i] = _res_conv_8;
17450         }
17451         FREE(_res);
17452         CVec_u64Z_free(_res_constr);
17453 }
17454
17455 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_ok(uint64_t o) {
17456         LDKPaymentParameters o_conv;
17457         o_conv.inner = untag_ptr(o);
17458         o_conv.is_owned = ptr_is_owned(o);
17459         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17460         o_conv = PaymentParameters_clone(&o_conv);
17461         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
17462         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
17463         return tag_ptr(ret_conv, true);
17464 }
17465
17466 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_err"))) TS_CResult_PaymentParametersDecodeErrorZ_err(uint64_t e) {
17467         void* e_ptr = untag_ptr(e);
17468         CHECK_ACCESS(e_ptr);
17469         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17470         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17471         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
17472         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
17473         return tag_ptr(ret_conv, true);
17474 }
17475
17476 jboolean  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_is_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_is_ok(uint64_t o) {
17477         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
17478         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
17479         return ret_conv;
17480 }
17481
17482 void  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_free"))) TS_CResult_PaymentParametersDecodeErrorZ_free(uint64_t _res) {
17483         if (!ptr_is_owned(_res)) return;
17484         void* _res_ptr = untag_ptr(_res);
17485         CHECK_ACCESS(_res_ptr);
17486         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
17487         FREE(untag_ptr(_res));
17488         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
17489 }
17490
17491 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
17492         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
17493         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
17494         return tag_ptr(ret_conv, true);
17495 }
17496 int64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
17497         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
17498         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
17499         return ret_conv;
17500 }
17501
17502 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone"))) TS_CResult_PaymentParametersDecodeErrorZ_clone(uint64_t orig) {
17503         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
17504         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
17505         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
17506         return tag_ptr(ret_conv, true);
17507 }
17508
17509 static inline uint64_t C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR arg) {
17510         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
17511         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(arg);
17512         return tag_ptr(ret_conv, true);
17513 }
17514 int64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(uint64_t arg) {
17515         LDKC2Tuple_BlindedPayInfoBlindedPathZ* arg_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(arg);
17516         int64_t ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(arg_conv);
17517         return ret_conv;
17518 }
17519
17520 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone(uint64_t orig) {
17521         LDKC2Tuple_BlindedPayInfoBlindedPathZ* orig_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(orig);
17522         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
17523         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig_conv);
17524         return tag_ptr(ret_conv, true);
17525 }
17526
17527 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_new"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_new(uint64_t a, uint64_t b) {
17528         LDKBlindedPayInfo a_conv;
17529         a_conv.inner = untag_ptr(a);
17530         a_conv.is_owned = ptr_is_owned(a);
17531         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
17532         a_conv = BlindedPayInfo_clone(&a_conv);
17533         LDKBlindedPath b_conv;
17534         b_conv.inner = untag_ptr(b);
17535         b_conv.is_owned = ptr_is_owned(b);
17536         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
17537         b_conv = BlindedPath_clone(&b_conv);
17538         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
17539         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_new(a_conv, b_conv);
17540         return tag_ptr(ret_conv, true);
17541 }
17542
17543 void  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_free"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_free(uint64_t _res) {
17544         if (!ptr_is_owned(_res)) return;
17545         void* _res_ptr = untag_ptr(_res);
17546         CHECK_ACCESS(_res_ptr);
17547         LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_ptr);
17548         FREE(untag_ptr(_res));
17549         C2Tuple_BlindedPayInfoBlindedPathZ_free(_res_conv);
17550 }
17551
17552 void  __attribute__((export_name("TS_CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free"))) TS_CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(uint64_tArray _res) {
17553         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ _res_constr;
17554         _res_constr.datalen = _res->arr_len;
17555         if (_res_constr.datalen > 0)
17556                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
17557         else
17558                 _res_constr.data = NULL;
17559         uint64_t* _res_vals = _res->elems;
17560         for (size_t l = 0; l < _res_constr.datalen; l++) {
17561                 uint64_t _res_conv_37 = _res_vals[l];
17562                 void* _res_conv_37_ptr = untag_ptr(_res_conv_37);
17563                 CHECK_ACCESS(_res_conv_37_ptr);
17564                 LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_conv_37_ptr);
17565                 FREE(untag_ptr(_res_conv_37));
17566                 _res_constr.data[l] = _res_conv_37_conv;
17567         }
17568         FREE(_res);
17569         CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res_constr);
17570 }
17571
17572 void  __attribute__((export_name("TS_CVec_RouteHintZ_free"))) TS_CVec_RouteHintZ_free(uint64_tArray _res) {
17573         LDKCVec_RouteHintZ _res_constr;
17574         _res_constr.datalen = _res->arr_len;
17575         if (_res_constr.datalen > 0)
17576                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
17577         else
17578                 _res_constr.data = NULL;
17579         uint64_t* _res_vals = _res->elems;
17580         for (size_t l = 0; l < _res_constr.datalen; l++) {
17581                 uint64_t _res_conv_11 = _res_vals[l];
17582                 LDKRouteHint _res_conv_11_conv;
17583                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
17584                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
17585                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
17586                 _res_constr.data[l] = _res_conv_11_conv;
17587         }
17588         FREE(_res);
17589         CVec_RouteHintZ_free(_res_constr);
17590 }
17591
17592 void  __attribute__((export_name("TS_CVec_RouteHintHopZ_free"))) TS_CVec_RouteHintHopZ_free(uint64_tArray _res) {
17593         LDKCVec_RouteHintHopZ _res_constr;
17594         _res_constr.datalen = _res->arr_len;
17595         if (_res_constr.datalen > 0)
17596                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
17597         else
17598                 _res_constr.data = NULL;
17599         uint64_t* _res_vals = _res->elems;
17600         for (size_t o = 0; o < _res_constr.datalen; o++) {
17601                 uint64_t _res_conv_14 = _res_vals[o];
17602                 LDKRouteHintHop _res_conv_14_conv;
17603                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
17604                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
17605                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
17606                 _res_constr.data[o] = _res_conv_14_conv;
17607         }
17608         FREE(_res);
17609         CVec_RouteHintHopZ_free(_res_constr);
17610 }
17611
17612 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_ok"))) TS_CResult_RouteHintDecodeErrorZ_ok(uint64_t o) {
17613         LDKRouteHint o_conv;
17614         o_conv.inner = untag_ptr(o);
17615         o_conv.is_owned = ptr_is_owned(o);
17616         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17617         o_conv = RouteHint_clone(&o_conv);
17618         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
17619         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
17620         return tag_ptr(ret_conv, true);
17621 }
17622
17623 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_err"))) TS_CResult_RouteHintDecodeErrorZ_err(uint64_t e) {
17624         void* e_ptr = untag_ptr(e);
17625         CHECK_ACCESS(e_ptr);
17626         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17627         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17628         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
17629         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
17630         return tag_ptr(ret_conv, true);
17631 }
17632
17633 jboolean  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_is_ok"))) TS_CResult_RouteHintDecodeErrorZ_is_ok(uint64_t o) {
17634         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
17635         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
17636         return ret_conv;
17637 }
17638
17639 void  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_free"))) TS_CResult_RouteHintDecodeErrorZ_free(uint64_t _res) {
17640         if (!ptr_is_owned(_res)) return;
17641         void* _res_ptr = untag_ptr(_res);
17642         CHECK_ACCESS(_res_ptr);
17643         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
17644         FREE(untag_ptr(_res));
17645         CResult_RouteHintDecodeErrorZ_free(_res_conv);
17646 }
17647
17648 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
17649         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
17650         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
17651         return tag_ptr(ret_conv, true);
17652 }
17653 int64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintDecodeErrorZ_clone_ptr(uint64_t arg) {
17654         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
17655         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
17656         return ret_conv;
17657 }
17658
17659 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone"))) TS_CResult_RouteHintDecodeErrorZ_clone(uint64_t orig) {
17660         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
17661         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
17662         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
17663         return tag_ptr(ret_conv, true);
17664 }
17665
17666 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_ok(uint64_t o) {
17667         LDKRouteHintHop o_conv;
17668         o_conv.inner = untag_ptr(o);
17669         o_conv.is_owned = ptr_is_owned(o);
17670         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17671         o_conv = RouteHintHop_clone(&o_conv);
17672         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
17673         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
17674         return tag_ptr(ret_conv, true);
17675 }
17676
17677 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_err"))) TS_CResult_RouteHintHopDecodeErrorZ_err(uint64_t e) {
17678         void* e_ptr = untag_ptr(e);
17679         CHECK_ACCESS(e_ptr);
17680         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17681         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17682         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
17683         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
17684         return tag_ptr(ret_conv, true);
17685 }
17686
17687 jboolean  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_is_ok(uint64_t o) {
17688         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
17689         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
17690         return ret_conv;
17691 }
17692
17693 void  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_free"))) TS_CResult_RouteHintHopDecodeErrorZ_free(uint64_t _res) {
17694         if (!ptr_is_owned(_res)) return;
17695         void* _res_ptr = untag_ptr(_res);
17696         CHECK_ACCESS(_res_ptr);
17697         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
17698         FREE(untag_ptr(_res));
17699         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
17700 }
17701
17702 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
17703         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
17704         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
17705         return tag_ptr(ret_conv, true);
17706 }
17707 int64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr(uint64_t arg) {
17708         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
17709         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
17710         return ret_conv;
17711 }
17712
17713 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone"))) TS_CResult_RouteHintHopDecodeErrorZ_clone(uint64_t orig) {
17714         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
17715         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
17716         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
17717         return tag_ptr(ret_conv, true);
17718 }
17719
17720 void  __attribute__((export_name("TS_CVec_PublicKeyZ_free"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
17721         LDKCVec_PublicKeyZ _res_constr;
17722         _res_constr.datalen = _res->arr_len;
17723         if (_res_constr.datalen > 0)
17724                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
17725         else
17726                 _res_constr.data = NULL;
17727         int8_tArray* _res_vals = (void*) _res->elems;
17728         for (size_t m = 0; m < _res_constr.datalen; m++) {
17729                 int8_tArray _res_conv_12 = _res_vals[m];
17730                 LDKPublicKey _res_conv_12_ref;
17731                 CHECK(_res_conv_12->arr_len == 33);
17732                 memcpy(_res_conv_12_ref.compressed_form, _res_conv_12->elems, 33); FREE(_res_conv_12);
17733                 _res_constr.data[m] = _res_conv_12_ref;
17734         }
17735         FREE(_res);
17736         CVec_PublicKeyZ_free(_res_constr);
17737 }
17738
17739 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok(uint64_t o) {
17740         LDKFixedPenaltyScorer o_conv;
17741         o_conv.inner = untag_ptr(o);
17742         o_conv.is_owned = ptr_is_owned(o);
17743         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17744         o_conv = FixedPenaltyScorer_clone(&o_conv);
17745         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
17746         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
17747         return tag_ptr(ret_conv, true);
17748 }
17749
17750 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_err(uint64_t e) {
17751         void* e_ptr = untag_ptr(e);
17752         CHECK_ACCESS(e_ptr);
17753         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17754         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17755         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
17756         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
17757         return tag_ptr(ret_conv, true);
17758 }
17759
17760 jboolean  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(uint64_t o) {
17761         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
17762         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
17763         return ret_conv;
17764 }
17765
17766 void  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_free"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_free(uint64_t _res) {
17767         if (!ptr_is_owned(_res)) return;
17768         void* _res_ptr = untag_ptr(_res);
17769         CHECK_ACCESS(_res_ptr);
17770         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
17771         FREE(untag_ptr(_res));
17772         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
17773 }
17774
17775 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
17776         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
17777         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
17778         return tag_ptr(ret_conv, true);
17779 }
17780 int64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(uint64_t arg) {
17781         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
17782         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
17783         return ret_conv;
17784 }
17785
17786 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone(uint64_t orig) {
17787         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
17788         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
17789         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
17790         return tag_ptr(ret_conv, true);
17791 }
17792
17793 void  __attribute__((export_name("TS_CVec_NodeIdZ_free"))) TS_CVec_NodeIdZ_free(uint64_tArray _res) {
17794         LDKCVec_NodeIdZ _res_constr;
17795         _res_constr.datalen = _res->arr_len;
17796         if (_res_constr.datalen > 0)
17797                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
17798         else
17799                 _res_constr.data = NULL;
17800         uint64_t* _res_vals = _res->elems;
17801         for (size_t i = 0; i < _res_constr.datalen; i++) {
17802                 uint64_t _res_conv_8 = _res_vals[i];
17803                 LDKNodeId _res_conv_8_conv;
17804                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
17805                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
17806                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
17807                 _res_constr.data[i] = _res_conv_8_conv;
17808         }
17809         FREE(_res);
17810         CVec_NodeIdZ_free(_res_constr);
17811 }
17812
17813 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
17814         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
17815         *ret_conv = C2Tuple_u64u64Z_clone(arg);
17816         return tag_ptr(ret_conv, true);
17817 }
17818 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone_ptr"))) TS_C2Tuple_u64u64Z_clone_ptr(uint64_t arg) {
17819         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
17820         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
17821         return ret_conv;
17822 }
17823
17824 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone"))) TS_C2Tuple_u64u64Z_clone(uint64_t orig) {
17825         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
17826         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
17827         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
17828         return tag_ptr(ret_conv, true);
17829 }
17830
17831 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_new"))) TS_C2Tuple_u64u64Z_new(int64_t a, int64_t b) {
17832         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
17833         *ret_conv = C2Tuple_u64u64Z_new(a, b);
17834         return tag_ptr(ret_conv, true);
17835 }
17836
17837 void  __attribute__((export_name("TS_C2Tuple_u64u64Z_free"))) TS_C2Tuple_u64u64Z_free(uint64_t _res) {
17838         if (!ptr_is_owned(_res)) return;
17839         void* _res_ptr = untag_ptr(_res);
17840         CHECK_ACCESS(_res_ptr);
17841         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
17842         FREE(untag_ptr(_res));
17843         C2Tuple_u64u64Z_free(_res_conv);
17844 }
17845
17846 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_some"))) TS_COption_C2Tuple_u64u64ZZ_some(uint64_t o) {
17847         void* o_ptr = untag_ptr(o);
17848         CHECK_ACCESS(o_ptr);
17849         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
17850         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
17851         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
17852         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
17853         uint64_t ret_ref = tag_ptr(ret_copy, true);
17854         return ret_ref;
17855 }
17856
17857 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_none"))) TS_COption_C2Tuple_u64u64ZZ_none() {
17858         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
17859         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
17860         uint64_t ret_ref = tag_ptr(ret_copy, true);
17861         return ret_ref;
17862 }
17863
17864 void  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_free"))) TS_COption_C2Tuple_u64u64ZZ_free(uint64_t _res) {
17865         if (!ptr_is_owned(_res)) return;
17866         void* _res_ptr = untag_ptr(_res);
17867         CHECK_ACCESS(_res_ptr);
17868         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
17869         FREE(untag_ptr(_res));
17870         COption_C2Tuple_u64u64ZZ_free(_res_conv);
17871 }
17872
17873 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
17874         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
17875         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
17876         uint64_t ret_ref = tag_ptr(ret_copy, true);
17877         return ret_ref;
17878 }
17879 int64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone_ptr"))) TS_COption_C2Tuple_u64u64ZZ_clone_ptr(uint64_t arg) {
17880         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
17881         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
17882         return ret_conv;
17883 }
17884
17885 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone"))) TS_COption_C2Tuple_u64u64ZZ_clone(uint64_t orig) {
17886         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
17887         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
17888         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
17889         uint64_t ret_ref = tag_ptr(ret_copy, true);
17890         return ret_ref;
17891 }
17892
17893 uint64_t  __attribute__((export_name("TS_C2Tuple_Z_new"))) TS_C2Tuple_Z_new(int16_tArray a, int16_tArray b) {
17894         LDKThirtyTwoU16s a_ref;
17895         CHECK(a->arr_len == 32);
17896         memcpy(a_ref.data, a->elems, 32 * 2); FREE(a);
17897         LDKThirtyTwoU16s b_ref;
17898         CHECK(b->arr_len == 32);
17899         memcpy(b_ref.data, b->elems, 32 * 2); FREE(b);
17900         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
17901         *ret_conv = C2Tuple_Z_new(a_ref, b_ref);
17902         return tag_ptr(ret_conv, true);
17903 }
17904
17905 void  __attribute__((export_name("TS_C2Tuple_Z_free"))) TS_C2Tuple_Z_free(uint64_t _res) {
17906         if (!ptr_is_owned(_res)) return;
17907         void* _res_ptr = untag_ptr(_res);
17908         CHECK_ACCESS(_res_ptr);
17909         LDKC2Tuple_Z _res_conv = *(LDKC2Tuple_Z*)(_res_ptr);
17910         FREE(untag_ptr(_res));
17911         C2Tuple_Z_free(_res_conv);
17912 }
17913
17914 uint64_t  __attribute__((export_name("TS_C2Tuple__u1632_u1632Z_new"))) TS_C2Tuple__u1632_u1632Z_new(int16_tArray a, int16_tArray b) {
17915         LDKThirtyTwoU16s a_ref;
17916         CHECK(a->arr_len == 32);
17917         memcpy(a_ref.data, a->elems, 32 * 2); FREE(a);
17918         LDKThirtyTwoU16s b_ref;
17919         CHECK(b->arr_len == 32);
17920         memcpy(b_ref.data, b->elems, 32 * 2); FREE(b);
17921         LDKC2Tuple__u1632_u1632Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u1632_u1632Z), "LDKC2Tuple__u1632_u1632Z");
17922         *ret_conv = C2Tuple__u1632_u1632Z_new(a_ref, b_ref);
17923         return tag_ptr(ret_conv, true);
17924 }
17925
17926 void  __attribute__((export_name("TS_C2Tuple__u1632_u1632Z_free"))) TS_C2Tuple__u1632_u1632Z_free(uint64_t _res) {
17927         if (!ptr_is_owned(_res)) return;
17928         void* _res_ptr = untag_ptr(_res);
17929         CHECK_ACCESS(_res_ptr);
17930         LDKC2Tuple__u1632_u1632Z _res_conv = *(LDKC2Tuple__u1632_u1632Z*)(_res_ptr);
17931         FREE(untag_ptr(_res));
17932         C2Tuple__u1632_u1632Z_free(_res_conv);
17933 }
17934
17935 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some"))) TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(uint64_t o) {
17936         void* o_ptr = untag_ptr(o);
17937         CHECK_ACCESS(o_ptr);
17938         LDKC2Tuple__u1632_u1632Z o_conv = *(LDKC2Tuple__u1632_u1632Z*)(o_ptr);
17939         // WARNING: we may need a move here but no clone is available for LDKC2Tuple__u1632_u1632Z
17940         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
17941         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(o_conv);
17942         uint64_t ret_ref = tag_ptr(ret_copy, true);
17943         return ret_ref;
17944 }
17945
17946 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none"))) TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none() {
17947         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
17948         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none();
17949         uint64_t ret_ref = tag_ptr(ret_copy, true);
17950         return ret_ref;
17951 }
17952
17953 void  __attribute__((export_name("TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free"))) TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(uint64_t _res) {
17954         if (!ptr_is_owned(_res)) return;
17955         void* _res_ptr = untag_ptr(_res);
17956         CHECK_ACCESS(_res_ptr);
17957         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ _res_conv = *(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)(_res_ptr);
17958         FREE(untag_ptr(_res));
17959         COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(_res_conv);
17960 }
17961
17962 uint64_t  __attribute__((export_name("TS_COption_f64Z_some"))) TS_COption_f64Z_some(double o) {
17963         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
17964         *ret_copy = COption_f64Z_some(o);
17965         uint64_t ret_ref = tag_ptr(ret_copy, true);
17966         return ret_ref;
17967 }
17968
17969 uint64_t  __attribute__((export_name("TS_COption_f64Z_none"))) TS_COption_f64Z_none() {
17970         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
17971         *ret_copy = COption_f64Z_none();
17972         uint64_t ret_ref = tag_ptr(ret_copy, true);
17973         return ret_ref;
17974 }
17975
17976 void  __attribute__((export_name("TS_COption_f64Z_free"))) TS_COption_f64Z_free(uint64_t _res) {
17977         if (!ptr_is_owned(_res)) return;
17978         void* _res_ptr = untag_ptr(_res);
17979         CHECK_ACCESS(_res_ptr);
17980         LDKCOption_f64Z _res_conv = *(LDKCOption_f64Z*)(_res_ptr);
17981         FREE(untag_ptr(_res));
17982         COption_f64Z_free(_res_conv);
17983 }
17984
17985 static inline uint64_t COption_f64Z_clone_ptr(LDKCOption_f64Z *NONNULL_PTR arg) {
17986         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
17987         *ret_copy = COption_f64Z_clone(arg);
17988         uint64_t ret_ref = tag_ptr(ret_copy, true);
17989         return ret_ref;
17990 }
17991 int64_t  __attribute__((export_name("TS_COption_f64Z_clone_ptr"))) TS_COption_f64Z_clone_ptr(uint64_t arg) {
17992         LDKCOption_f64Z* arg_conv = (LDKCOption_f64Z*)untag_ptr(arg);
17993         int64_t ret_conv = COption_f64Z_clone_ptr(arg_conv);
17994         return ret_conv;
17995 }
17996
17997 uint64_t  __attribute__((export_name("TS_COption_f64Z_clone"))) TS_COption_f64Z_clone(uint64_t orig) {
17998         LDKCOption_f64Z* orig_conv = (LDKCOption_f64Z*)untag_ptr(orig);
17999         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
18000         *ret_copy = COption_f64Z_clone(orig_conv);
18001         uint64_t ret_ref = tag_ptr(ret_copy, true);
18002         return ret_ref;
18003 }
18004
18005 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_ok(uint64_t o) {
18006         LDKProbabilisticScorer o_conv;
18007         o_conv.inner = untag_ptr(o);
18008         o_conv.is_owned = ptr_is_owned(o);
18009         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18010         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
18011         
18012         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
18013         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
18014         return tag_ptr(ret_conv, true);
18015 }
18016
18017 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_err(uint64_t e) {
18018         void* e_ptr = untag_ptr(e);
18019         CHECK_ACCESS(e_ptr);
18020         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18021         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18022         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
18023         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
18024         return tag_ptr(ret_conv, true);
18025 }
18026
18027 jboolean  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok(uint64_t o) {
18028         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
18029         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
18030         return ret_conv;
18031 }
18032
18033 void  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_free"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_free(uint64_t _res) {
18034         if (!ptr_is_owned(_res)) return;
18035         void* _res_ptr = untag_ptr(_res);
18036         CHECK_ACCESS(_res_ptr);
18037         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
18038         FREE(untag_ptr(_res));
18039         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
18040 }
18041
18042 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
18043         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
18044         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
18045         return tag_ptr(ret_conv, true);
18046 }
18047 int64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone_ptr"))) TS_C2Tuple_usizeTransactionZ_clone_ptr(uint64_t arg) {
18048         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
18049         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
18050         return ret_conv;
18051 }
18052
18053 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone"))) TS_C2Tuple_usizeTransactionZ_clone(uint64_t orig) {
18054         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
18055         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
18056         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
18057         return tag_ptr(ret_conv, true);
18058 }
18059
18060 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_new"))) TS_C2Tuple_usizeTransactionZ_new(uint32_t a, int8_tArray b) {
18061         LDKTransaction b_ref;
18062         b_ref.datalen = b->arr_len;
18063         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
18064         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
18065         b_ref.data_is_owned = true;
18066         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
18067         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
18068         return tag_ptr(ret_conv, true);
18069 }
18070
18071 void  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_free"))) TS_C2Tuple_usizeTransactionZ_free(uint64_t _res) {
18072         if (!ptr_is_owned(_res)) return;
18073         void* _res_ptr = untag_ptr(_res);
18074         CHECK_ACCESS(_res_ptr);
18075         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
18076         FREE(untag_ptr(_res));
18077         C2Tuple_usizeTransactionZ_free(_res_conv);
18078 }
18079
18080 void  __attribute__((export_name("TS_CVec_C2Tuple_usizeTransactionZZ_free"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint64_tArray _res) {
18081         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
18082         _res_constr.datalen = _res->arr_len;
18083         if (_res_constr.datalen > 0)
18084                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
18085         else
18086                 _res_constr.data = NULL;
18087         uint64_t* _res_vals = _res->elems;
18088         for (size_t c = 0; c < _res_constr.datalen; c++) {
18089                 uint64_t _res_conv_28 = _res_vals[c];
18090                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
18091                 CHECK_ACCESS(_res_conv_28_ptr);
18092                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
18093                 FREE(untag_ptr(_res_conv_28));
18094                 _res_constr.data[c] = _res_conv_28_conv;
18095         }
18096         FREE(_res);
18097         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
18098 }
18099
18100 static inline uint64_t C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
18101         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ");
18102         *ret_conv = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone(arg);
18103         return tag_ptr(ret_conv, true);
18104 }
18105 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone_ptr(uint64_t arg) {
18106         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)untag_ptr(arg);
18107         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
18108         return ret_conv;
18109 }
18110
18111 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone"))) TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone(uint64_t orig) {
18112         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)untag_ptr(orig);
18113         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ");
18114         *ret_conv = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone(orig_conv);
18115         return tag_ptr(ret_conv, true);
18116 }
18117
18118 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_new"))) TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_new(int8_tArray a, uint64_t b) {
18119         LDKThirtyTwoBytes a_ref;
18120         CHECK(a->arr_len == 32);
18121         memcpy(a_ref.data, a->elems, 32); FREE(a);
18122         void* b_ptr = untag_ptr(b);
18123         CHECK_ACCESS(b_ptr);
18124         LDKCOption_ThirtyTwoBytesZ b_conv = *(LDKCOption_ThirtyTwoBytesZ*)(b_ptr);
18125         b_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(b));
18126         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ");
18127         *ret_conv = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_new(a_ref, b_conv);
18128         return tag_ptr(ret_conv, true);
18129 }
18130
18131 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_free"))) TS_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_free(uint64_t _res) {
18132         if (!ptr_is_owned(_res)) return;
18133         void* _res_ptr = untag_ptr(_res);
18134         CHECK_ACCESS(_res_ptr);
18135         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)(_res_ptr);
18136         FREE(untag_ptr(_res));
18137         C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_free(_res_conv);
18138 }
18139
18140 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ_free(uint64_tArray _res) {
18141         LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ _res_constr;
18142         _res_constr.datalen = _res->arr_len;
18143         if (_res_constr.datalen > 0)
18144                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ Elements");
18145         else
18146                 _res_constr.data = NULL;
18147         uint64_t* _res_vals = _res->elems;
18148         for (size_t x = 0; x < _res_constr.datalen; x++) {
18149                 uint64_t _res_conv_49 = _res_vals[x];
18150                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
18151                 CHECK_ACCESS(_res_conv_49_ptr);
18152                 LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ _res_conv_49_conv = *(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)(_res_conv_49_ptr);
18153                 FREE(untag_ptr(_res_conv_49));
18154                 _res_constr.data[x] = _res_conv_49_conv;
18155         }
18156         FREE(_res);
18157         CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ_free(_res_constr);
18158 }
18159
18160 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_ok"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_ok(uint32_t o) {
18161         LDKChannelMonitorUpdateStatus o_conv = LDKChannelMonitorUpdateStatus_from_js(o);
18162         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
18163         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_ok(o_conv);
18164         return tag_ptr(ret_conv, true);
18165 }
18166
18167 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_err"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_err() {
18168         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
18169         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_err();
18170         return tag_ptr(ret_conv, true);
18171 }
18172
18173 jboolean  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_is_ok"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(uint64_t o) {
18174         LDKCResult_ChannelMonitorUpdateStatusNoneZ* o_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(o);
18175         jboolean ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(o_conv);
18176         return ret_conv;
18177 }
18178
18179 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_free"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_free(uint64_t _res) {
18180         if (!ptr_is_owned(_res)) return;
18181         void* _res_ptr = untag_ptr(_res);
18182         CHECK_ACCESS(_res_ptr);
18183         LDKCResult_ChannelMonitorUpdateStatusNoneZ _res_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(_res_ptr);
18184         FREE(untag_ptr(_res));
18185         CResult_ChannelMonitorUpdateStatusNoneZ_free(_res_conv);
18186 }
18187
18188 static inline uint64_t CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR arg) {
18189         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
18190         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(arg);
18191         return tag_ptr(ret_conv, true);
18192 }
18193 int64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(uint64_t arg) {
18194         LDKCResult_ChannelMonitorUpdateStatusNoneZ* arg_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(arg);
18195         int64_t ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(arg_conv);
18196         return ret_conv;
18197 }
18198
18199 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_clone"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_clone(uint64_t orig) {
18200         LDKCResult_ChannelMonitorUpdateStatusNoneZ* orig_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(orig);
18201         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
18202         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(orig_conv);
18203         return tag_ptr(ret_conv, true);
18204 }
18205
18206 void  __attribute__((export_name("TS_CVec_MonitorEventZ_free"))) TS_CVec_MonitorEventZ_free(uint64_tArray _res) {
18207         LDKCVec_MonitorEventZ _res_constr;
18208         _res_constr.datalen = _res->arr_len;
18209         if (_res_constr.datalen > 0)
18210                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
18211         else
18212                 _res_constr.data = NULL;
18213         uint64_t* _res_vals = _res->elems;
18214         for (size_t o = 0; o < _res_constr.datalen; o++) {
18215                 uint64_t _res_conv_14 = _res_vals[o];
18216                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
18217                 CHECK_ACCESS(_res_conv_14_ptr);
18218                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
18219                 FREE(untag_ptr(_res_conv_14));
18220                 _res_constr.data[o] = _res_conv_14_conv;
18221         }
18222         FREE(_res);
18223         CVec_MonitorEventZ_free(_res_constr);
18224 }
18225
18226 static inline uint64_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
18227         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
18228         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(arg);
18229         return tag_ptr(ret_conv, true);
18230 }
18231 int64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(uint64_t arg) {
18232         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
18233         int64_t ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
18234         return ret_conv;
18235 }
18236
18237 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(uint64_t orig) {
18238         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
18239         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
18240         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
18241         return tag_ptr(ret_conv, true);
18242 }
18243
18244 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(uint64_t a, uint64_tArray b, int8_tArray c) {
18245         LDKOutPoint a_conv;
18246         a_conv.inner = untag_ptr(a);
18247         a_conv.is_owned = ptr_is_owned(a);
18248         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18249         a_conv = OutPoint_clone(&a_conv);
18250         LDKCVec_MonitorEventZ b_constr;
18251         b_constr.datalen = b->arr_len;
18252         if (b_constr.datalen > 0)
18253                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
18254         else
18255                 b_constr.data = NULL;
18256         uint64_t* b_vals = b->elems;
18257         for (size_t o = 0; o < b_constr.datalen; o++) {
18258                 uint64_t b_conv_14 = b_vals[o];
18259                 void* b_conv_14_ptr = untag_ptr(b_conv_14);
18260                 CHECK_ACCESS(b_conv_14_ptr);
18261                 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
18262                 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(b_conv_14));
18263                 b_constr.data[o] = b_conv_14_conv;
18264         }
18265         FREE(b);
18266         LDKPublicKey c_ref;
18267         CHECK(c->arr_len == 33);
18268         memcpy(c_ref.compressed_form, c->elems, 33); FREE(c);
18269         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
18270         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a_conv, b_constr, c_ref);
18271         return tag_ptr(ret_conv, true);
18272 }
18273
18274 void  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(uint64_t _res) {
18275         if (!ptr_is_owned(_res)) return;
18276         void* _res_ptr = untag_ptr(_res);
18277         CHECK_ACCESS(_res_ptr);
18278         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
18279         FREE(untag_ptr(_res));
18280         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res_conv);
18281 }
18282
18283 void  __attribute__((export_name("TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free"))) TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(uint64_tArray _res) {
18284         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res_constr;
18285         _res_constr.datalen = _res->arr_len;
18286         if (_res_constr.datalen > 0)
18287                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
18288         else
18289                 _res_constr.data = NULL;
18290         uint64_t* _res_vals = _res->elems;
18291         for (size_t x = 0; x < _res_constr.datalen; x++) {
18292                 uint64_t _res_conv_49 = _res_vals[x];
18293                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
18294                 CHECK_ACCESS(_res_conv_49_ptr);
18295                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_conv_49_ptr);
18296                 FREE(untag_ptr(_res_conv_49));
18297                 _res_constr.data[x] = _res_conv_49_conv;
18298         }
18299         FREE(_res);
18300         CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
18301 }
18302
18303 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint64_t o) {
18304         LDKInitFeatures o_conv;
18305         o_conv.inner = untag_ptr(o);
18306         o_conv.is_owned = ptr_is_owned(o);
18307         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18308         o_conv = InitFeatures_clone(&o_conv);
18309         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
18310         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
18311         return tag_ptr(ret_conv, true);
18312 }
18313
18314 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_err"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint64_t e) {
18315         void* e_ptr = untag_ptr(e);
18316         CHECK_ACCESS(e_ptr);
18317         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18318         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18319         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
18320         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
18321         return tag_ptr(ret_conv, true);
18322 }
18323
18324 jboolean  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_is_ok(uint64_t o) {
18325         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
18326         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
18327         return ret_conv;
18328 }
18329
18330 void  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_free"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint64_t _res) {
18331         if (!ptr_is_owned(_res)) return;
18332         void* _res_ptr = untag_ptr(_res);
18333         CHECK_ACCESS(_res_ptr);
18334         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
18335         FREE(untag_ptr(_res));
18336         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
18337 }
18338
18339 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18340         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
18341         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
18342         return tag_ptr(ret_conv, true);
18343 }
18344 int64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18345         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
18346         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18347         return ret_conv;
18348 }
18349
18350 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone"))) TS_CResult_InitFeaturesDecodeErrorZ_clone(uint64_t orig) {
18351         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
18352         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
18353         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
18354         return tag_ptr(ret_conv, true);
18355 }
18356
18357 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint64_t o) {
18358         LDKChannelFeatures o_conv;
18359         o_conv.inner = untag_ptr(o);
18360         o_conv.is_owned = ptr_is_owned(o);
18361         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18362         o_conv = ChannelFeatures_clone(&o_conv);
18363         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
18364         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
18365         return tag_ptr(ret_conv, true);
18366 }
18367
18368 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint64_t e) {
18369         void* e_ptr = untag_ptr(e);
18370         CHECK_ACCESS(e_ptr);
18371         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18372         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18373         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
18374         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
18375         return tag_ptr(ret_conv, true);
18376 }
18377
18378 jboolean  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok(uint64_t o) {
18379         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
18380         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
18381         return ret_conv;
18382 }
18383
18384 void  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint64_t _res) {
18385         if (!ptr_is_owned(_res)) return;
18386         void* _res_ptr = untag_ptr(_res);
18387         CHECK_ACCESS(_res_ptr);
18388         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
18389         FREE(untag_ptr(_res));
18390         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
18391 }
18392
18393 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18394         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
18395         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
18396         return tag_ptr(ret_conv, true);
18397 }
18398 int64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18399         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
18400         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18401         return ret_conv;
18402 }
18403
18404 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone(uint64_t orig) {
18405         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
18406         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
18407         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
18408         return tag_ptr(ret_conv, true);
18409 }
18410
18411 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint64_t o) {
18412         LDKNodeFeatures o_conv;
18413         o_conv.inner = untag_ptr(o);
18414         o_conv.is_owned = ptr_is_owned(o);
18415         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18416         o_conv = NodeFeatures_clone(&o_conv);
18417         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
18418         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
18419         return tag_ptr(ret_conv, true);
18420 }
18421
18422 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint64_t e) {
18423         void* e_ptr = untag_ptr(e);
18424         CHECK_ACCESS(e_ptr);
18425         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18426         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18427         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
18428         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
18429         return tag_ptr(ret_conv, true);
18430 }
18431
18432 jboolean  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
18433         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
18434         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
18435         return ret_conv;
18436 }
18437
18438 void  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_free"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint64_t _res) {
18439         if (!ptr_is_owned(_res)) return;
18440         void* _res_ptr = untag_ptr(_res);
18441         CHECK_ACCESS(_res_ptr);
18442         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
18443         FREE(untag_ptr(_res));
18444         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
18445 }
18446
18447 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18448         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
18449         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
18450         return tag_ptr(ret_conv, true);
18451 }
18452 int64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18453         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
18454         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18455         return ret_conv;
18456 }
18457
18458 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone(uint64_t orig) {
18459         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
18460         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
18461         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
18462         return tag_ptr(ret_conv, true);
18463 }
18464
18465 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(uint64_t o) {
18466         LDKBolt11InvoiceFeatures o_conv;
18467         o_conv.inner = untag_ptr(o);
18468         o_conv.is_owned = ptr_is_owned(o);
18469         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18470         o_conv = Bolt11InvoiceFeatures_clone(&o_conv);
18471         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
18472         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o_conv);
18473         return tag_ptr(ret_conv, true);
18474 }
18475
18476 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(uint64_t e) {
18477         void* e_ptr = untag_ptr(e);
18478         CHECK_ACCESS(e_ptr);
18479         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18480         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18481         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
18482         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e_conv);
18483         return tag_ptr(ret_conv, true);
18484 }
18485
18486 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(uint64_t o) {
18487         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
18488         jboolean ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
18489         return ret_conv;
18490 }
18491
18492 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(uint64_t _res) {
18493         if (!ptr_is_owned(_res)) return;
18494         void* _res_ptr = untag_ptr(_res);
18495         CHECK_ACCESS(_res_ptr);
18496         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
18497         FREE(untag_ptr(_res));
18498         CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res_conv);
18499 }
18500
18501 static inline uint64_t CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18502         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
18503         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(arg);
18504         return tag_ptr(ret_conv, true);
18505 }
18506 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18507         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
18508         int64_t ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18509         return ret_conv;
18510 }
18511
18512 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(uint64_t orig) {
18513         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
18514         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
18515         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
18516         return tag_ptr(ret_conv, true);
18517 }
18518
18519 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(uint64_t o) {
18520         LDKBolt12InvoiceFeatures o_conv;
18521         o_conv.inner = untag_ptr(o);
18522         o_conv.is_owned = ptr_is_owned(o);
18523         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18524         o_conv = Bolt12InvoiceFeatures_clone(&o_conv);
18525         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
18526         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o_conv);
18527         return tag_ptr(ret_conv, true);
18528 }
18529
18530 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(uint64_t e) {
18531         void* e_ptr = untag_ptr(e);
18532         CHECK_ACCESS(e_ptr);
18533         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18534         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18535         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
18536         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e_conv);
18537         return tag_ptr(ret_conv, true);
18538 }
18539
18540 jboolean  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(uint64_t o) {
18541         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
18542         jboolean ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
18543         return ret_conv;
18544 }
18545
18546 void  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(uint64_t _res) {
18547         if (!ptr_is_owned(_res)) return;
18548         void* _res_ptr = untag_ptr(_res);
18549         CHECK_ACCESS(_res_ptr);
18550         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
18551         FREE(untag_ptr(_res));
18552         CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res_conv);
18553 }
18554
18555 static inline uint64_t CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18556         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
18557         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(arg);
18558         return tag_ptr(ret_conv, true);
18559 }
18560 int64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18561         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
18562         int64_t ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18563         return ret_conv;
18564 }
18565
18566 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(uint64_t orig) {
18567         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
18568         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
18569         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
18570         return tag_ptr(ret_conv, true);
18571 }
18572
18573 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_ok(uint64_t o) {
18574         LDKBlindedHopFeatures o_conv;
18575         o_conv.inner = untag_ptr(o);
18576         o_conv.is_owned = ptr_is_owned(o);
18577         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18578         o_conv = BlindedHopFeatures_clone(&o_conv);
18579         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
18580         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_ok(o_conv);
18581         return tag_ptr(ret_conv, true);
18582 }
18583
18584 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_err"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_err(uint64_t e) {
18585         void* e_ptr = untag_ptr(e);
18586         CHECK_ACCESS(e_ptr);
18587         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18588         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18589         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
18590         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_err(e_conv);
18591         return tag_ptr(ret_conv, true);
18592 }
18593
18594 jboolean  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(uint64_t o) {
18595         LDKCResult_BlindedHopFeaturesDecodeErrorZ* o_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(o);
18596         jboolean ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o_conv);
18597         return ret_conv;
18598 }
18599
18600 void  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_free"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_free(uint64_t _res) {
18601         if (!ptr_is_owned(_res)) return;
18602         void* _res_ptr = untag_ptr(_res);
18603         CHECK_ACCESS(_res_ptr);
18604         LDKCResult_BlindedHopFeaturesDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopFeaturesDecodeErrorZ*)(_res_ptr);
18605         FREE(untag_ptr(_res));
18606         CResult_BlindedHopFeaturesDecodeErrorZ_free(_res_conv);
18607 }
18608
18609 static inline uint64_t CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18610         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
18611         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(arg);
18612         return tag_ptr(ret_conv, true);
18613 }
18614 int64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18615         LDKCResult_BlindedHopFeaturesDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(arg);
18616         int64_t ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18617         return ret_conv;
18618 }
18619
18620 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone(uint64_t orig) {
18621         LDKCResult_BlindedHopFeaturesDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(orig);
18622         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
18623         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig_conv);
18624         return tag_ptr(ret_conv, true);
18625 }
18626
18627 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(uint64_t o) {
18628         LDKChannelTypeFeatures o_conv;
18629         o_conv.inner = untag_ptr(o);
18630         o_conv.is_owned = ptr_is_owned(o);
18631         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18632         o_conv = ChannelTypeFeatures_clone(&o_conv);
18633         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
18634         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
18635         return tag_ptr(ret_conv, true);
18636 }
18637
18638 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err(uint64_t e) {
18639         void* e_ptr = untag_ptr(e);
18640         CHECK_ACCESS(e_ptr);
18641         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18642         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18643         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
18644         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
18645         return tag_ptr(ret_conv, true);
18646 }
18647
18648 jboolean  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
18649         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
18650         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
18651         return ret_conv;
18652 }
18653
18654 void  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free(uint64_t _res) {
18655         if (!ptr_is_owned(_res)) return;
18656         void* _res_ptr = untag_ptr(_res);
18657         CHECK_ACCESS(_res_ptr);
18658         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
18659         FREE(untag_ptr(_res));
18660         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
18661 }
18662
18663 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18664         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
18665         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
18666         return tag_ptr(ret_conv, true);
18667 }
18668 int64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18669         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
18670         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18671         return ret_conv;
18672 }
18673
18674 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone(uint64_t orig) {
18675         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
18676         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
18677         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
18678         return tag_ptr(ret_conv, true);
18679 }
18680
18681 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_ok"))) TS_CResult_OfferBolt12ParseErrorZ_ok(uint64_t o) {
18682         LDKOffer o_conv;
18683         o_conv.inner = untag_ptr(o);
18684         o_conv.is_owned = ptr_is_owned(o);
18685         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18686         o_conv = Offer_clone(&o_conv);
18687         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
18688         *ret_conv = CResult_OfferBolt12ParseErrorZ_ok(o_conv);
18689         return tag_ptr(ret_conv, true);
18690 }
18691
18692 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_err"))) TS_CResult_OfferBolt12ParseErrorZ_err(uint64_t e) {
18693         LDKBolt12ParseError e_conv;
18694         e_conv.inner = untag_ptr(e);
18695         e_conv.is_owned = ptr_is_owned(e);
18696         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18697         e_conv = Bolt12ParseError_clone(&e_conv);
18698         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
18699         *ret_conv = CResult_OfferBolt12ParseErrorZ_err(e_conv);
18700         return tag_ptr(ret_conv, true);
18701 }
18702
18703 jboolean  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_is_ok"))) TS_CResult_OfferBolt12ParseErrorZ_is_ok(uint64_t o) {
18704         LDKCResult_OfferBolt12ParseErrorZ* o_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(o);
18705         jboolean ret_conv = CResult_OfferBolt12ParseErrorZ_is_ok(o_conv);
18706         return ret_conv;
18707 }
18708
18709 void  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_free"))) TS_CResult_OfferBolt12ParseErrorZ_free(uint64_t _res) {
18710         if (!ptr_is_owned(_res)) return;
18711         void* _res_ptr = untag_ptr(_res);
18712         CHECK_ACCESS(_res_ptr);
18713         LDKCResult_OfferBolt12ParseErrorZ _res_conv = *(LDKCResult_OfferBolt12ParseErrorZ*)(_res_ptr);
18714         FREE(untag_ptr(_res));
18715         CResult_OfferBolt12ParseErrorZ_free(_res_conv);
18716 }
18717
18718 static inline uint64_t CResult_OfferBolt12ParseErrorZ_clone_ptr(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR arg) {
18719         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
18720         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(arg);
18721         return tag_ptr(ret_conv, true);
18722 }
18723 int64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_clone_ptr"))) TS_CResult_OfferBolt12ParseErrorZ_clone_ptr(uint64_t arg) {
18724         LDKCResult_OfferBolt12ParseErrorZ* arg_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(arg);
18725         int64_t ret_conv = CResult_OfferBolt12ParseErrorZ_clone_ptr(arg_conv);
18726         return ret_conv;
18727 }
18728
18729 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_clone"))) TS_CResult_OfferBolt12ParseErrorZ_clone(uint64_t orig) {
18730         LDKCResult_OfferBolt12ParseErrorZ* orig_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(orig);
18731         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
18732         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(orig_conv);
18733         return tag_ptr(ret_conv, true);
18734 }
18735
18736 uint64_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_ok"))) TS_CResult_PublicKeySecp256k1ErrorZ_ok(int8_tArray o) {
18737         LDKPublicKey o_ref;
18738         CHECK(o->arr_len == 33);
18739         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
18740         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
18741         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_ok(o_ref);
18742         return tag_ptr(ret_conv, true);
18743 }
18744
18745 uint64_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_err"))) TS_CResult_PublicKeySecp256k1ErrorZ_err(uint32_t e) {
18746         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
18747         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
18748         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_err(e_conv);
18749         return tag_ptr(ret_conv, true);
18750 }
18751
18752 jboolean  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_is_ok"))) TS_CResult_PublicKeySecp256k1ErrorZ_is_ok(uint64_t o) {
18753         LDKCResult_PublicKeySecp256k1ErrorZ* o_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(o);
18754         jboolean ret_conv = CResult_PublicKeySecp256k1ErrorZ_is_ok(o_conv);
18755         return ret_conv;
18756 }
18757
18758 void  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_free"))) TS_CResult_PublicKeySecp256k1ErrorZ_free(uint64_t _res) {
18759         if (!ptr_is_owned(_res)) return;
18760         void* _res_ptr = untag_ptr(_res);
18761         CHECK_ACCESS(_res_ptr);
18762         LDKCResult_PublicKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PublicKeySecp256k1ErrorZ*)(_res_ptr);
18763         FREE(untag_ptr(_res));
18764         CResult_PublicKeySecp256k1ErrorZ_free(_res_conv);
18765 }
18766
18767 static inline uint64_t CResult_PublicKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR arg) {
18768         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
18769         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(arg);
18770         return tag_ptr(ret_conv, true);
18771 }
18772 int64_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_clone_ptr"))) TS_CResult_PublicKeySecp256k1ErrorZ_clone_ptr(uint64_t arg) {
18773         LDKCResult_PublicKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(arg);
18774         int64_t ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone_ptr(arg_conv);
18775         return ret_conv;
18776 }
18777
18778 uint64_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_clone"))) TS_CResult_PublicKeySecp256k1ErrorZ_clone(uint64_t orig) {
18779         LDKCResult_PublicKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(orig);
18780         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
18781         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(orig_conv);
18782         return tag_ptr(ret_conv, true);
18783 }
18784
18785 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_ok"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint64_t o) {
18786         LDKNodeId o_conv;
18787         o_conv.inner = untag_ptr(o);
18788         o_conv.is_owned = ptr_is_owned(o);
18789         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18790         o_conv = NodeId_clone(&o_conv);
18791         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
18792         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
18793         return tag_ptr(ret_conv, true);
18794 }
18795
18796 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_err"))) TS_CResult_NodeIdDecodeErrorZ_err(uint64_t e) {
18797         void* e_ptr = untag_ptr(e);
18798         CHECK_ACCESS(e_ptr);
18799         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18800         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18801         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
18802         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
18803         return tag_ptr(ret_conv, true);
18804 }
18805
18806 jboolean  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_is_ok"))) TS_CResult_NodeIdDecodeErrorZ_is_ok(uint64_t o) {
18807         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
18808         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
18809         return ret_conv;
18810 }
18811
18812 void  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_free"))) TS_CResult_NodeIdDecodeErrorZ_free(uint64_t _res) {
18813         if (!ptr_is_owned(_res)) return;
18814         void* _res_ptr = untag_ptr(_res);
18815         CHECK_ACCESS(_res_ptr);
18816         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
18817         FREE(untag_ptr(_res));
18818         CResult_NodeIdDecodeErrorZ_free(_res_conv);
18819 }
18820
18821 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
18822         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
18823         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
18824         return tag_ptr(ret_conv, true);
18825 }
18826 int64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone_ptr"))) TS_CResult_NodeIdDecodeErrorZ_clone_ptr(uint64_t arg) {
18827         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
18828         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
18829         return ret_conv;
18830 }
18831
18832 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint64_t orig) {
18833         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
18834         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
18835         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
18836         return tag_ptr(ret_conv, true);
18837 }
18838
18839 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_some"))) TS_COption_NetworkUpdateZ_some(uint64_t o) {
18840         void* o_ptr = untag_ptr(o);
18841         CHECK_ACCESS(o_ptr);
18842         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
18843         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
18844         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
18845         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
18846         uint64_t ret_ref = tag_ptr(ret_copy, true);
18847         return ret_ref;
18848 }
18849
18850 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_none"))) TS_COption_NetworkUpdateZ_none() {
18851         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
18852         *ret_copy = COption_NetworkUpdateZ_none();
18853         uint64_t ret_ref = tag_ptr(ret_copy, true);
18854         return ret_ref;
18855 }
18856
18857 void  __attribute__((export_name("TS_COption_NetworkUpdateZ_free"))) TS_COption_NetworkUpdateZ_free(uint64_t _res) {
18858         if (!ptr_is_owned(_res)) return;
18859         void* _res_ptr = untag_ptr(_res);
18860         CHECK_ACCESS(_res_ptr);
18861         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
18862         FREE(untag_ptr(_res));
18863         COption_NetworkUpdateZ_free(_res_conv);
18864 }
18865
18866 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
18867         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
18868         *ret_copy = COption_NetworkUpdateZ_clone(arg);
18869         uint64_t ret_ref = tag_ptr(ret_copy, true);
18870         return ret_ref;
18871 }
18872 int64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone_ptr"))) TS_COption_NetworkUpdateZ_clone_ptr(uint64_t arg) {
18873         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
18874         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
18875         return ret_conv;
18876 }
18877
18878 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone"))) TS_COption_NetworkUpdateZ_clone(uint64_t orig) {
18879         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
18880         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
18881         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
18882         uint64_t ret_ref = tag_ptr(ret_copy, true);
18883         return ret_ref;
18884 }
18885
18886 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok(uint64_t o) {
18887         void* o_ptr = untag_ptr(o);
18888         CHECK_ACCESS(o_ptr);
18889         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
18890         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
18891         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
18892         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
18893         return tag_ptr(ret_conv, true);
18894 }
18895
18896 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err(uint64_t e) {
18897         void* e_ptr = untag_ptr(e);
18898         CHECK_ACCESS(e_ptr);
18899         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18900         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18901         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
18902         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
18903         return tag_ptr(ret_conv, true);
18904 }
18905
18906 jboolean  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(uint64_t o) {
18907         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
18908         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
18909         return ret_conv;
18910 }
18911
18912 void  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free(uint64_t _res) {
18913         if (!ptr_is_owned(_res)) return;
18914         void* _res_ptr = untag_ptr(_res);
18915         CHECK_ACCESS(_res_ptr);
18916         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
18917         FREE(untag_ptr(_res));
18918         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
18919 }
18920
18921 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
18922         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
18923         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
18924         return tag_ptr(ret_conv, true);
18925 }
18926 int64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(uint64_t arg) {
18927         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
18928         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
18929         return ret_conv;
18930 }
18931
18932 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone(uint64_t orig) {
18933         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
18934         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
18935         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
18936         return tag_ptr(ret_conv, true);
18937 }
18938
18939 uint64_t  __attribute__((export_name("TS_COption_UtxoLookupZ_some"))) TS_COption_UtxoLookupZ_some(uint64_t o) {
18940         void* o_ptr = untag_ptr(o);
18941         CHECK_ACCESS(o_ptr);
18942         LDKUtxoLookup o_conv = *(LDKUtxoLookup*)(o_ptr);
18943         if (o_conv.free == LDKUtxoLookup_JCalls_free) {
18944                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18945                 LDKUtxoLookup_JCalls_cloned(&o_conv);
18946         }
18947         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
18948         *ret_copy = COption_UtxoLookupZ_some(o_conv);
18949         uint64_t ret_ref = tag_ptr(ret_copy, true);
18950         return ret_ref;
18951 }
18952
18953 uint64_t  __attribute__((export_name("TS_COption_UtxoLookupZ_none"))) TS_COption_UtxoLookupZ_none() {
18954         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
18955         *ret_copy = COption_UtxoLookupZ_none();
18956         uint64_t ret_ref = tag_ptr(ret_copy, true);
18957         return ret_ref;
18958 }
18959
18960 void  __attribute__((export_name("TS_COption_UtxoLookupZ_free"))) TS_COption_UtxoLookupZ_free(uint64_t _res) {
18961         if (!ptr_is_owned(_res)) return;
18962         void* _res_ptr = untag_ptr(_res);
18963         CHECK_ACCESS(_res_ptr);
18964         LDKCOption_UtxoLookupZ _res_conv = *(LDKCOption_UtxoLookupZ*)(_res_ptr);
18965         FREE(untag_ptr(_res));
18966         COption_UtxoLookupZ_free(_res_conv);
18967 }
18968
18969 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_ok"))) TS_CResult_NoneLightningErrorZ_ok() {
18970         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18971         *ret_conv = CResult_NoneLightningErrorZ_ok();
18972         return tag_ptr(ret_conv, true);
18973 }
18974
18975 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_err"))) TS_CResult_NoneLightningErrorZ_err(uint64_t e) {
18976         LDKLightningError e_conv;
18977         e_conv.inner = untag_ptr(e);
18978         e_conv.is_owned = ptr_is_owned(e);
18979         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18980         e_conv = LightningError_clone(&e_conv);
18981         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18982         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
18983         return tag_ptr(ret_conv, true);
18984 }
18985
18986 jboolean  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_is_ok"))) TS_CResult_NoneLightningErrorZ_is_ok(uint64_t o) {
18987         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
18988         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
18989         return ret_conv;
18990 }
18991
18992 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_free"))) TS_CResult_NoneLightningErrorZ_free(uint64_t _res) {
18993         if (!ptr_is_owned(_res)) return;
18994         void* _res_ptr = untag_ptr(_res);
18995         CHECK_ACCESS(_res_ptr);
18996         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
18997         FREE(untag_ptr(_res));
18998         CResult_NoneLightningErrorZ_free(_res_conv);
18999 }
19000
19001 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
19002         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19003         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
19004         return tag_ptr(ret_conv, true);
19005 }
19006 int64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone_ptr"))) TS_CResult_NoneLightningErrorZ_clone_ptr(uint64_t arg) {
19007         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
19008         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
19009         return ret_conv;
19010 }
19011
19012 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone"))) TS_CResult_NoneLightningErrorZ_clone(uint64_t orig) {
19013         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
19014         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19015         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
19016         return tag_ptr(ret_conv, true);
19017 }
19018
19019 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_ok"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
19020         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19021         *ret_conv = CResult_boolLightningErrorZ_ok(o);
19022         return tag_ptr(ret_conv, true);
19023 }
19024
19025 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_err"))) TS_CResult_boolLightningErrorZ_err(uint64_t e) {
19026         LDKLightningError e_conv;
19027         e_conv.inner = untag_ptr(e);
19028         e_conv.is_owned = ptr_is_owned(e);
19029         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19030         e_conv = LightningError_clone(&e_conv);
19031         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19032         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
19033         return tag_ptr(ret_conv, true);
19034 }
19035
19036 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_is_ok"))) TS_CResult_boolLightningErrorZ_is_ok(uint64_t o) {
19037         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
19038         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
19039         return ret_conv;
19040 }
19041
19042 void  __attribute__((export_name("TS_CResult_boolLightningErrorZ_free"))) TS_CResult_boolLightningErrorZ_free(uint64_t _res) {
19043         if (!ptr_is_owned(_res)) return;
19044         void* _res_ptr = untag_ptr(_res);
19045         CHECK_ACCESS(_res_ptr);
19046         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
19047         FREE(untag_ptr(_res));
19048         CResult_boolLightningErrorZ_free(_res_conv);
19049 }
19050
19051 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
19052         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19053         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
19054         return tag_ptr(ret_conv, true);
19055 }
19056 int64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone_ptr"))) TS_CResult_boolLightningErrorZ_clone_ptr(uint64_t arg) {
19057         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
19058         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
19059         return ret_conv;
19060 }
19061
19062 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone"))) TS_CResult_boolLightningErrorZ_clone(uint64_t orig) {
19063         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
19064         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19065         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
19066         return tag_ptr(ret_conv, true);
19067 }
19068
19069 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
19070         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
19071         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
19072         return tag_ptr(ret_conv, true);
19073 }
19074 int64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(uint64_t arg) {
19075         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
19076         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
19077         return ret_conv;
19078 }
19079
19080 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint64_t orig) {
19081         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
19082         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
19083         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
19084         return tag_ptr(ret_conv, true);
19085 }
19086
19087 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint64_t a, uint64_t b, uint64_t c) {
19088         LDKChannelAnnouncement a_conv;
19089         a_conv.inner = untag_ptr(a);
19090         a_conv.is_owned = ptr_is_owned(a);
19091         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
19092         a_conv = ChannelAnnouncement_clone(&a_conv);
19093         LDKChannelUpdate b_conv;
19094         b_conv.inner = untag_ptr(b);
19095         b_conv.is_owned = ptr_is_owned(b);
19096         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
19097         b_conv = ChannelUpdate_clone(&b_conv);
19098         LDKChannelUpdate c_conv;
19099         c_conv.inner = untag_ptr(c);
19100         c_conv.is_owned = ptr_is_owned(c);
19101         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
19102         c_conv = ChannelUpdate_clone(&c_conv);
19103         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
19104         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
19105         return tag_ptr(ret_conv, true);
19106 }
19107
19108 void  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint64_t _res) {
19109         if (!ptr_is_owned(_res)) return;
19110         void* _res_ptr = untag_ptr(_res);
19111         CHECK_ACCESS(_res_ptr);
19112         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
19113         FREE(untag_ptr(_res));
19114         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
19115 }
19116
19117 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(uint64_t o) {
19118         void* o_ptr = untag_ptr(o);
19119         CHECK_ACCESS(o_ptr);
19120         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(o_ptr);
19121         o_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(o));
19122         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
19123         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o_conv);
19124         uint64_t ret_ref = tag_ptr(ret_copy, true);
19125         return ret_ref;
19126 }
19127
19128 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() {
19129         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
19130         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none();
19131         uint64_t ret_ref = tag_ptr(ret_copy, true);
19132         return ret_ref;
19133 }
19134
19135 void  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint64_t _res) {
19136         if (!ptr_is_owned(_res)) return;
19137         void* _res_ptr = untag_ptr(_res);
19138         CHECK_ACCESS(_res_ptr);
19139         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(_res_ptr);
19140         FREE(untag_ptr(_res));
19141         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_conv);
19142 }
19143
19144 static inline uint64_t COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR arg) {
19145         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
19146         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(arg);
19147         uint64_t ret_ref = tag_ptr(ret_copy, true);
19148         return ret_ref;
19149 }
19150 int64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(uint64_t arg) {
19151         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* arg_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(arg);
19152         int64_t ret_conv = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(arg_conv);
19153         return ret_conv;
19154 }
19155
19156 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(uint64_t orig) {
19157         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* orig_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(orig);
19158         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
19159         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig_conv);
19160         uint64_t ret_ref = tag_ptr(ret_copy, true);
19161         return ret_ref;
19162 }
19163
19164 void  __attribute__((export_name("TS_CVec_MessageSendEventZ_free"))) TS_CVec_MessageSendEventZ_free(uint64_tArray _res) {
19165         LDKCVec_MessageSendEventZ _res_constr;
19166         _res_constr.datalen = _res->arr_len;
19167         if (_res_constr.datalen > 0)
19168                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
19169         else
19170                 _res_constr.data = NULL;
19171         uint64_t* _res_vals = _res->elems;
19172         for (size_t s = 0; s < _res_constr.datalen; s++) {
19173                 uint64_t _res_conv_18 = _res_vals[s];
19174                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
19175                 CHECK_ACCESS(_res_conv_18_ptr);
19176                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
19177                 FREE(untag_ptr(_res_conv_18));
19178                 _res_constr.data[s] = _res_conv_18_conv;
19179         }
19180         FREE(_res);
19181         CVec_MessageSendEventZ_free(_res_constr);
19182 }
19183
19184 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok(uint64_t o) {
19185         LDKChannelUpdateInfo o_conv;
19186         o_conv.inner = untag_ptr(o);
19187         o_conv.is_owned = ptr_is_owned(o);
19188         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19189         o_conv = ChannelUpdateInfo_clone(&o_conv);
19190         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
19191         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
19192         return tag_ptr(ret_conv, true);
19193 }
19194
19195 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_err(uint64_t e) {
19196         void* e_ptr = untag_ptr(e);
19197         CHECK_ACCESS(e_ptr);
19198         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19199         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19200         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
19201         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
19202         return tag_ptr(ret_conv, true);
19203 }
19204
19205 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(uint64_t o) {
19206         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
19207         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
19208         return ret_conv;
19209 }
19210
19211 void  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_free"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_free(uint64_t _res) {
19212         if (!ptr_is_owned(_res)) return;
19213         void* _res_ptr = untag_ptr(_res);
19214         CHECK_ACCESS(_res_ptr);
19215         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
19216         FREE(untag_ptr(_res));
19217         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
19218 }
19219
19220 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
19221         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
19222         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
19223         return tag_ptr(ret_conv, true);
19224 }
19225 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
19226         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
19227         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
19228         return ret_conv;
19229 }
19230
19231 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone(uint64_t orig) {
19232         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
19233         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
19234         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
19235         return tag_ptr(ret_conv, true);
19236 }
19237
19238 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint64_t o) {
19239         LDKChannelInfo o_conv;
19240         o_conv.inner = untag_ptr(o);
19241         o_conv.is_owned = ptr_is_owned(o);
19242         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19243         o_conv = ChannelInfo_clone(&o_conv);
19244         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
19245         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
19246         return tag_ptr(ret_conv, true);
19247 }
19248
19249 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_err"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint64_t e) {
19250         void* e_ptr = untag_ptr(e);
19251         CHECK_ACCESS(e_ptr);
19252         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19253         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19254         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
19255         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
19256         return tag_ptr(ret_conv, true);
19257 }
19258
19259 jboolean  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_is_ok(uint64_t o) {
19260         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
19261         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
19262         return ret_conv;
19263 }
19264
19265 void  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_free"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint64_t _res) {
19266         if (!ptr_is_owned(_res)) return;
19267         void* _res_ptr = untag_ptr(_res);
19268         CHECK_ACCESS(_res_ptr);
19269         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
19270         FREE(untag_ptr(_res));
19271         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
19272 }
19273
19274 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
19275         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
19276         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
19277         return tag_ptr(ret_conv, true);
19278 }
19279 int64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
19280         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
19281         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
19282         return ret_conv;
19283 }
19284
19285 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint64_t orig) {
19286         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
19287         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
19288         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
19289         return tag_ptr(ret_conv, true);
19290 }
19291
19292 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint64_t o) {
19293         LDKRoutingFees o_conv;
19294         o_conv.inner = untag_ptr(o);
19295         o_conv.is_owned = ptr_is_owned(o);
19296         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19297         o_conv = RoutingFees_clone(&o_conv);
19298         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
19299         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
19300         return tag_ptr(ret_conv, true);
19301 }
19302
19303 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_err"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint64_t e) {
19304         void* e_ptr = untag_ptr(e);
19305         CHECK_ACCESS(e_ptr);
19306         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19307         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19308         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
19309         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
19310         return tag_ptr(ret_conv, true);
19311 }
19312
19313 jboolean  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_is_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_is_ok(uint64_t o) {
19314         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
19315         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
19316         return ret_conv;
19317 }
19318
19319 void  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_free"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint64_t _res) {
19320         if (!ptr_is_owned(_res)) return;
19321         void* _res_ptr = untag_ptr(_res);
19322         CHECK_ACCESS(_res_ptr);
19323         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
19324         FREE(untag_ptr(_res));
19325         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
19326 }
19327
19328 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
19329         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
19330         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
19331         return tag_ptr(ret_conv, true);
19332 }
19333 int64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr"))) TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr(uint64_t arg) {
19334         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
19335         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
19336         return ret_conv;
19337 }
19338
19339 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint64_t orig) {
19340         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
19341         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
19342         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
19343         return tag_ptr(ret_conv, true);
19344 }
19345
19346 void  __attribute__((export_name("TS_CVec_SocketAddressZ_free"))) TS_CVec_SocketAddressZ_free(uint64_tArray _res) {
19347         LDKCVec_SocketAddressZ _res_constr;
19348         _res_constr.datalen = _res->arr_len;
19349         if (_res_constr.datalen > 0)
19350                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
19351         else
19352                 _res_constr.data = NULL;
19353         uint64_t* _res_vals = _res->elems;
19354         for (size_t p = 0; p < _res_constr.datalen; p++) {
19355                 uint64_t _res_conv_15 = _res_vals[p];
19356                 void* _res_conv_15_ptr = untag_ptr(_res_conv_15);
19357                 CHECK_ACCESS(_res_conv_15_ptr);
19358                 LDKSocketAddress _res_conv_15_conv = *(LDKSocketAddress*)(_res_conv_15_ptr);
19359                 FREE(untag_ptr(_res_conv_15));
19360                 _res_constr.data[p] = _res_conv_15_conv;
19361         }
19362         FREE(_res);
19363         CVec_SocketAddressZ_free(_res_constr);
19364 }
19365
19366 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint64_t o) {
19367         LDKNodeAnnouncementInfo o_conv;
19368         o_conv.inner = untag_ptr(o);
19369         o_conv.is_owned = ptr_is_owned(o);
19370         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19371         o_conv = NodeAnnouncementInfo_clone(&o_conv);
19372         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
19373         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
19374         return tag_ptr(ret_conv, true);
19375 }
19376
19377 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint64_t e) {
19378         void* e_ptr = untag_ptr(e);
19379         CHECK_ACCESS(e_ptr);
19380         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19381         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19382         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
19383         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
19384         return tag_ptr(ret_conv, true);
19385 }
19386
19387 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(uint64_t o) {
19388         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
19389         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
19390         return ret_conv;
19391 }
19392
19393 void  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint64_t _res) {
19394         if (!ptr_is_owned(_res)) return;
19395         void* _res_ptr = untag_ptr(_res);
19396         CHECK_ACCESS(_res_ptr);
19397         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
19398         FREE(untag_ptr(_res));
19399         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
19400 }
19401
19402 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
19403         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
19404         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
19405         return tag_ptr(ret_conv, true);
19406 }
19407 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
19408         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
19409         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
19410         return ret_conv;
19411 }
19412
19413 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint64_t orig) {
19414         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
19415         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
19416         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
19417         return tag_ptr(ret_conv, true);
19418 }
19419
19420 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_ok"))) TS_CResult_NodeAliasDecodeErrorZ_ok(uint64_t o) {
19421         LDKNodeAlias o_conv;
19422         o_conv.inner = untag_ptr(o);
19423         o_conv.is_owned = ptr_is_owned(o);
19424         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19425         o_conv = NodeAlias_clone(&o_conv);
19426         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
19427         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
19428         return tag_ptr(ret_conv, true);
19429 }
19430
19431 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_err"))) TS_CResult_NodeAliasDecodeErrorZ_err(uint64_t e) {
19432         void* e_ptr = untag_ptr(e);
19433         CHECK_ACCESS(e_ptr);
19434         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19435         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19436         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
19437         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
19438         return tag_ptr(ret_conv, true);
19439 }
19440
19441 jboolean  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_is_ok"))) TS_CResult_NodeAliasDecodeErrorZ_is_ok(uint64_t o) {
19442         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
19443         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
19444         return ret_conv;
19445 }
19446
19447 void  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_free"))) TS_CResult_NodeAliasDecodeErrorZ_free(uint64_t _res) {
19448         if (!ptr_is_owned(_res)) return;
19449         void* _res_ptr = untag_ptr(_res);
19450         CHECK_ACCESS(_res_ptr);
19451         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
19452         FREE(untag_ptr(_res));
19453         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
19454 }
19455
19456 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
19457         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
19458         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
19459         return tag_ptr(ret_conv, true);
19460 }
19461 int64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAliasDecodeErrorZ_clone_ptr(uint64_t arg) {
19462         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
19463         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
19464         return ret_conv;
19465 }
19466
19467 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone"))) TS_CResult_NodeAliasDecodeErrorZ_clone(uint64_t orig) {
19468         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
19469         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
19470         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
19471         return tag_ptr(ret_conv, true);
19472 }
19473
19474 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_ok"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint64_t o) {
19475         LDKNodeInfo o_conv;
19476         o_conv.inner = untag_ptr(o);
19477         o_conv.is_owned = ptr_is_owned(o);
19478         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19479         o_conv = NodeInfo_clone(&o_conv);
19480         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
19481         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
19482         return tag_ptr(ret_conv, true);
19483 }
19484
19485 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_err"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint64_t e) {
19486         void* e_ptr = untag_ptr(e);
19487         CHECK_ACCESS(e_ptr);
19488         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19489         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19490         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
19491         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
19492         return tag_ptr(ret_conv, true);
19493 }
19494
19495 jboolean  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeInfoDecodeErrorZ_is_ok(uint64_t o) {
19496         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
19497         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
19498         return ret_conv;
19499 }
19500
19501 void  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_free"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint64_t _res) {
19502         if (!ptr_is_owned(_res)) return;
19503         void* _res_ptr = untag_ptr(_res);
19504         CHECK_ACCESS(_res_ptr);
19505         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
19506         FREE(untag_ptr(_res));
19507         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
19508 }
19509
19510 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
19511         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
19512         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
19513         return tag_ptr(ret_conv, true);
19514 }
19515 int64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
19516         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
19517         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
19518         return ret_conv;
19519 }
19520
19521 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint64_t orig) {
19522         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
19523         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
19524         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
19525         return tag_ptr(ret_conv, true);
19526 }
19527
19528 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint64_t o) {
19529         LDKNetworkGraph o_conv;
19530         o_conv.inner = untag_ptr(o);
19531         o_conv.is_owned = ptr_is_owned(o);
19532         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19533         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
19534         
19535         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
19536         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
19537         return tag_ptr(ret_conv, true);
19538 }
19539
19540 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_err"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint64_t e) {
19541         void* e_ptr = untag_ptr(e);
19542         CHECK_ACCESS(e_ptr);
19543         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19544         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19545         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
19546         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
19547         return tag_ptr(ret_conv, true);
19548 }
19549
19550 jboolean  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_is_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_is_ok(uint64_t o) {
19551         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
19552         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
19553         return ret_conv;
19554 }
19555
19556 void  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_free"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint64_t _res) {
19557         if (!ptr_is_owned(_res)) return;
19558         void* _res_ptr = untag_ptr(_res);
19559         CHECK_ACCESS(_res_ptr);
19560         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
19561         FREE(untag_ptr(_res));
19562         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
19563 }
19564
19565 uint64_t  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_some"))) TS_COption_CVec_SocketAddressZZ_some(uint64_tArray o) {
19566         LDKCVec_SocketAddressZ o_constr;
19567         o_constr.datalen = o->arr_len;
19568         if (o_constr.datalen > 0)
19569                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
19570         else
19571                 o_constr.data = NULL;
19572         uint64_t* o_vals = o->elems;
19573         for (size_t p = 0; p < o_constr.datalen; p++) {
19574                 uint64_t o_conv_15 = o_vals[p];
19575                 void* o_conv_15_ptr = untag_ptr(o_conv_15);
19576                 CHECK_ACCESS(o_conv_15_ptr);
19577                 LDKSocketAddress o_conv_15_conv = *(LDKSocketAddress*)(o_conv_15_ptr);
19578                 o_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o_conv_15));
19579                 o_constr.data[p] = o_conv_15_conv;
19580         }
19581         FREE(o);
19582         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
19583         *ret_copy = COption_CVec_SocketAddressZZ_some(o_constr);
19584         uint64_t ret_ref = tag_ptr(ret_copy, true);
19585         return ret_ref;
19586 }
19587
19588 uint64_t  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_none"))) TS_COption_CVec_SocketAddressZZ_none() {
19589         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
19590         *ret_copy = COption_CVec_SocketAddressZZ_none();
19591         uint64_t ret_ref = tag_ptr(ret_copy, true);
19592         return ret_ref;
19593 }
19594
19595 void  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_free"))) TS_COption_CVec_SocketAddressZZ_free(uint64_t _res) {
19596         if (!ptr_is_owned(_res)) return;
19597         void* _res_ptr = untag_ptr(_res);
19598         CHECK_ACCESS(_res_ptr);
19599         LDKCOption_CVec_SocketAddressZZ _res_conv = *(LDKCOption_CVec_SocketAddressZZ*)(_res_ptr);
19600         FREE(untag_ptr(_res));
19601         COption_CVec_SocketAddressZZ_free(_res_conv);
19602 }
19603
19604 static inline uint64_t COption_CVec_SocketAddressZZ_clone_ptr(LDKCOption_CVec_SocketAddressZZ *NONNULL_PTR arg) {
19605         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
19606         *ret_copy = COption_CVec_SocketAddressZZ_clone(arg);
19607         uint64_t ret_ref = tag_ptr(ret_copy, true);
19608         return ret_ref;
19609 }
19610 int64_t  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_clone_ptr"))) TS_COption_CVec_SocketAddressZZ_clone_ptr(uint64_t arg) {
19611         LDKCOption_CVec_SocketAddressZZ* arg_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(arg);
19612         int64_t ret_conv = COption_CVec_SocketAddressZZ_clone_ptr(arg_conv);
19613         return ret_conv;
19614 }
19615
19616 uint64_t  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_clone"))) TS_COption_CVec_SocketAddressZZ_clone(uint64_t orig) {
19617         LDKCOption_CVec_SocketAddressZZ* orig_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(orig);
19618         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
19619         *ret_copy = COption_CVec_SocketAddressZZ_clone(orig_conv);
19620         uint64_t ret_ref = tag_ptr(ret_copy, true);
19621         return ret_ref;
19622 }
19623
19624 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_ok"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_ok(uint64_t o) {
19625         LDKChannelDerivationParameters o_conv;
19626         o_conv.inner = untag_ptr(o);
19627         o_conv.is_owned = ptr_is_owned(o);
19628         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19629         o_conv = ChannelDerivationParameters_clone(&o_conv);
19630         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
19631         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_ok(o_conv);
19632         return tag_ptr(ret_conv, true);
19633 }
19634
19635 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_err"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_err(uint64_t e) {
19636         void* e_ptr = untag_ptr(e);
19637         CHECK_ACCESS(e_ptr);
19638         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19639         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19640         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
19641         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_err(e_conv);
19642         return tag_ptr(ret_conv, true);
19643 }
19644
19645 jboolean  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_is_ok"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(uint64_t o) {
19646         LDKCResult_ChannelDerivationParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(o);
19647         jboolean ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(o_conv);
19648         return ret_conv;
19649 }
19650
19651 void  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_free"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_free(uint64_t _res) {
19652         if (!ptr_is_owned(_res)) return;
19653         void* _res_ptr = untag_ptr(_res);
19654         CHECK_ACCESS(_res_ptr);
19655         LDKCResult_ChannelDerivationParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelDerivationParametersDecodeErrorZ*)(_res_ptr);
19656         FREE(untag_ptr(_res));
19657         CResult_ChannelDerivationParametersDecodeErrorZ_free(_res_conv);
19658 }
19659
19660 static inline uint64_t CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR arg) {
19661         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
19662         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(arg);
19663         return tag_ptr(ret_conv, true);
19664 }
19665 int64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
19666         LDKCResult_ChannelDerivationParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(arg);
19667         int64_t ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(arg_conv);
19668         return ret_conv;
19669 }
19670
19671 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_clone"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_clone(uint64_t orig) {
19672         LDKCResult_ChannelDerivationParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(orig);
19673         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
19674         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(orig_conv);
19675         return tag_ptr(ret_conv, true);
19676 }
19677
19678 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_ok"))) TS_CResult_HTLCDescriptorDecodeErrorZ_ok(uint64_t o) {
19679         LDKHTLCDescriptor o_conv;
19680         o_conv.inner = untag_ptr(o);
19681         o_conv.is_owned = ptr_is_owned(o);
19682         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19683         o_conv = HTLCDescriptor_clone(&o_conv);
19684         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
19685         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_ok(o_conv);
19686         return tag_ptr(ret_conv, true);
19687 }
19688
19689 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_err"))) TS_CResult_HTLCDescriptorDecodeErrorZ_err(uint64_t e) {
19690         void* e_ptr = untag_ptr(e);
19691         CHECK_ACCESS(e_ptr);
19692         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19693         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19694         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
19695         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_err(e_conv);
19696         return tag_ptr(ret_conv, true);
19697 }
19698
19699 jboolean  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_is_ok"))) TS_CResult_HTLCDescriptorDecodeErrorZ_is_ok(uint64_t o) {
19700         LDKCResult_HTLCDescriptorDecodeErrorZ* o_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(o);
19701         jboolean ret_conv = CResult_HTLCDescriptorDecodeErrorZ_is_ok(o_conv);
19702         return ret_conv;
19703 }
19704
19705 void  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_free"))) TS_CResult_HTLCDescriptorDecodeErrorZ_free(uint64_t _res) {
19706         if (!ptr_is_owned(_res)) return;
19707         void* _res_ptr = untag_ptr(_res);
19708         CHECK_ACCESS(_res_ptr);
19709         LDKCResult_HTLCDescriptorDecodeErrorZ _res_conv = *(LDKCResult_HTLCDescriptorDecodeErrorZ*)(_res_ptr);
19710         FREE(untag_ptr(_res));
19711         CResult_HTLCDescriptorDecodeErrorZ_free(_res_conv);
19712 }
19713
19714 static inline uint64_t CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR arg) {
19715         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
19716         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(arg);
19717         return tag_ptr(ret_conv, true);
19718 }
19719 int64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
19720         LDKCResult_HTLCDescriptorDecodeErrorZ* arg_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(arg);
19721         int64_t ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(arg_conv);
19722         return ret_conv;
19723 }
19724
19725 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_clone"))) TS_CResult_HTLCDescriptorDecodeErrorZ_clone(uint64_t orig) {
19726         LDKCResult_HTLCDescriptorDecodeErrorZ* orig_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(orig);
19727         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
19728         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(orig_conv);
19729         return tag_ptr(ret_conv, true);
19730 }
19731
19732 void  __attribute__((export_name("TS_CVec_HTLCOutputInCommitmentZ_free"))) TS_CVec_HTLCOutputInCommitmentZ_free(uint64_tArray _res) {
19733         LDKCVec_HTLCOutputInCommitmentZ _res_constr;
19734         _res_constr.datalen = _res->arr_len;
19735         if (_res_constr.datalen > 0)
19736                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
19737         else
19738                 _res_constr.data = NULL;
19739         uint64_t* _res_vals = _res->elems;
19740         for (size_t y = 0; y < _res_constr.datalen; y++) {
19741                 uint64_t _res_conv_24 = _res_vals[y];
19742                 LDKHTLCOutputInCommitment _res_conv_24_conv;
19743                 _res_conv_24_conv.inner = untag_ptr(_res_conv_24);
19744                 _res_conv_24_conv.is_owned = ptr_is_owned(_res_conv_24);
19745                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_24_conv);
19746                 _res_constr.data[y] = _res_conv_24_conv;
19747         }
19748         FREE(_res);
19749         CVec_HTLCOutputInCommitmentZ_free(_res_constr);
19750 }
19751
19752 void  __attribute__((export_name("TS_CVec_HTLCDescriptorZ_free"))) TS_CVec_HTLCDescriptorZ_free(uint64_tArray _res) {
19753         LDKCVec_HTLCDescriptorZ _res_constr;
19754         _res_constr.datalen = _res->arr_len;
19755         if (_res_constr.datalen > 0)
19756                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
19757         else
19758                 _res_constr.data = NULL;
19759         uint64_t* _res_vals = _res->elems;
19760         for (size_t q = 0; q < _res_constr.datalen; q++) {
19761                 uint64_t _res_conv_16 = _res_vals[q];
19762                 LDKHTLCDescriptor _res_conv_16_conv;
19763                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
19764                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
19765                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
19766                 _res_constr.data[q] = _res_conv_16_conv;
19767         }
19768         FREE(_res);
19769         CVec_HTLCDescriptorZ_free(_res_constr);
19770 }
19771
19772 void  __attribute__((export_name("TS_CVec_UtxoZ_free"))) TS_CVec_UtxoZ_free(uint64_tArray _res) {
19773         LDKCVec_UtxoZ _res_constr;
19774         _res_constr.datalen = _res->arr_len;
19775         if (_res_constr.datalen > 0)
19776                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
19777         else
19778                 _res_constr.data = NULL;
19779         uint64_t* _res_vals = _res->elems;
19780         for (size_t g = 0; g < _res_constr.datalen; g++) {
19781                 uint64_t _res_conv_6 = _res_vals[g];
19782                 LDKUtxo _res_conv_6_conv;
19783                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
19784                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
19785                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
19786                 _res_constr.data[g] = _res_conv_6_conv;
19787         }
19788         FREE(_res);
19789         CVec_UtxoZ_free(_res_constr);
19790 }
19791
19792 uint64_t  __attribute__((export_name("TS_COption_TxOutZ_some"))) TS_COption_TxOutZ_some(uint64_t o) {
19793         void* o_ptr = untag_ptr(o);
19794         CHECK_ACCESS(o_ptr);
19795         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
19796         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
19797         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
19798         *ret_copy = COption_TxOutZ_some(o_conv);
19799         uint64_t ret_ref = tag_ptr(ret_copy, true);
19800         return ret_ref;
19801 }
19802
19803 uint64_t  __attribute__((export_name("TS_COption_TxOutZ_none"))) TS_COption_TxOutZ_none() {
19804         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
19805         *ret_copy = COption_TxOutZ_none();
19806         uint64_t ret_ref = tag_ptr(ret_copy, true);
19807         return ret_ref;
19808 }
19809
19810 void  __attribute__((export_name("TS_COption_TxOutZ_free"))) TS_COption_TxOutZ_free(uint64_t _res) {
19811         if (!ptr_is_owned(_res)) return;
19812         void* _res_ptr = untag_ptr(_res);
19813         CHECK_ACCESS(_res_ptr);
19814         LDKCOption_TxOutZ _res_conv = *(LDKCOption_TxOutZ*)(_res_ptr);
19815         FREE(untag_ptr(_res));
19816         COption_TxOutZ_free(_res_conv);
19817 }
19818
19819 static inline uint64_t COption_TxOutZ_clone_ptr(LDKCOption_TxOutZ *NONNULL_PTR arg) {
19820         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
19821         *ret_copy = COption_TxOutZ_clone(arg);
19822         uint64_t ret_ref = tag_ptr(ret_copy, true);
19823         return ret_ref;
19824 }
19825 int64_t  __attribute__((export_name("TS_COption_TxOutZ_clone_ptr"))) TS_COption_TxOutZ_clone_ptr(uint64_t arg) {
19826         LDKCOption_TxOutZ* arg_conv = (LDKCOption_TxOutZ*)untag_ptr(arg);
19827         int64_t ret_conv = COption_TxOutZ_clone_ptr(arg_conv);
19828         return ret_conv;
19829 }
19830
19831 uint64_t  __attribute__((export_name("TS_COption_TxOutZ_clone"))) TS_COption_TxOutZ_clone(uint64_t orig) {
19832         LDKCOption_TxOutZ* orig_conv = (LDKCOption_TxOutZ*)untag_ptr(orig);
19833         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
19834         *ret_copy = COption_TxOutZ_clone(orig_conv);
19835         uint64_t ret_ref = tag_ptr(ret_copy, true);
19836         return ret_ref;
19837 }
19838
19839 void  __attribute__((export_name("TS_CVec_InputZ_free"))) TS_CVec_InputZ_free(uint64_tArray _res) {
19840         LDKCVec_InputZ _res_constr;
19841         _res_constr.datalen = _res->arr_len;
19842         if (_res_constr.datalen > 0)
19843                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
19844         else
19845                 _res_constr.data = NULL;
19846         uint64_t* _res_vals = _res->elems;
19847         for (size_t h = 0; h < _res_constr.datalen; h++) {
19848                 uint64_t _res_conv_7 = _res_vals[h];
19849                 LDKInput _res_conv_7_conv;
19850                 _res_conv_7_conv.inner = untag_ptr(_res_conv_7);
19851                 _res_conv_7_conv.is_owned = ptr_is_owned(_res_conv_7);
19852                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_7_conv);
19853                 _res_constr.data[h] = _res_conv_7_conv;
19854         }
19855         FREE(_res);
19856         CVec_InputZ_free(_res_constr);
19857 }
19858
19859 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_ok"))) TS_CResult_CoinSelectionNoneZ_ok(uint64_t o) {
19860         LDKCoinSelection o_conv;
19861         o_conv.inner = untag_ptr(o);
19862         o_conv.is_owned = ptr_is_owned(o);
19863         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19864         o_conv = CoinSelection_clone(&o_conv);
19865         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
19866         *ret_conv = CResult_CoinSelectionNoneZ_ok(o_conv);
19867         return tag_ptr(ret_conv, true);
19868 }
19869
19870 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_err"))) TS_CResult_CoinSelectionNoneZ_err() {
19871         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
19872         *ret_conv = CResult_CoinSelectionNoneZ_err();
19873         return tag_ptr(ret_conv, true);
19874 }
19875
19876 jboolean  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_is_ok"))) TS_CResult_CoinSelectionNoneZ_is_ok(uint64_t o) {
19877         LDKCResult_CoinSelectionNoneZ* o_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(o);
19878         jboolean ret_conv = CResult_CoinSelectionNoneZ_is_ok(o_conv);
19879         return ret_conv;
19880 }
19881
19882 void  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_free"))) TS_CResult_CoinSelectionNoneZ_free(uint64_t _res) {
19883         if (!ptr_is_owned(_res)) return;
19884         void* _res_ptr = untag_ptr(_res);
19885         CHECK_ACCESS(_res_ptr);
19886         LDKCResult_CoinSelectionNoneZ _res_conv = *(LDKCResult_CoinSelectionNoneZ*)(_res_ptr);
19887         FREE(untag_ptr(_res));
19888         CResult_CoinSelectionNoneZ_free(_res_conv);
19889 }
19890
19891 static inline uint64_t CResult_CoinSelectionNoneZ_clone_ptr(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR arg) {
19892         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
19893         *ret_conv = CResult_CoinSelectionNoneZ_clone(arg);
19894         return tag_ptr(ret_conv, true);
19895 }
19896 int64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_clone_ptr"))) TS_CResult_CoinSelectionNoneZ_clone_ptr(uint64_t arg) {
19897         LDKCResult_CoinSelectionNoneZ* arg_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(arg);
19898         int64_t ret_conv = CResult_CoinSelectionNoneZ_clone_ptr(arg_conv);
19899         return ret_conv;
19900 }
19901
19902 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_clone"))) TS_CResult_CoinSelectionNoneZ_clone(uint64_t orig) {
19903         LDKCResult_CoinSelectionNoneZ* orig_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(orig);
19904         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
19905         *ret_conv = CResult_CoinSelectionNoneZ_clone(orig_conv);
19906         return tag_ptr(ret_conv, true);
19907 }
19908
19909 uint64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_ok"))) TS_CResult_CVec_UtxoZNoneZ_ok(uint64_tArray o) {
19910         LDKCVec_UtxoZ o_constr;
19911         o_constr.datalen = o->arr_len;
19912         if (o_constr.datalen > 0)
19913                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
19914         else
19915                 o_constr.data = NULL;
19916         uint64_t* o_vals = o->elems;
19917         for (size_t g = 0; g < o_constr.datalen; g++) {
19918                 uint64_t o_conv_6 = o_vals[g];
19919                 LDKUtxo o_conv_6_conv;
19920                 o_conv_6_conv.inner = untag_ptr(o_conv_6);
19921                 o_conv_6_conv.is_owned = ptr_is_owned(o_conv_6);
19922                 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv_6_conv);
19923                 o_conv_6_conv = Utxo_clone(&o_conv_6_conv);
19924                 o_constr.data[g] = o_conv_6_conv;
19925         }
19926         FREE(o);
19927         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
19928         *ret_conv = CResult_CVec_UtxoZNoneZ_ok(o_constr);
19929         return tag_ptr(ret_conv, true);
19930 }
19931
19932 uint64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_err"))) TS_CResult_CVec_UtxoZNoneZ_err() {
19933         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
19934         *ret_conv = CResult_CVec_UtxoZNoneZ_err();
19935         return tag_ptr(ret_conv, true);
19936 }
19937
19938 jboolean  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_is_ok"))) TS_CResult_CVec_UtxoZNoneZ_is_ok(uint64_t o) {
19939         LDKCResult_CVec_UtxoZNoneZ* o_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(o);
19940         jboolean ret_conv = CResult_CVec_UtxoZNoneZ_is_ok(o_conv);
19941         return ret_conv;
19942 }
19943
19944 void  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_free"))) TS_CResult_CVec_UtxoZNoneZ_free(uint64_t _res) {
19945         if (!ptr_is_owned(_res)) return;
19946         void* _res_ptr = untag_ptr(_res);
19947         CHECK_ACCESS(_res_ptr);
19948         LDKCResult_CVec_UtxoZNoneZ _res_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(_res_ptr);
19949         FREE(untag_ptr(_res));
19950         CResult_CVec_UtxoZNoneZ_free(_res_conv);
19951 }
19952
19953 static inline uint64_t CResult_CVec_UtxoZNoneZ_clone_ptr(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR arg) {
19954         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
19955         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(arg);
19956         return tag_ptr(ret_conv, true);
19957 }
19958 int64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_clone_ptr"))) TS_CResult_CVec_UtxoZNoneZ_clone_ptr(uint64_t arg) {
19959         LDKCResult_CVec_UtxoZNoneZ* arg_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(arg);
19960         int64_t ret_conv = CResult_CVec_UtxoZNoneZ_clone_ptr(arg_conv);
19961         return ret_conv;
19962 }
19963
19964 uint64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_clone"))) TS_CResult_CVec_UtxoZNoneZ_clone(uint64_t orig) {
19965         LDKCResult_CVec_UtxoZNoneZ* orig_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(orig);
19966         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
19967         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(orig_conv);
19968         return tag_ptr(ret_conv, true);
19969 }
19970
19971 static inline uint64_t C2Tuple_u64u16Z_clone_ptr(LDKC2Tuple_u64u16Z *NONNULL_PTR arg) {
19972         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
19973         *ret_conv = C2Tuple_u64u16Z_clone(arg);
19974         return tag_ptr(ret_conv, true);
19975 }
19976 int64_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_clone_ptr"))) TS_C2Tuple_u64u16Z_clone_ptr(uint64_t arg) {
19977         LDKC2Tuple_u64u16Z* arg_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(arg);
19978         int64_t ret_conv = C2Tuple_u64u16Z_clone_ptr(arg_conv);
19979         return ret_conv;
19980 }
19981
19982 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_clone"))) TS_C2Tuple_u64u16Z_clone(uint64_t orig) {
19983         LDKC2Tuple_u64u16Z* orig_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(orig);
19984         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
19985         *ret_conv = C2Tuple_u64u16Z_clone(orig_conv);
19986         return tag_ptr(ret_conv, true);
19987 }
19988
19989 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_new"))) TS_C2Tuple_u64u16Z_new(int64_t a, int16_t b) {
19990         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
19991         *ret_conv = C2Tuple_u64u16Z_new(a, b);
19992         return tag_ptr(ret_conv, true);
19993 }
19994
19995 void  __attribute__((export_name("TS_C2Tuple_u64u16Z_free"))) TS_C2Tuple_u64u16Z_free(uint64_t _res) {
19996         if (!ptr_is_owned(_res)) return;
19997         void* _res_ptr = untag_ptr(_res);
19998         CHECK_ACCESS(_res_ptr);
19999         LDKC2Tuple_u64u16Z _res_conv = *(LDKC2Tuple_u64u16Z*)(_res_ptr);
20000         FREE(untag_ptr(_res));
20001         C2Tuple_u64u16Z_free(_res_conv);
20002 }
20003
20004 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_some"))) TS_COption_C2Tuple_u64u16ZZ_some(uint64_t o) {
20005         void* o_ptr = untag_ptr(o);
20006         CHECK_ACCESS(o_ptr);
20007         LDKC2Tuple_u64u16Z o_conv = *(LDKC2Tuple_u64u16Z*)(o_ptr);
20008         o_conv = C2Tuple_u64u16Z_clone((LDKC2Tuple_u64u16Z*)untag_ptr(o));
20009         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
20010         *ret_copy = COption_C2Tuple_u64u16ZZ_some(o_conv);
20011         uint64_t ret_ref = tag_ptr(ret_copy, true);
20012         return ret_ref;
20013 }
20014
20015 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_none"))) TS_COption_C2Tuple_u64u16ZZ_none() {
20016         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
20017         *ret_copy = COption_C2Tuple_u64u16ZZ_none();
20018         uint64_t ret_ref = tag_ptr(ret_copy, true);
20019         return ret_ref;
20020 }
20021
20022 void  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_free"))) TS_COption_C2Tuple_u64u16ZZ_free(uint64_t _res) {
20023         if (!ptr_is_owned(_res)) return;
20024         void* _res_ptr = untag_ptr(_res);
20025         CHECK_ACCESS(_res_ptr);
20026         LDKCOption_C2Tuple_u64u16ZZ _res_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(_res_ptr);
20027         FREE(untag_ptr(_res));
20028         COption_C2Tuple_u64u16ZZ_free(_res_conv);
20029 }
20030
20031 static inline uint64_t COption_C2Tuple_u64u16ZZ_clone_ptr(LDKCOption_C2Tuple_u64u16ZZ *NONNULL_PTR arg) {
20032         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
20033         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(arg);
20034         uint64_t ret_ref = tag_ptr(ret_copy, true);
20035         return ret_ref;
20036 }
20037 int64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_clone_ptr"))) TS_COption_C2Tuple_u64u16ZZ_clone_ptr(uint64_t arg) {
20038         LDKCOption_C2Tuple_u64u16ZZ* arg_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(arg);
20039         int64_t ret_conv = COption_C2Tuple_u64u16ZZ_clone_ptr(arg_conv);
20040         return ret_conv;
20041 }
20042
20043 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_clone"))) TS_COption_C2Tuple_u64u16ZZ_clone(uint64_t orig) {
20044         LDKCOption_C2Tuple_u64u16ZZ* orig_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(orig);
20045         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
20046         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(orig_conv);
20047         uint64_t ret_ref = tag_ptr(ret_copy, true);
20048         return ret_ref;
20049 }
20050
20051 uint64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_some"))) TS_COption_ChannelShutdownStateZ_some(uint32_t o) {
20052         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_js(o);
20053         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
20054         *ret_copy = COption_ChannelShutdownStateZ_some(o_conv);
20055         uint64_t ret_ref = tag_ptr(ret_copy, true);
20056         return ret_ref;
20057 }
20058
20059 uint64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_none"))) TS_COption_ChannelShutdownStateZ_none() {
20060         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
20061         *ret_copy = COption_ChannelShutdownStateZ_none();
20062         uint64_t ret_ref = tag_ptr(ret_copy, true);
20063         return ret_ref;
20064 }
20065
20066 void  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_free"))) TS_COption_ChannelShutdownStateZ_free(uint64_t _res) {
20067         if (!ptr_is_owned(_res)) return;
20068         void* _res_ptr = untag_ptr(_res);
20069         CHECK_ACCESS(_res_ptr);
20070         LDKCOption_ChannelShutdownStateZ _res_conv = *(LDKCOption_ChannelShutdownStateZ*)(_res_ptr);
20071         FREE(untag_ptr(_res));
20072         COption_ChannelShutdownStateZ_free(_res_conv);
20073 }
20074
20075 static inline uint64_t COption_ChannelShutdownStateZ_clone_ptr(LDKCOption_ChannelShutdownStateZ *NONNULL_PTR arg) {
20076         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
20077         *ret_copy = COption_ChannelShutdownStateZ_clone(arg);
20078         uint64_t ret_ref = tag_ptr(ret_copy, true);
20079         return ret_ref;
20080 }
20081 int64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_clone_ptr"))) TS_COption_ChannelShutdownStateZ_clone_ptr(uint64_t arg) {
20082         LDKCOption_ChannelShutdownStateZ* arg_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(arg);
20083         int64_t ret_conv = COption_ChannelShutdownStateZ_clone_ptr(arg_conv);
20084         return ret_conv;
20085 }
20086
20087 uint64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_clone"))) TS_COption_ChannelShutdownStateZ_clone(uint64_t orig) {
20088         LDKCOption_ChannelShutdownStateZ* orig_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(orig);
20089         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
20090         *ret_copy = COption_ChannelShutdownStateZ_clone(orig_conv);
20091         uint64_t ret_ref = tag_ptr(ret_copy, true);
20092         return ret_ref;
20093 }
20094
20095 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_ok"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_ok(int8_tArray o) {
20096         LDKThirtyTwoBytes o_ref;
20097         CHECK(o->arr_len == 32);
20098         memcpy(o_ref.data, o->elems, 32); FREE(o);
20099         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
20100         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_ok(o_ref);
20101         return tag_ptr(ret_conv, true);
20102 }
20103
20104 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_err"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_err(uint64_t e) {
20105         void* e_ptr = untag_ptr(e);
20106         CHECK_ACCESS(e_ptr);
20107         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
20108         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
20109         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
20110         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_err(e_conv);
20111         return tag_ptr(ret_conv, true);
20112 }
20113
20114 jboolean  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_is_ok"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_is_ok(uint64_t o) {
20115         LDKCResult_ThirtyTwoBytesAPIErrorZ* o_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(o);
20116         jboolean ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_is_ok(o_conv);
20117         return ret_conv;
20118 }
20119
20120 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_free"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_free(uint64_t _res) {
20121         if (!ptr_is_owned(_res)) return;
20122         void* _res_ptr = untag_ptr(_res);
20123         CHECK_ACCESS(_res_ptr);
20124         LDKCResult_ThirtyTwoBytesAPIErrorZ _res_conv = *(LDKCResult_ThirtyTwoBytesAPIErrorZ*)(_res_ptr);
20125         FREE(untag_ptr(_res));
20126         CResult_ThirtyTwoBytesAPIErrorZ_free(_res_conv);
20127 }
20128
20129 static inline uint64_t CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR arg) {
20130         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
20131         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(arg);
20132         return tag_ptr(ret_conv, true);
20133 }
20134 int64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(uint64_t arg) {
20135         LDKCResult_ThirtyTwoBytesAPIErrorZ* arg_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(arg);
20136         int64_t ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(arg_conv);
20137         return ret_conv;
20138 }
20139
20140 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_clone"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_clone(uint64_t orig) {
20141         LDKCResult_ThirtyTwoBytesAPIErrorZ* orig_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(orig);
20142         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
20143         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(orig_conv);
20144         return tag_ptr(ret_conv, true);
20145 }
20146
20147 void  __attribute__((export_name("TS_CVec_RecentPaymentDetailsZ_free"))) TS_CVec_RecentPaymentDetailsZ_free(uint64_tArray _res) {
20148         LDKCVec_RecentPaymentDetailsZ _res_constr;
20149         _res_constr.datalen = _res->arr_len;
20150         if (_res_constr.datalen > 0)
20151                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRecentPaymentDetails), "LDKCVec_RecentPaymentDetailsZ Elements");
20152         else
20153                 _res_constr.data = NULL;
20154         uint64_t* _res_vals = _res->elems;
20155         for (size_t w = 0; w < _res_constr.datalen; w++) {
20156                 uint64_t _res_conv_22 = _res_vals[w];
20157                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
20158                 CHECK_ACCESS(_res_conv_22_ptr);
20159                 LDKRecentPaymentDetails _res_conv_22_conv = *(LDKRecentPaymentDetails*)(_res_conv_22_ptr);
20160                 FREE(untag_ptr(_res_conv_22));
20161                 _res_constr.data[w] = _res_conv_22_conv;
20162         }
20163         FREE(_res);
20164         CVec_RecentPaymentDetailsZ_free(_res_constr);
20165 }
20166
20167 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_ok"))) TS_CResult_NonePaymentSendFailureZ_ok() {
20168         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
20169         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
20170         return tag_ptr(ret_conv, true);
20171 }
20172
20173 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_err"))) TS_CResult_NonePaymentSendFailureZ_err(uint64_t e) {
20174         void* e_ptr = untag_ptr(e);
20175         CHECK_ACCESS(e_ptr);
20176         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
20177         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
20178         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
20179         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
20180         return tag_ptr(ret_conv, true);
20181 }
20182
20183 jboolean  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_is_ok"))) TS_CResult_NonePaymentSendFailureZ_is_ok(uint64_t o) {
20184         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
20185         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
20186         return ret_conv;
20187 }
20188
20189 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_free"))) TS_CResult_NonePaymentSendFailureZ_free(uint64_t _res) {
20190         if (!ptr_is_owned(_res)) return;
20191         void* _res_ptr = untag_ptr(_res);
20192         CHECK_ACCESS(_res_ptr);
20193         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
20194         FREE(untag_ptr(_res));
20195         CResult_NonePaymentSendFailureZ_free(_res_conv);
20196 }
20197
20198 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
20199         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
20200         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
20201         return tag_ptr(ret_conv, true);
20202 }
20203 int64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone_ptr"))) TS_CResult_NonePaymentSendFailureZ_clone_ptr(uint64_t arg) {
20204         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
20205         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
20206         return ret_conv;
20207 }
20208
20209 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone"))) TS_CResult_NonePaymentSendFailureZ_clone(uint64_t orig) {
20210         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
20211         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
20212         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
20213         return tag_ptr(ret_conv, true);
20214 }
20215
20216 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_ok"))) TS_CResult_NoneRetryableSendFailureZ_ok() {
20217         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
20218         *ret_conv = CResult_NoneRetryableSendFailureZ_ok();
20219         return tag_ptr(ret_conv, true);
20220 }
20221
20222 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_err"))) TS_CResult_NoneRetryableSendFailureZ_err(uint32_t e) {
20223         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_js(e);
20224         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
20225         *ret_conv = CResult_NoneRetryableSendFailureZ_err(e_conv);
20226         return tag_ptr(ret_conv, true);
20227 }
20228
20229 jboolean  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_is_ok"))) TS_CResult_NoneRetryableSendFailureZ_is_ok(uint64_t o) {
20230         LDKCResult_NoneRetryableSendFailureZ* o_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(o);
20231         jboolean ret_conv = CResult_NoneRetryableSendFailureZ_is_ok(o_conv);
20232         return ret_conv;
20233 }
20234
20235 void  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_free"))) TS_CResult_NoneRetryableSendFailureZ_free(uint64_t _res) {
20236         if (!ptr_is_owned(_res)) return;
20237         void* _res_ptr = untag_ptr(_res);
20238         CHECK_ACCESS(_res_ptr);
20239         LDKCResult_NoneRetryableSendFailureZ _res_conv = *(LDKCResult_NoneRetryableSendFailureZ*)(_res_ptr);
20240         FREE(untag_ptr(_res));
20241         CResult_NoneRetryableSendFailureZ_free(_res_conv);
20242 }
20243
20244 static inline uint64_t CResult_NoneRetryableSendFailureZ_clone_ptr(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR arg) {
20245         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
20246         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(arg);
20247         return tag_ptr(ret_conv, true);
20248 }
20249 int64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_clone_ptr"))) TS_CResult_NoneRetryableSendFailureZ_clone_ptr(uint64_t arg) {
20250         LDKCResult_NoneRetryableSendFailureZ* arg_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(arg);
20251         int64_t ret_conv = CResult_NoneRetryableSendFailureZ_clone_ptr(arg_conv);
20252         return ret_conv;
20253 }
20254
20255 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_clone"))) TS_CResult_NoneRetryableSendFailureZ_clone(uint64_t orig) {
20256         LDKCResult_NoneRetryableSendFailureZ* orig_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(orig);
20257         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
20258         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(orig_conv);
20259         return tag_ptr(ret_conv, true);
20260 }
20261
20262 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_ok"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(int8_tArray o) {
20263         LDKThirtyTwoBytes o_ref;
20264         CHECK(o->arr_len == 32);
20265         memcpy(o_ref.data, o->elems, 32); FREE(o);
20266         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
20267         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(o_ref);
20268         return tag_ptr(ret_conv, true);
20269 }
20270
20271 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_err"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_err(uint64_t e) {
20272         void* e_ptr = untag_ptr(e);
20273         CHECK_ACCESS(e_ptr);
20274         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
20275         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
20276         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
20277         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_err(e_conv);
20278         return tag_ptr(ret_conv, true);
20279 }
20280
20281 jboolean  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(uint64_t o) {
20282         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(o);
20283         jboolean ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(o_conv);
20284         return ret_conv;
20285 }
20286
20287 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_free"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_free(uint64_t _res) {
20288         if (!ptr_is_owned(_res)) return;
20289         void* _res_ptr = untag_ptr(_res);
20290         CHECK_ACCESS(_res_ptr);
20291         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)(_res_ptr);
20292         FREE(untag_ptr(_res));
20293         CResult_ThirtyTwoBytesPaymentSendFailureZ_free(_res_conv);
20294 }
20295
20296 static inline uint64_t CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR arg) {
20297         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
20298         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(arg);
20299         return tag_ptr(ret_conv, true);
20300 }
20301 int64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(uint64_t arg) {
20302         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(arg);
20303         int64_t ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(arg_conv);
20304         return ret_conv;
20305 }
20306
20307 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(uint64_t orig) {
20308         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(orig);
20309         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
20310         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(orig_conv);
20311         return tag_ptr(ret_conv, true);
20312 }
20313
20314 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_ok"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(int8_tArray o) {
20315         LDKThirtyTwoBytes o_ref;
20316         CHECK(o->arr_len == 32);
20317         memcpy(o_ref.data, o->elems, 32); FREE(o);
20318         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
20319         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(o_ref);
20320         return tag_ptr(ret_conv, true);
20321 }
20322
20323 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_err"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_err(uint32_t e) {
20324         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_js(e);
20325         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
20326         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_err(e_conv);
20327         return tag_ptr(ret_conv, true);
20328 }
20329
20330 jboolean  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(uint64_t o) {
20331         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(o);
20332         jboolean ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(o_conv);
20333         return ret_conv;
20334 }
20335
20336 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_free"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_free(uint64_t _res) {
20337         if (!ptr_is_owned(_res)) return;
20338         void* _res_ptr = untag_ptr(_res);
20339         CHECK_ACCESS(_res_ptr);
20340         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)(_res_ptr);
20341         FREE(untag_ptr(_res));
20342         CResult_ThirtyTwoBytesRetryableSendFailureZ_free(_res_conv);
20343 }
20344
20345 static inline uint64_t CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR arg) {
20346         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
20347         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(arg);
20348         return tag_ptr(ret_conv, true);
20349 }
20350 int64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(uint64_t arg) {
20351         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(arg);
20352         int64_t ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(arg_conv);
20353         return ret_conv;
20354 }
20355
20356 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(uint64_t orig) {
20357         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(orig);
20358         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
20359         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(orig_conv);
20360         return tag_ptr(ret_conv, true);
20361 }
20362
20363 static inline uint64_t C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR arg) {
20364         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
20365         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(arg);
20366         return tag_ptr(ret_conv, true);
20367 }
20368 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(uint64_t arg) {
20369         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(arg);
20370         int64_t ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(arg_conv);
20371         return ret_conv;
20372 }
20373
20374 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(uint64_t orig) {
20375         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(orig);
20376         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
20377         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(orig_conv);
20378         return tag_ptr(ret_conv, true);
20379 }
20380
20381 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(int8_tArray a, int8_tArray b) {
20382         LDKThirtyTwoBytes a_ref;
20383         CHECK(a->arr_len == 32);
20384         memcpy(a_ref.data, a->elems, 32); FREE(a);
20385         LDKThirtyTwoBytes b_ref;
20386         CHECK(b->arr_len == 32);
20387         memcpy(b_ref.data, b->elems, 32); FREE(b);
20388         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
20389         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(a_ref, b_ref);
20390         return tag_ptr(ret_conv, true);
20391 }
20392
20393 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(uint64_t _res) {
20394         if (!ptr_is_owned(_res)) return;
20395         void* _res_ptr = untag_ptr(_res);
20396         CHECK_ACCESS(_res_ptr);
20397         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_ptr);
20398         FREE(untag_ptr(_res));
20399         C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(_res_conv);
20400 }
20401
20402 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(uint64_t o) {
20403         void* o_ptr = untag_ptr(o);
20404         CHECK_ACCESS(o_ptr);
20405         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
20406         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
20407         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
20408         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(o_conv);
20409         return tag_ptr(ret_conv, true);
20410 }
20411
20412 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(uint64_t e) {
20413         void* e_ptr = untag_ptr(e);
20414         CHECK_ACCESS(e_ptr);
20415         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
20416         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
20417         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
20418         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(e_conv);
20419         return tag_ptr(ret_conv, true);
20420 }
20421
20422 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(uint64_t o) {
20423         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(o);
20424         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(o_conv);
20425         return ret_conv;
20426 }
20427
20428 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(uint64_t _res) {
20429         if (!ptr_is_owned(_res)) return;
20430         void* _res_ptr = untag_ptr(_res);
20431         CHECK_ACCESS(_res_ptr);
20432         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)(_res_ptr);
20433         FREE(untag_ptr(_res));
20434         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(_res_conv);
20435 }
20436
20437 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR arg) {
20438         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
20439         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(arg);
20440         return tag_ptr(ret_conv, true);
20441 }
20442 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(uint64_t arg) {
20443         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(arg);
20444         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(arg_conv);
20445         return ret_conv;
20446 }
20447
20448 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(uint64_t orig) {
20449         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(orig);
20450         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
20451         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(orig_conv);
20452         return tag_ptr(ret_conv, true);
20453 }
20454
20455 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(uint64_tArray _res) {
20456         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ _res_constr;
20457         _res_constr.datalen = _res->arr_len;
20458         if (_res_constr.datalen > 0)
20459                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
20460         else
20461                 _res_constr.data = NULL;
20462         uint64_t* _res_vals = _res->elems;
20463         for (size_t o = 0; o < _res_constr.datalen; o++) {
20464                 uint64_t _res_conv_40 = _res_vals[o];
20465                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
20466                 CHECK_ACCESS(_res_conv_40_ptr);
20467                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_conv_40_ptr);
20468                 FREE(untag_ptr(_res_conv_40));
20469                 _res_constr.data[o] = _res_conv_40_conv;
20470         }
20471         FREE(_res);
20472         CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(_res_constr);
20473 }
20474
20475 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(uint64_tArray o) {
20476         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o_constr;
20477         o_constr.datalen = o->arr_len;
20478         if (o_constr.datalen > 0)
20479                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
20480         else
20481                 o_constr.data = NULL;
20482         uint64_t* o_vals = o->elems;
20483         for (size_t o = 0; o < o_constr.datalen; o++) {
20484                 uint64_t o_conv_40 = o_vals[o];
20485                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
20486                 CHECK_ACCESS(o_conv_40_ptr);
20487                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_conv_40_ptr);
20488                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o_conv_40));
20489                 o_constr.data[o] = o_conv_40_conv;
20490         }
20491         FREE(o);
20492         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
20493         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(o_constr);
20494         return tag_ptr(ret_conv, true);
20495 }
20496
20497 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(uint64_t e) {
20498         void* e_ptr = untag_ptr(e);
20499         CHECK_ACCESS(e_ptr);
20500         LDKProbeSendFailure e_conv = *(LDKProbeSendFailure*)(e_ptr);
20501         e_conv = ProbeSendFailure_clone((LDKProbeSendFailure*)untag_ptr(e));
20502         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
20503         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(e_conv);
20504         return tag_ptr(ret_conv, true);
20505 }
20506
20507 jboolean  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(uint64_t o) {
20508         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(o);
20509         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(o_conv);
20510         return ret_conv;
20511 }
20512
20513 void  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(uint64_t _res) {
20514         if (!ptr_is_owned(_res)) return;
20515         void* _res_ptr = untag_ptr(_res);
20516         CHECK_ACCESS(_res_ptr);
20517         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)(_res_ptr);
20518         FREE(untag_ptr(_res));
20519         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(_res_conv);
20520 }
20521
20522 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR arg) {
20523         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
20524         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(arg);
20525         return tag_ptr(ret_conv, true);
20526 }
20527 int64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(uint64_t arg) {
20528         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(arg);
20529         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(arg_conv);
20530         return ret_conv;
20531 }
20532
20533 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(uint64_t orig) {
20534         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(orig);
20535         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
20536         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(orig_conv);
20537         return tag_ptr(ret_conv, true);
20538 }
20539
20540 static inline uint64_t C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR arg) {
20541         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
20542         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(arg);
20543         return tag_ptr(ret_conv, true);
20544 }
20545 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr(uint64_t arg) {
20546         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(arg);
20547         int64_t ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr(arg_conv);
20548         return ret_conv;
20549 }
20550
20551 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_clone"))) TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(uint64_t orig) {
20552         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(orig);
20553         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
20554         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(orig_conv);
20555         return tag_ptr(ret_conv, true);
20556 }
20557
20558 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_new"))) TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_new(int8_tArray a, int8_tArray b) {
20559         LDKThirtyTwoBytes a_ref;
20560         CHECK(a->arr_len == 32);
20561         memcpy(a_ref.data, a->elems, 32); FREE(a);
20562         LDKPublicKey b_ref;
20563         CHECK(b->arr_len == 33);
20564         memcpy(b_ref.compressed_form, b->elems, 33); FREE(b);
20565         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
20566         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_new(a_ref, b_ref);
20567         return tag_ptr(ret_conv, true);
20568 }
20569
20570 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_free"))) TS_C2Tuple_ThirtyTwoBytesPublicKeyZ_free(uint64_t _res) {
20571         if (!ptr_is_owned(_res)) return;
20572         void* _res_ptr = untag_ptr(_res);
20573         CHECK_ACCESS(_res_ptr);
20574         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(_res_ptr);
20575         FREE(untag_ptr(_res));
20576         C2Tuple_ThirtyTwoBytesPublicKeyZ_free(_res_conv);
20577 }
20578
20579 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free(uint64_tArray _res) {
20580         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ _res_constr;
20581         _res_constr.datalen = _res->arr_len;
20582         if (_res_constr.datalen > 0)
20583                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ Elements");
20584         else
20585                 _res_constr.data = NULL;
20586         uint64_t* _res_vals = _res->elems;
20587         for (size_t j = 0; j < _res_constr.datalen; j++) {
20588                 uint64_t _res_conv_35 = _res_vals[j];
20589                 void* _res_conv_35_ptr = untag_ptr(_res_conv_35);
20590                 CHECK_ACCESS(_res_conv_35_ptr);
20591                 LDKC2Tuple_ThirtyTwoBytesPublicKeyZ _res_conv_35_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(_res_conv_35_ptr);
20592                 FREE(untag_ptr(_res_conv_35));
20593                 _res_constr.data[j] = _res_conv_35_conv;
20594         }
20595         FREE(_res);
20596         CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free(_res_constr);
20597 }
20598
20599 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(uint64_t o) {
20600         void* o_ptr = untag_ptr(o);
20601         CHECK_ACCESS(o_ptr);
20602         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
20603         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
20604         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
20605         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(o_conv);
20606         return tag_ptr(ret_conv, true);
20607 }
20608
20609 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err() {
20610         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
20611         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err();
20612         return tag_ptr(ret_conv, true);
20613 }
20614
20615 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(uint64_t o) {
20616         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(o);
20617         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(o_conv);
20618         return ret_conv;
20619 }
20620
20621 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(uint64_t _res) {
20622         if (!ptr_is_owned(_res)) return;
20623         void* _res_ptr = untag_ptr(_res);
20624         CHECK_ACCESS(_res_ptr);
20625         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)(_res_ptr);
20626         FREE(untag_ptr(_res));
20627         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(_res_conv);
20628 }
20629
20630 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR arg) {
20631         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
20632         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(arg);
20633         return tag_ptr(ret_conv, true);
20634 }
20635 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(uint64_t arg) {
20636         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(arg);
20637         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(arg_conv);
20638         return ret_conv;
20639 }
20640
20641 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(uint64_t orig) {
20642         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(orig);
20643         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
20644         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(orig_conv);
20645         return tag_ptr(ret_conv, true);
20646 }
20647
20648 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(uint64_t o) {
20649         LDKCounterpartyForwardingInfo o_conv;
20650         o_conv.inner = untag_ptr(o);
20651         o_conv.is_owned = ptr_is_owned(o);
20652         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20653         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
20654         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
20655         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
20656         return tag_ptr(ret_conv, true);
20657 }
20658
20659 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err(uint64_t e) {
20660         void* e_ptr = untag_ptr(e);
20661         CHECK_ACCESS(e_ptr);
20662         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20663         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20664         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
20665         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
20666         return tag_ptr(ret_conv, true);
20667 }
20668
20669 jboolean  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(uint64_t o) {
20670         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
20671         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
20672         return ret_conv;
20673 }
20674
20675 void  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free(uint64_t _res) {
20676         if (!ptr_is_owned(_res)) return;
20677         void* _res_ptr = untag_ptr(_res);
20678         CHECK_ACCESS(_res_ptr);
20679         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
20680         FREE(untag_ptr(_res));
20681         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
20682 }
20683
20684 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
20685         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
20686         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
20687         return tag_ptr(ret_conv, true);
20688 }
20689 int64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
20690         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
20691         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
20692         return ret_conv;
20693 }
20694
20695 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(uint64_t orig) {
20696         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
20697         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
20698         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
20699         return tag_ptr(ret_conv, true);
20700 }
20701
20702 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_ok(uint64_t o) {
20703         LDKChannelCounterparty o_conv;
20704         o_conv.inner = untag_ptr(o);
20705         o_conv.is_owned = ptr_is_owned(o);
20706         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20707         o_conv = ChannelCounterparty_clone(&o_conv);
20708         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
20709         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
20710         return tag_ptr(ret_conv, true);
20711 }
20712
20713 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_err(uint64_t e) {
20714         void* e_ptr = untag_ptr(e);
20715         CHECK_ACCESS(e_ptr);
20716         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20717         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20718         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
20719         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
20720         return tag_ptr(ret_conv, true);
20721 }
20722
20723 jboolean  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok(uint64_t o) {
20724         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
20725         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
20726         return ret_conv;
20727 }
20728
20729 void  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_free"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_free(uint64_t _res) {
20730         if (!ptr_is_owned(_res)) return;
20731         void* _res_ptr = untag_ptr(_res);
20732         CHECK_ACCESS(_res_ptr);
20733         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
20734         FREE(untag_ptr(_res));
20735         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
20736 }
20737
20738 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
20739         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
20740         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
20741         return tag_ptr(ret_conv, true);
20742 }
20743 int64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(uint64_t arg) {
20744         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
20745         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
20746         return ret_conv;
20747 }
20748
20749 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone(uint64_t orig) {
20750         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
20751         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
20752         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
20753         return tag_ptr(ret_conv, true);
20754 }
20755
20756 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_ok(uint64_t o) {
20757         LDKChannelDetails o_conv;
20758         o_conv.inner = untag_ptr(o);
20759         o_conv.is_owned = ptr_is_owned(o);
20760         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20761         o_conv = ChannelDetails_clone(&o_conv);
20762         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
20763         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
20764         return tag_ptr(ret_conv, true);
20765 }
20766
20767 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_err(uint64_t e) {
20768         void* e_ptr = untag_ptr(e);
20769         CHECK_ACCESS(e_ptr);
20770         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20771         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20772         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
20773         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
20774         return tag_ptr(ret_conv, true);
20775 }
20776
20777 jboolean  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_is_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_is_ok(uint64_t o) {
20778         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
20779         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
20780         return ret_conv;
20781 }
20782
20783 void  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_free"))) TS_CResult_ChannelDetailsDecodeErrorZ_free(uint64_t _res) {
20784         if (!ptr_is_owned(_res)) return;
20785         void* _res_ptr = untag_ptr(_res);
20786         CHECK_ACCESS(_res_ptr);
20787         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
20788         FREE(untag_ptr(_res));
20789         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
20790 }
20791
20792 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
20793         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
20794         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
20795         return tag_ptr(ret_conv, true);
20796 }
20797 int64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr(uint64_t arg) {
20798         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
20799         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
20800         return ret_conv;
20801 }
20802
20803 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone(uint64_t orig) {
20804         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
20805         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
20806         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
20807         return tag_ptr(ret_conv, true);
20808 }
20809
20810 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_ok(uint64_t o) {
20811         LDKPhantomRouteHints o_conv;
20812         o_conv.inner = untag_ptr(o);
20813         o_conv.is_owned = ptr_is_owned(o);
20814         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20815         o_conv = PhantomRouteHints_clone(&o_conv);
20816         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
20817         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
20818         return tag_ptr(ret_conv, true);
20819 }
20820
20821 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_err(uint64_t e) {
20822         void* e_ptr = untag_ptr(e);
20823         CHECK_ACCESS(e_ptr);
20824         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20825         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20826         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
20827         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
20828         return tag_ptr(ret_conv, true);
20829 }
20830
20831 jboolean  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok(uint64_t o) {
20832         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
20833         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
20834         return ret_conv;
20835 }
20836
20837 void  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_free"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_free(uint64_t _res) {
20838         if (!ptr_is_owned(_res)) return;
20839         void* _res_ptr = untag_ptr(_res);
20840         CHECK_ACCESS(_res_ptr);
20841         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
20842         FREE(untag_ptr(_res));
20843         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
20844 }
20845
20846 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
20847         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
20848         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
20849         return tag_ptr(ret_conv, true);
20850 }
20851 int64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(uint64_t arg) {
20852         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
20853         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
20854         return ret_conv;
20855 }
20856
20857 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone(uint64_t orig) {
20858         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
20859         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
20860         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
20861         return tag_ptr(ret_conv, true);
20862 }
20863
20864 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_ok"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_ok(uint32_t o) {
20865         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_js(o);
20866         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
20867         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_ok(o_conv);
20868         return tag_ptr(ret_conv, true);
20869 }
20870
20871 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_err"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_err(uint64_t e) {
20872         void* e_ptr = untag_ptr(e);
20873         CHECK_ACCESS(e_ptr);
20874         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20875         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20876         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
20877         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_err(e_conv);
20878         return tag_ptr(ret_conv, true);
20879 }
20880
20881 jboolean  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_is_ok"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_is_ok(uint64_t o) {
20882         LDKCResult_ChannelShutdownStateDecodeErrorZ* o_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(o);
20883         jboolean ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o_conv);
20884         return ret_conv;
20885 }
20886
20887 void  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_free"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_free(uint64_t _res) {
20888         if (!ptr_is_owned(_res)) return;
20889         void* _res_ptr = untag_ptr(_res);
20890         CHECK_ACCESS(_res_ptr);
20891         LDKCResult_ChannelShutdownStateDecodeErrorZ _res_conv = *(LDKCResult_ChannelShutdownStateDecodeErrorZ*)(_res_ptr);
20892         FREE(untag_ptr(_res));
20893         CResult_ChannelShutdownStateDecodeErrorZ_free(_res_conv);
20894 }
20895
20896 static inline uint64_t CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR arg) {
20897         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
20898         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(arg);
20899         return tag_ptr(ret_conv, true);
20900 }
20901 int64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(uint64_t arg) {
20902         LDKCResult_ChannelShutdownStateDecodeErrorZ* arg_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(arg);
20903         int64_t ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(arg_conv);
20904         return ret_conv;
20905 }
20906
20907 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_clone"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_clone(uint64_t orig) {
20908         LDKCResult_ChannelShutdownStateDecodeErrorZ* orig_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(orig);
20909         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
20910         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(orig_conv);
20911         return tag_ptr(ret_conv, true);
20912 }
20913
20914 void  __attribute__((export_name("TS_CVec_ChannelMonitorZ_free"))) TS_CVec_ChannelMonitorZ_free(uint64_tArray _res) {
20915         LDKCVec_ChannelMonitorZ _res_constr;
20916         _res_constr.datalen = _res->arr_len;
20917         if (_res_constr.datalen > 0)
20918                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
20919         else
20920                 _res_constr.data = NULL;
20921         uint64_t* _res_vals = _res->elems;
20922         for (size_t q = 0; q < _res_constr.datalen; q++) {
20923                 uint64_t _res_conv_16 = _res_vals[q];
20924                 LDKChannelMonitor _res_conv_16_conv;
20925                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
20926                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
20927                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
20928                 _res_constr.data[q] = _res_conv_16_conv;
20929         }
20930         FREE(_res);
20931         CVec_ChannelMonitorZ_free(_res_constr);
20932 }
20933
20934 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_new"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_new(int8_tArray a, uint64_t b) {
20935         LDKThirtyTwoBytes a_ref;
20936         CHECK(a->arr_len == 32);
20937         memcpy(a_ref.data, a->elems, 32); FREE(a);
20938         LDKChannelManager b_conv;
20939         b_conv.inner = untag_ptr(b);
20940         b_conv.is_owned = ptr_is_owned(b);
20941         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
20942         // WARNING: we need a move here but no clone is available for LDKChannelManager
20943         
20944         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ), "LDKC2Tuple_ThirtyTwoBytesChannelManagerZ");
20945         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_new(a_ref, b_conv);
20946         return tag_ptr(ret_conv, true);
20947 }
20948
20949 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_free"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_free(uint64_t _res) {
20950         if (!ptr_is_owned(_res)) return;
20951         void* _res_ptr = untag_ptr(_res);
20952         CHECK_ACCESS(_res_ptr);
20953         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(_res_ptr);
20954         FREE(untag_ptr(_res));
20955         C2Tuple_ThirtyTwoBytesChannelManagerZ_free(_res_conv);
20956 }
20957
20958 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(uint64_t o) {
20959         void* o_ptr = untag_ptr(o);
20960         CHECK_ACCESS(o_ptr);
20961         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(o_ptr);
20962         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_ThirtyTwoBytesChannelManagerZ
20963         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
20964         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(o_conv);
20965         return tag_ptr(ret_conv, true);
20966 }
20967
20968 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(uint64_t e) {
20969         void* e_ptr = untag_ptr(e);
20970         CHECK_ACCESS(e_ptr);
20971         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20972         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20973         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
20974         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(e_conv);
20975         return tag_ptr(ret_conv, true);
20976 }
20977
20978 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(uint64_t o) {
20979         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(o);
20980         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(o_conv);
20981         return ret_conv;
20982 }
20983
20984 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(uint64_t _res) {
20985         if (!ptr_is_owned(_res)) return;
20986         void* _res_ptr = untag_ptr(_res);
20987         CHECK_ACCESS(_res_ptr);
20988         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)(_res_ptr);
20989         FREE(untag_ptr(_res));
20990         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(_res_conv);
20991 }
20992
20993 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_ok"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_ok(uint64_t o) {
20994         void* o_ptr = untag_ptr(o);
20995         CHECK_ACCESS(o_ptr);
20996         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
20997         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
20998         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
20999         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o_conv);
21000         return tag_ptr(ret_conv, true);
21001 }
21002
21003 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_err"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_err(uint64_t e) {
21004         void* e_ptr = untag_ptr(e);
21005         CHECK_ACCESS(e_ptr);
21006         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21007         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21008         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
21009         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_err(e_conv);
21010         return tag_ptr(ret_conv, true);
21011 }
21012
21013 jboolean  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(uint64_t o) {
21014         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* o_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(o);
21015         jboolean ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o_conv);
21016         return ret_conv;
21017 }
21018
21019 void  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_free"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_free(uint64_t _res) {
21020         if (!ptr_is_owned(_res)) return;
21021         void* _res_ptr = untag_ptr(_res);
21022         CHECK_ACCESS(_res_ptr);
21023         LDKCResult_MaxDustHTLCExposureDecodeErrorZ _res_conv = *(LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)(_res_ptr);
21024         FREE(untag_ptr(_res));
21025         CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res_conv);
21026 }
21027
21028 static inline uint64_t CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR arg) {
21029         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
21030         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(arg);
21031         return tag_ptr(ret_conv, true);
21032 }
21033 int64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(uint64_t arg) {
21034         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* arg_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(arg);
21035         int64_t ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(arg_conv);
21036         return ret_conv;
21037 }
21038
21039 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone(uint64_t orig) {
21040         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* orig_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(orig);
21041         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
21042         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig_conv);
21043         return tag_ptr(ret_conv, true);
21044 }
21045
21046 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint64_t o) {
21047         LDKChannelConfig o_conv;
21048         o_conv.inner = untag_ptr(o);
21049         o_conv.is_owned = ptr_is_owned(o);
21050         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21051         o_conv = ChannelConfig_clone(&o_conv);
21052         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
21053         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
21054         return tag_ptr(ret_conv, true);
21055 }
21056
21057 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_err"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint64_t e) {
21058         void* e_ptr = untag_ptr(e);
21059         CHECK_ACCESS(e_ptr);
21060         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21061         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21062         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
21063         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
21064         return tag_ptr(ret_conv, true);
21065 }
21066
21067 jboolean  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_is_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_is_ok(uint64_t o) {
21068         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
21069         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
21070         return ret_conv;
21071 }
21072
21073 void  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_free"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint64_t _res) {
21074         if (!ptr_is_owned(_res)) return;
21075         void* _res_ptr = untag_ptr(_res);
21076         CHECK_ACCESS(_res_ptr);
21077         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
21078         FREE(untag_ptr(_res));
21079         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
21080 }
21081
21082 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
21083         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
21084         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
21085         return tag_ptr(ret_conv, true);
21086 }
21087 int64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr(uint64_t arg) {
21088         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
21089         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
21090         return ret_conv;
21091 }
21092
21093 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint64_t orig) {
21094         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
21095         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
21096         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
21097         return tag_ptr(ret_conv, true);
21098 }
21099
21100 uint64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_some"))) TS_COption_MaxDustHTLCExposureZ_some(uint64_t o) {
21101         void* o_ptr = untag_ptr(o);
21102         CHECK_ACCESS(o_ptr);
21103         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
21104         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
21105         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
21106         *ret_copy = COption_MaxDustHTLCExposureZ_some(o_conv);
21107         uint64_t ret_ref = tag_ptr(ret_copy, true);
21108         return ret_ref;
21109 }
21110
21111 uint64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_none"))) TS_COption_MaxDustHTLCExposureZ_none() {
21112         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
21113         *ret_copy = COption_MaxDustHTLCExposureZ_none();
21114         uint64_t ret_ref = tag_ptr(ret_copy, true);
21115         return ret_ref;
21116 }
21117
21118 void  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_free"))) TS_COption_MaxDustHTLCExposureZ_free(uint64_t _res) {
21119         if (!ptr_is_owned(_res)) return;
21120         void* _res_ptr = untag_ptr(_res);
21121         CHECK_ACCESS(_res_ptr);
21122         LDKCOption_MaxDustHTLCExposureZ _res_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(_res_ptr);
21123         FREE(untag_ptr(_res));
21124         COption_MaxDustHTLCExposureZ_free(_res_conv);
21125 }
21126
21127 static inline uint64_t COption_MaxDustHTLCExposureZ_clone_ptr(LDKCOption_MaxDustHTLCExposureZ *NONNULL_PTR arg) {
21128         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
21129         *ret_copy = COption_MaxDustHTLCExposureZ_clone(arg);
21130         uint64_t ret_ref = tag_ptr(ret_copy, true);
21131         return ret_ref;
21132 }
21133 int64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_clone_ptr"))) TS_COption_MaxDustHTLCExposureZ_clone_ptr(uint64_t arg) {
21134         LDKCOption_MaxDustHTLCExposureZ* arg_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(arg);
21135         int64_t ret_conv = COption_MaxDustHTLCExposureZ_clone_ptr(arg_conv);
21136         return ret_conv;
21137 }
21138
21139 uint64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_clone"))) TS_COption_MaxDustHTLCExposureZ_clone(uint64_t orig) {
21140         LDKCOption_MaxDustHTLCExposureZ* orig_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(orig);
21141         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
21142         *ret_copy = COption_MaxDustHTLCExposureZ_clone(orig_conv);
21143         uint64_t ret_ref = tag_ptr(ret_copy, true);
21144         return ret_ref;
21145 }
21146
21147 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_some"))) TS_COption_APIErrorZ_some(uint64_t o) {
21148         void* o_ptr = untag_ptr(o);
21149         CHECK_ACCESS(o_ptr);
21150         LDKAPIError o_conv = *(LDKAPIError*)(o_ptr);
21151         o_conv = APIError_clone((LDKAPIError*)untag_ptr(o));
21152         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
21153         *ret_copy = COption_APIErrorZ_some(o_conv);
21154         uint64_t ret_ref = tag_ptr(ret_copy, true);
21155         return ret_ref;
21156 }
21157
21158 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_none"))) TS_COption_APIErrorZ_none() {
21159         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
21160         *ret_copy = COption_APIErrorZ_none();
21161         uint64_t ret_ref = tag_ptr(ret_copy, true);
21162         return ret_ref;
21163 }
21164
21165 void  __attribute__((export_name("TS_COption_APIErrorZ_free"))) TS_COption_APIErrorZ_free(uint64_t _res) {
21166         if (!ptr_is_owned(_res)) return;
21167         void* _res_ptr = untag_ptr(_res);
21168         CHECK_ACCESS(_res_ptr);
21169         LDKCOption_APIErrorZ _res_conv = *(LDKCOption_APIErrorZ*)(_res_ptr);
21170         FREE(untag_ptr(_res));
21171         COption_APIErrorZ_free(_res_conv);
21172 }
21173
21174 static inline uint64_t COption_APIErrorZ_clone_ptr(LDKCOption_APIErrorZ *NONNULL_PTR arg) {
21175         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
21176         *ret_copy = COption_APIErrorZ_clone(arg);
21177         uint64_t ret_ref = tag_ptr(ret_copy, true);
21178         return ret_ref;
21179 }
21180 int64_t  __attribute__((export_name("TS_COption_APIErrorZ_clone_ptr"))) TS_COption_APIErrorZ_clone_ptr(uint64_t arg) {
21181         LDKCOption_APIErrorZ* arg_conv = (LDKCOption_APIErrorZ*)untag_ptr(arg);
21182         int64_t ret_conv = COption_APIErrorZ_clone_ptr(arg_conv);
21183         return ret_conv;
21184 }
21185
21186 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_clone"))) TS_COption_APIErrorZ_clone(uint64_t orig) {
21187         LDKCOption_APIErrorZ* orig_conv = (LDKCOption_APIErrorZ*)untag_ptr(orig);
21188         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
21189         *ret_copy = COption_APIErrorZ_clone(orig_conv);
21190         uint64_t ret_ref = tag_ptr(ret_copy, true);
21191         return ret_ref;
21192 }
21193
21194 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_ok(uint64_t o) {
21195         void* o_ptr = untag_ptr(o);
21196         CHECK_ACCESS(o_ptr);
21197         LDKCOption_APIErrorZ o_conv = *(LDKCOption_APIErrorZ*)(o_ptr);
21198         o_conv = COption_APIErrorZ_clone((LDKCOption_APIErrorZ*)untag_ptr(o));
21199         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
21200         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_ok(o_conv);
21201         return tag_ptr(ret_conv, true);
21202 }
21203
21204 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_err"))) TS_CResult_COption_APIErrorZDecodeErrorZ_err(uint64_t e) {
21205         void* e_ptr = untag_ptr(e);
21206         CHECK_ACCESS(e_ptr);
21207         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21208         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21209         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
21210         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_err(e_conv);
21211         return tag_ptr(ret_conv, true);
21212 }
21213
21214 jboolean  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_is_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_is_ok(uint64_t o) {
21215         LDKCResult_COption_APIErrorZDecodeErrorZ* o_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(o);
21216         jboolean ret_conv = CResult_COption_APIErrorZDecodeErrorZ_is_ok(o_conv);
21217         return ret_conv;
21218 }
21219
21220 void  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_free"))) TS_CResult_COption_APIErrorZDecodeErrorZ_free(uint64_t _res) {
21221         if (!ptr_is_owned(_res)) return;
21222         void* _res_ptr = untag_ptr(_res);
21223         CHECK_ACCESS(_res_ptr);
21224         LDKCResult_COption_APIErrorZDecodeErrorZ _res_conv = *(LDKCResult_COption_APIErrorZDecodeErrorZ*)(_res_ptr);
21225         FREE(untag_ptr(_res));
21226         CResult_COption_APIErrorZDecodeErrorZ_free(_res_conv);
21227 }
21228
21229 static inline uint64_t CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR arg) {
21230         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
21231         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(arg);
21232         return tag_ptr(ret_conv, true);
21233 }
21234 int64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(uint64_t arg) {
21235         LDKCResult_COption_APIErrorZDecodeErrorZ* arg_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(arg);
21236         int64_t ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(arg_conv);
21237         return ret_conv;
21238 }
21239
21240 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_clone"))) TS_CResult_COption_APIErrorZDecodeErrorZ_clone(uint64_t orig) {
21241         LDKCResult_COption_APIErrorZDecodeErrorZ* orig_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(orig);
21242         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
21243         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(orig_conv);
21244         return tag_ptr(ret_conv, true);
21245 }
21246
21247 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint64_t o) {
21248         LDKChannelMonitorUpdate o_conv;
21249         o_conv.inner = untag_ptr(o);
21250         o_conv.is_owned = ptr_is_owned(o);
21251         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21252         o_conv = ChannelMonitorUpdate_clone(&o_conv);
21253         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
21254         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
21255         return tag_ptr(ret_conv, true);
21256 }
21257
21258 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint64_t e) {
21259         void* e_ptr = untag_ptr(e);
21260         CHECK_ACCESS(e_ptr);
21261         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21262         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21263         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
21264         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
21265         return tag_ptr(ret_conv, true);
21266 }
21267
21268 jboolean  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(uint64_t o) {
21269         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
21270         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
21271         return ret_conv;
21272 }
21273
21274 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint64_t _res) {
21275         if (!ptr_is_owned(_res)) return;
21276         void* _res_ptr = untag_ptr(_res);
21277         CHECK_ACCESS(_res_ptr);
21278         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
21279         FREE(untag_ptr(_res));
21280         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
21281 }
21282
21283 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
21284         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
21285         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
21286         return tag_ptr(ret_conv, true);
21287 }
21288 int64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
21289         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
21290         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
21291         return ret_conv;
21292 }
21293
21294 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint64_t orig) {
21295         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
21296         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
21297         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
21298         return tag_ptr(ret_conv, true);
21299 }
21300
21301 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_some"))) TS_COption_MonitorEventZ_some(uint64_t o) {
21302         void* o_ptr = untag_ptr(o);
21303         CHECK_ACCESS(o_ptr);
21304         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
21305         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
21306         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
21307         *ret_copy = COption_MonitorEventZ_some(o_conv);
21308         uint64_t ret_ref = tag_ptr(ret_copy, true);
21309         return ret_ref;
21310 }
21311
21312 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_none"))) TS_COption_MonitorEventZ_none() {
21313         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
21314         *ret_copy = COption_MonitorEventZ_none();
21315         uint64_t ret_ref = tag_ptr(ret_copy, true);
21316         return ret_ref;
21317 }
21318
21319 void  __attribute__((export_name("TS_COption_MonitorEventZ_free"))) TS_COption_MonitorEventZ_free(uint64_t _res) {
21320         if (!ptr_is_owned(_res)) return;
21321         void* _res_ptr = untag_ptr(_res);
21322         CHECK_ACCESS(_res_ptr);
21323         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
21324         FREE(untag_ptr(_res));
21325         COption_MonitorEventZ_free(_res_conv);
21326 }
21327
21328 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
21329         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
21330         *ret_copy = COption_MonitorEventZ_clone(arg);
21331         uint64_t ret_ref = tag_ptr(ret_copy, true);
21332         return ret_ref;
21333 }
21334 int64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone_ptr"))) TS_COption_MonitorEventZ_clone_ptr(uint64_t arg) {
21335         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
21336         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
21337         return ret_conv;
21338 }
21339
21340 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone"))) TS_COption_MonitorEventZ_clone(uint64_t orig) {
21341         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
21342         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
21343         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
21344         uint64_t ret_ref = tag_ptr(ret_copy, true);
21345         return ret_ref;
21346 }
21347
21348 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_ok(uint64_t o) {
21349         void* o_ptr = untag_ptr(o);
21350         CHECK_ACCESS(o_ptr);
21351         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
21352         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
21353         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
21354         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
21355         return tag_ptr(ret_conv, true);
21356 }
21357
21358 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_err(uint64_t e) {
21359         void* e_ptr = untag_ptr(e);
21360         CHECK_ACCESS(e_ptr);
21361         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21362         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21363         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
21364         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
21365         return tag_ptr(ret_conv, true);
21366 }
21367
21368 jboolean  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(uint64_t o) {
21369         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
21370         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
21371         return ret_conv;
21372 }
21373
21374 void  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_free"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_free(uint64_t _res) {
21375         if (!ptr_is_owned(_res)) return;
21376         void* _res_ptr = untag_ptr(_res);
21377         CHECK_ACCESS(_res_ptr);
21378         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
21379         FREE(untag_ptr(_res));
21380         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
21381 }
21382
21383 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
21384         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
21385         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
21386         return tag_ptr(ret_conv, true);
21387 }
21388 int64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(uint64_t arg) {
21389         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
21390         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
21391         return ret_conv;
21392 }
21393
21394 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone(uint64_t orig) {
21395         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
21396         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
21397         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
21398         return tag_ptr(ret_conv, true);
21399 }
21400
21401 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint64_t o) {
21402         LDKHTLCUpdate o_conv;
21403         o_conv.inner = untag_ptr(o);
21404         o_conv.is_owned = ptr_is_owned(o);
21405         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21406         o_conv = HTLCUpdate_clone(&o_conv);
21407         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
21408         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
21409         return tag_ptr(ret_conv, true);
21410 }
21411
21412 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint64_t e) {
21413         void* e_ptr = untag_ptr(e);
21414         CHECK_ACCESS(e_ptr);
21415         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21416         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21417         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
21418         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
21419         return tag_ptr(ret_conv, true);
21420 }
21421
21422 jboolean  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_is_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_is_ok(uint64_t o) {
21423         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
21424         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
21425         return ret_conv;
21426 }
21427
21428 void  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_free"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint64_t _res) {
21429         if (!ptr_is_owned(_res)) return;
21430         void* _res_ptr = untag_ptr(_res);
21431         CHECK_ACCESS(_res_ptr);
21432         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
21433         FREE(untag_ptr(_res));
21434         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
21435 }
21436
21437 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
21438         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
21439         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
21440         return tag_ptr(ret_conv, true);
21441 }
21442 int64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
21443         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
21444         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
21445         return ret_conv;
21446 }
21447
21448 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint64_t orig) {
21449         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
21450         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
21451         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
21452         return tag_ptr(ret_conv, true);
21453 }
21454
21455 static inline uint64_t C2Tuple_OutPointCVec_u8ZZ_clone_ptr(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR arg) {
21456         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
21457         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(arg);
21458         return tag_ptr(ret_conv, true);
21459 }
21460 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_clone_ptr"))) TS_C2Tuple_OutPointCVec_u8ZZ_clone_ptr(uint64_t arg) {
21461         LDKC2Tuple_OutPointCVec_u8ZZ* arg_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(arg);
21462         int64_t ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone_ptr(arg_conv);
21463         return ret_conv;
21464 }
21465
21466 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_clone"))) TS_C2Tuple_OutPointCVec_u8ZZ_clone(uint64_t orig) {
21467         LDKC2Tuple_OutPointCVec_u8ZZ* orig_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(orig);
21468         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
21469         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(orig_conv);
21470         return tag_ptr(ret_conv, true);
21471 }
21472
21473 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_new"))) TS_C2Tuple_OutPointCVec_u8ZZ_new(uint64_t a, int8_tArray b) {
21474         LDKOutPoint a_conv;
21475         a_conv.inner = untag_ptr(a);
21476         a_conv.is_owned = ptr_is_owned(a);
21477         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
21478         a_conv = OutPoint_clone(&a_conv);
21479         LDKCVec_u8Z b_ref;
21480         b_ref.datalen = b->arr_len;
21481         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
21482         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
21483         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
21484         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_new(a_conv, b_ref);
21485         return tag_ptr(ret_conv, true);
21486 }
21487
21488 void  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_free"))) TS_C2Tuple_OutPointCVec_u8ZZ_free(uint64_t _res) {
21489         if (!ptr_is_owned(_res)) return;
21490         void* _res_ptr = untag_ptr(_res);
21491         CHECK_ACCESS(_res_ptr);
21492         LDKC2Tuple_OutPointCVec_u8ZZ _res_conv = *(LDKC2Tuple_OutPointCVec_u8ZZ*)(_res_ptr);
21493         FREE(untag_ptr(_res));
21494         C2Tuple_OutPointCVec_u8ZZ_free(_res_conv);
21495 }
21496
21497 static inline uint64_t C2Tuple_u32CVec_u8ZZ_clone_ptr(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR arg) {
21498         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
21499         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(arg);
21500         return tag_ptr(ret_conv, true);
21501 }
21502 int64_t  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_clone_ptr"))) TS_C2Tuple_u32CVec_u8ZZ_clone_ptr(uint64_t arg) {
21503         LDKC2Tuple_u32CVec_u8ZZ* arg_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(arg);
21504         int64_t ret_conv = C2Tuple_u32CVec_u8ZZ_clone_ptr(arg_conv);
21505         return ret_conv;
21506 }
21507
21508 uint64_t  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_clone"))) TS_C2Tuple_u32CVec_u8ZZ_clone(uint64_t orig) {
21509         LDKC2Tuple_u32CVec_u8ZZ* orig_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(orig);
21510         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
21511         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(orig_conv);
21512         return tag_ptr(ret_conv, true);
21513 }
21514
21515 uint64_t  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_new"))) TS_C2Tuple_u32CVec_u8ZZ_new(int32_t a, int8_tArray b) {
21516         LDKCVec_u8Z b_ref;
21517         b_ref.datalen = b->arr_len;
21518         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
21519         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
21520         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
21521         *ret_conv = C2Tuple_u32CVec_u8ZZ_new(a, b_ref);
21522         return tag_ptr(ret_conv, true);
21523 }
21524
21525 void  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_free"))) TS_C2Tuple_u32CVec_u8ZZ_free(uint64_t _res) {
21526         if (!ptr_is_owned(_res)) return;
21527         void* _res_ptr = untag_ptr(_res);
21528         CHECK_ACCESS(_res_ptr);
21529         LDKC2Tuple_u32CVec_u8ZZ _res_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_ptr);
21530         FREE(untag_ptr(_res));
21531         C2Tuple_u32CVec_u8ZZ_free(_res_conv);
21532 }
21533
21534 void  __attribute__((export_name("TS_CVec_C2Tuple_u32CVec_u8ZZZ_free"))) TS_CVec_C2Tuple_u32CVec_u8ZZZ_free(uint64_tArray _res) {
21535         LDKCVec_C2Tuple_u32CVec_u8ZZZ _res_constr;
21536         _res_constr.datalen = _res->arr_len;
21537         if (_res_constr.datalen > 0)
21538                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
21539         else
21540                 _res_constr.data = NULL;
21541         uint64_t* _res_vals = _res->elems;
21542         for (size_t x = 0; x < _res_constr.datalen; x++) {
21543                 uint64_t _res_conv_23 = _res_vals[x];
21544                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
21545                 CHECK_ACCESS(_res_conv_23_ptr);
21546                 LDKC2Tuple_u32CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_conv_23_ptr);
21547                 FREE(untag_ptr(_res_conv_23));
21548                 _res_constr.data[x] = _res_conv_23_conv;
21549         }
21550         FREE(_res);
21551         CVec_C2Tuple_u32CVec_u8ZZZ_free(_res_constr);
21552 }
21553
21554 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR arg) {
21555         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
21556         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(arg);
21557         return tag_ptr(ret_conv, true);
21558 }
21559 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(uint64_t arg) {
21560         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(arg);
21561         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(arg_conv);
21562         return ret_conv;
21563 }
21564
21565 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(uint64_t orig) {
21566         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(orig);
21567         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
21568         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(orig_conv);
21569         return tag_ptr(ret_conv, true);
21570 }
21571
21572 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) {
21573         LDKThirtyTwoBytes a_ref;
21574         CHECK(a->arr_len == 32);
21575         memcpy(a_ref.data, a->elems, 32); FREE(a);
21576         LDKCVec_C2Tuple_u32CVec_u8ZZZ b_constr;
21577         b_constr.datalen = b->arr_len;
21578         if (b_constr.datalen > 0)
21579                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
21580         else
21581                 b_constr.data = NULL;
21582         uint64_t* b_vals = b->elems;
21583         for (size_t x = 0; x < b_constr.datalen; x++) {
21584                 uint64_t b_conv_23 = b_vals[x];
21585                 void* b_conv_23_ptr = untag_ptr(b_conv_23);
21586                 CHECK_ACCESS(b_conv_23_ptr);
21587                 LDKC2Tuple_u32CVec_u8ZZ b_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(b_conv_23_ptr);
21588                 b_conv_23_conv = C2Tuple_u32CVec_u8ZZ_clone((LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(b_conv_23));
21589                 b_constr.data[x] = b_conv_23_conv;
21590         }
21591         FREE(b);
21592         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
21593         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(a_ref, b_constr);
21594         return tag_ptr(ret_conv, true);
21595 }
21596
21597 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(uint64_t _res) {
21598         if (!ptr_is_owned(_res)) return;
21599         void* _res_ptr = untag_ptr(_res);
21600         CHECK_ACCESS(_res_ptr);
21601         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_ptr);
21602         FREE(untag_ptr(_res));
21603         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(_res_conv);
21604 }
21605
21606 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(uint64_tArray _res) {
21607         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ _res_constr;
21608         _res_constr.datalen = _res->arr_len;
21609         if (_res_constr.datalen > 0)
21610                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ Elements");
21611         else
21612                 _res_constr.data = NULL;
21613         uint64_t* _res_vals = _res->elems;
21614         for (size_t a = 0; a < _res_constr.datalen; a++) {
21615                 uint64_t _res_conv_52 = _res_vals[a];
21616                 void* _res_conv_52_ptr = untag_ptr(_res_conv_52);
21617                 CHECK_ACCESS(_res_conv_52_ptr);
21618                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv_52_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_conv_52_ptr);
21619                 FREE(untag_ptr(_res_conv_52));
21620                 _res_constr.data[a] = _res_conv_52_conv;
21621         }
21622         FREE(_res);
21623         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(_res_constr);
21624 }
21625
21626 void  __attribute__((export_name("TS_CVec_CommitmentTransactionZ_free"))) TS_CVec_CommitmentTransactionZ_free(uint64_tArray _res) {
21627         LDKCVec_CommitmentTransactionZ _res_constr;
21628         _res_constr.datalen = _res->arr_len;
21629         if (_res_constr.datalen > 0)
21630                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCommitmentTransaction), "LDKCVec_CommitmentTransactionZ Elements");
21631         else
21632                 _res_constr.data = NULL;
21633         uint64_t* _res_vals = _res->elems;
21634         for (size_t x = 0; x < _res_constr.datalen; x++) {
21635                 uint64_t _res_conv_23 = _res_vals[x];
21636                 LDKCommitmentTransaction _res_conv_23_conv;
21637                 _res_conv_23_conv.inner = untag_ptr(_res_conv_23);
21638                 _res_conv_23_conv.is_owned = ptr_is_owned(_res_conv_23);
21639                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_23_conv);
21640                 _res_constr.data[x] = _res_conv_23_conv;
21641         }
21642         FREE(_res);
21643         CVec_CommitmentTransactionZ_free(_res_constr);
21644 }
21645
21646 void  __attribute__((export_name("TS_CVec_TransactionZ_free"))) TS_CVec_TransactionZ_free(ptrArray _res) {
21647         LDKCVec_TransactionZ _res_constr;
21648         _res_constr.datalen = _res->arr_len;
21649         if (_res_constr.datalen > 0)
21650                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
21651         else
21652                 _res_constr.data = NULL;
21653         int8_tArray* _res_vals = (void*) _res->elems;
21654         for (size_t m = 0; m < _res_constr.datalen; m++) {
21655                 int8_tArray _res_conv_12 = _res_vals[m];
21656                 LDKTransaction _res_conv_12_ref;
21657                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
21658                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
21659                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
21660                 _res_conv_12_ref.data_is_owned = true;
21661                 _res_constr.data[m] = _res_conv_12_ref;
21662         }
21663         FREE(_res);
21664         CVec_TransactionZ_free(_res_constr);
21665 }
21666
21667 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
21668         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
21669         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
21670         return tag_ptr(ret_conv, true);
21671 }
21672 int64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone_ptr"))) TS_C2Tuple_u32TxOutZ_clone_ptr(uint64_t arg) {
21673         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
21674         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
21675         return ret_conv;
21676 }
21677
21678 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone"))) TS_C2Tuple_u32TxOutZ_clone(uint64_t orig) {
21679         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
21680         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
21681         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
21682         return tag_ptr(ret_conv, true);
21683 }
21684
21685 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_new"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint64_t b) {
21686         void* b_ptr = untag_ptr(b);
21687         CHECK_ACCESS(b_ptr);
21688         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
21689         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
21690         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
21691         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
21692         return tag_ptr(ret_conv, true);
21693 }
21694
21695 void  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_free"))) TS_C2Tuple_u32TxOutZ_free(uint64_t _res) {
21696         if (!ptr_is_owned(_res)) return;
21697         void* _res_ptr = untag_ptr(_res);
21698         CHECK_ACCESS(_res_ptr);
21699         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
21700         FREE(untag_ptr(_res));
21701         C2Tuple_u32TxOutZ_free(_res_conv);
21702 }
21703
21704 void  __attribute__((export_name("TS_CVec_C2Tuple_u32TxOutZZ_free"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint64_tArray _res) {
21705         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
21706         _res_constr.datalen = _res->arr_len;
21707         if (_res_constr.datalen > 0)
21708                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
21709         else
21710                 _res_constr.data = NULL;
21711         uint64_t* _res_vals = _res->elems;
21712         for (size_t u = 0; u < _res_constr.datalen; u++) {
21713                 uint64_t _res_conv_20 = _res_vals[u];
21714                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
21715                 CHECK_ACCESS(_res_conv_20_ptr);
21716                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
21717                 FREE(untag_ptr(_res_conv_20));
21718                 _res_constr.data[u] = _res_conv_20_conv;
21719         }
21720         FREE(_res);
21721         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
21722 }
21723
21724 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
21725         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
21726         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(arg);
21727         return tag_ptr(ret_conv, true);
21728 }
21729 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(uint64_t arg) {
21730         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
21731         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
21732         return ret_conv;
21733 }
21734
21735 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(uint64_t orig) {
21736         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
21737         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
21738         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
21739         return tag_ptr(ret_conv, true);
21740 }
21741
21742 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint64_tArray b) {
21743         LDKThirtyTwoBytes a_ref;
21744         CHECK(a->arr_len == 32);
21745         memcpy(a_ref.data, a->elems, 32); FREE(a);
21746         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
21747         b_constr.datalen = b->arr_len;
21748         if (b_constr.datalen > 0)
21749                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
21750         else
21751                 b_constr.data = NULL;
21752         uint64_t* b_vals = b->elems;
21753         for (size_t u = 0; u < b_constr.datalen; u++) {
21754                 uint64_t b_conv_20 = b_vals[u];
21755                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
21756                 CHECK_ACCESS(b_conv_20_ptr);
21757                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
21758                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
21759                 b_constr.data[u] = b_conv_20_conv;
21760         }
21761         FREE(b);
21762         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
21763         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
21764         return tag_ptr(ret_conv, true);
21765 }
21766
21767 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(uint64_t _res) {
21768         if (!ptr_is_owned(_res)) return;
21769         void* _res_ptr = untag_ptr(_res);
21770         CHECK_ACCESS(_res_ptr);
21771         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
21772         FREE(untag_ptr(_res));
21773         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
21774 }
21775
21776 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free(uint64_tArray _res) {
21777         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ _res_constr;
21778         _res_constr.datalen = _res->arr_len;
21779         if (_res_constr.datalen > 0)
21780                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ Elements");
21781         else
21782                 _res_constr.data = NULL;
21783         uint64_t* _res_vals = _res->elems;
21784         for (size_t x = 0; x < _res_constr.datalen; x++) {
21785                 uint64_t _res_conv_49 = _res_vals[x];
21786                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
21787                 CHECK_ACCESS(_res_conv_49_ptr);
21788                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv_49_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_49_ptr);
21789                 FREE(untag_ptr(_res_conv_49));
21790                 _res_constr.data[x] = _res_conv_49_conv;
21791         }
21792         FREE(_res);
21793         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
21794 }
21795
21796 void  __attribute__((export_name("TS_CVec_BalanceZ_free"))) TS_CVec_BalanceZ_free(uint64_tArray _res) {
21797         LDKCVec_BalanceZ _res_constr;
21798         _res_constr.datalen = _res->arr_len;
21799         if (_res_constr.datalen > 0)
21800                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
21801         else
21802                 _res_constr.data = NULL;
21803         uint64_t* _res_vals = _res->elems;
21804         for (size_t j = 0; j < _res_constr.datalen; j++) {
21805                 uint64_t _res_conv_9 = _res_vals[j];
21806                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
21807                 CHECK_ACCESS(_res_conv_9_ptr);
21808                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
21809                 FREE(untag_ptr(_res_conv_9));
21810                 _res_constr.data[j] = _res_conv_9_conv;
21811         }
21812         FREE(_res);
21813         CVec_BalanceZ_free(_res_constr);
21814 }
21815
21816 static inline uint64_t C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR arg) {
21817         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
21818         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(arg);
21819         return tag_ptr(ret_conv, true);
21820 }
21821 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(uint64_t arg) {
21822         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(arg);
21823         int64_t ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(arg_conv);
21824         return ret_conv;
21825 }
21826
21827 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(uint64_t orig) {
21828         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(orig);
21829         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
21830         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(orig_conv);
21831         return tag_ptr(ret_conv, true);
21832 }
21833
21834 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_new"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(int8_tArray a, uint64_t b) {
21835         LDKThirtyTwoBytes a_ref;
21836         CHECK(a->arr_len == 32);
21837         memcpy(a_ref.data, a->elems, 32); FREE(a);
21838         LDKChannelMonitor b_conv;
21839         b_conv.inner = untag_ptr(b);
21840         b_conv.is_owned = ptr_is_owned(b);
21841         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
21842         b_conv = ChannelMonitor_clone(&b_conv);
21843         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
21844         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(a_ref, b_conv);
21845         return tag_ptr(ret_conv, true);
21846 }
21847
21848 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_free"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(uint64_t _res) {
21849         if (!ptr_is_owned(_res)) return;
21850         void* _res_ptr = untag_ptr(_res);
21851         CHECK_ACCESS(_res_ptr);
21852         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_ptr);
21853         FREE(untag_ptr(_res));
21854         C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(_res_conv);
21855 }
21856
21857 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(uint64_t o) {
21858         void* o_ptr = untag_ptr(o);
21859         CHECK_ACCESS(o_ptr);
21860         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
21861         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
21862         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
21863         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(o_conv);
21864         return tag_ptr(ret_conv, true);
21865 }
21866
21867 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(uint64_t e) {
21868         void* e_ptr = untag_ptr(e);
21869         CHECK_ACCESS(e_ptr);
21870         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21871         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21872         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
21873         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(e_conv);
21874         return tag_ptr(ret_conv, true);
21875 }
21876
21877 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(uint64_t o) {
21878         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(o);
21879         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(o_conv);
21880         return ret_conv;
21881 }
21882
21883 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(uint64_t _res) {
21884         if (!ptr_is_owned(_res)) return;
21885         void* _res_ptr = untag_ptr(_res);
21886         CHECK_ACCESS(_res_ptr);
21887         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)(_res_ptr);
21888         FREE(untag_ptr(_res));
21889         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(_res_conv);
21890 }
21891
21892 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
21893         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
21894         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(arg);
21895         return tag_ptr(ret_conv, true);
21896 }
21897 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(uint64_t arg) {
21898         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
21899         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
21900         return ret_conv;
21901 }
21902
21903 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(uint64_t orig) {
21904         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
21905         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
21906         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(orig_conv);
21907         return tag_ptr(ret_conv, true);
21908 }
21909
21910 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
21911         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
21912         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
21913         return tag_ptr(ret_conv, true);
21914 }
21915 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone_ptr"))) TS_C2Tuple_PublicKeyTypeZ_clone_ptr(uint64_t arg) {
21916         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
21917         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
21918         return ret_conv;
21919 }
21920
21921 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint64_t orig) {
21922         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
21923         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
21924         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
21925         return tag_ptr(ret_conv, true);
21926 }
21927
21928 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_new"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint64_t b) {
21929         LDKPublicKey a_ref;
21930         CHECK(a->arr_len == 33);
21931         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
21932         void* b_ptr = untag_ptr(b);
21933         CHECK_ACCESS(b_ptr);
21934         LDKType b_conv = *(LDKType*)(b_ptr);
21935         if (b_conv.free == LDKType_JCalls_free) {
21936                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21937                 LDKType_JCalls_cloned(&b_conv);
21938         }
21939         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
21940         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
21941         return tag_ptr(ret_conv, true);
21942 }
21943
21944 void  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_free"))) TS_C2Tuple_PublicKeyTypeZ_free(uint64_t _res) {
21945         if (!ptr_is_owned(_res)) return;
21946         void* _res_ptr = untag_ptr(_res);
21947         CHECK_ACCESS(_res_ptr);
21948         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
21949         FREE(untag_ptr(_res));
21950         C2Tuple_PublicKeyTypeZ_free(_res_conv);
21951 }
21952
21953 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyTypeZZ_free"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint64_tArray _res) {
21954         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
21955         _res_constr.datalen = _res->arr_len;
21956         if (_res_constr.datalen > 0)
21957                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
21958         else
21959                 _res_constr.data = NULL;
21960         uint64_t* _res_vals = _res->elems;
21961         for (size_t z = 0; z < _res_constr.datalen; z++) {
21962                 uint64_t _res_conv_25 = _res_vals[z];
21963                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
21964                 CHECK_ACCESS(_res_conv_25_ptr);
21965                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
21966                 FREE(untag_ptr(_res_conv_25));
21967                 _res_constr.data[z] = _res_conv_25_conv;
21968         }
21969         FREE(_res);
21970         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
21971 }
21972
21973 uint64_t  __attribute__((export_name("TS_COption_OffersMessageZ_some"))) TS_COption_OffersMessageZ_some(uint64_t o) {
21974         void* o_ptr = untag_ptr(o);
21975         CHECK_ACCESS(o_ptr);
21976         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
21977         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
21978         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
21979         *ret_copy = COption_OffersMessageZ_some(o_conv);
21980         uint64_t ret_ref = tag_ptr(ret_copy, true);
21981         return ret_ref;
21982 }
21983
21984 uint64_t  __attribute__((export_name("TS_COption_OffersMessageZ_none"))) TS_COption_OffersMessageZ_none() {
21985         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
21986         *ret_copy = COption_OffersMessageZ_none();
21987         uint64_t ret_ref = tag_ptr(ret_copy, true);
21988         return ret_ref;
21989 }
21990
21991 void  __attribute__((export_name("TS_COption_OffersMessageZ_free"))) TS_COption_OffersMessageZ_free(uint64_t _res) {
21992         if (!ptr_is_owned(_res)) return;
21993         void* _res_ptr = untag_ptr(_res);
21994         CHECK_ACCESS(_res_ptr);
21995         LDKCOption_OffersMessageZ _res_conv = *(LDKCOption_OffersMessageZ*)(_res_ptr);
21996         FREE(untag_ptr(_res));
21997         COption_OffersMessageZ_free(_res_conv);
21998 }
21999
22000 static inline uint64_t COption_OffersMessageZ_clone_ptr(LDKCOption_OffersMessageZ *NONNULL_PTR arg) {
22001         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
22002         *ret_copy = COption_OffersMessageZ_clone(arg);
22003         uint64_t ret_ref = tag_ptr(ret_copy, true);
22004         return ret_ref;
22005 }
22006 int64_t  __attribute__((export_name("TS_COption_OffersMessageZ_clone_ptr"))) TS_COption_OffersMessageZ_clone_ptr(uint64_t arg) {
22007         LDKCOption_OffersMessageZ* arg_conv = (LDKCOption_OffersMessageZ*)untag_ptr(arg);
22008         int64_t ret_conv = COption_OffersMessageZ_clone_ptr(arg_conv);
22009         return ret_conv;
22010 }
22011
22012 uint64_t  __attribute__((export_name("TS_COption_OffersMessageZ_clone"))) TS_COption_OffersMessageZ_clone(uint64_t orig) {
22013         LDKCOption_OffersMessageZ* orig_conv = (LDKCOption_OffersMessageZ*)untag_ptr(orig);
22014         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
22015         *ret_copy = COption_OffersMessageZ_clone(orig_conv);
22016         uint64_t ret_ref = tag_ptr(ret_copy, true);
22017         return ret_ref;
22018 }
22019
22020 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_some"))) TS_COption_CustomOnionMessageContentsZ_some(uint64_t o) {
22021         void* o_ptr = untag_ptr(o);
22022         CHECK_ACCESS(o_ptr);
22023         LDKCustomOnionMessageContents o_conv = *(LDKCustomOnionMessageContents*)(o_ptr);
22024         if (o_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
22025                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22026                 LDKCustomOnionMessageContents_JCalls_cloned(&o_conv);
22027         }
22028         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
22029         *ret_copy = COption_CustomOnionMessageContentsZ_some(o_conv);
22030         uint64_t ret_ref = tag_ptr(ret_copy, true);
22031         return ret_ref;
22032 }
22033
22034 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_none"))) TS_COption_CustomOnionMessageContentsZ_none() {
22035         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
22036         *ret_copy = COption_CustomOnionMessageContentsZ_none();
22037         uint64_t ret_ref = tag_ptr(ret_copy, true);
22038         return ret_ref;
22039 }
22040
22041 void  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_free"))) TS_COption_CustomOnionMessageContentsZ_free(uint64_t _res) {
22042         if (!ptr_is_owned(_res)) return;
22043         void* _res_ptr = untag_ptr(_res);
22044         CHECK_ACCESS(_res_ptr);
22045         LDKCOption_CustomOnionMessageContentsZ _res_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(_res_ptr);
22046         FREE(untag_ptr(_res));
22047         COption_CustomOnionMessageContentsZ_free(_res_conv);
22048 }
22049
22050 static inline uint64_t COption_CustomOnionMessageContentsZ_clone_ptr(LDKCOption_CustomOnionMessageContentsZ *NONNULL_PTR arg) {
22051         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
22052         *ret_copy = COption_CustomOnionMessageContentsZ_clone(arg);
22053         uint64_t ret_ref = tag_ptr(ret_copy, true);
22054         return ret_ref;
22055 }
22056 int64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_clone_ptr"))) TS_COption_CustomOnionMessageContentsZ_clone_ptr(uint64_t arg) {
22057         LDKCOption_CustomOnionMessageContentsZ* arg_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(arg);
22058         int64_t ret_conv = COption_CustomOnionMessageContentsZ_clone_ptr(arg_conv);
22059         return ret_conv;
22060 }
22061
22062 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_clone"))) TS_COption_CustomOnionMessageContentsZ_clone(uint64_t orig) {
22063         LDKCOption_CustomOnionMessageContentsZ* orig_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(orig);
22064         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
22065         *ret_copy = COption_CustomOnionMessageContentsZ_clone(orig_conv);
22066         uint64_t ret_ref = tag_ptr(ret_copy, true);
22067         return ret_ref;
22068 }
22069
22070 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(uint64_t o) {
22071         void* o_ptr = untag_ptr(o);
22072         CHECK_ACCESS(o_ptr);
22073         LDKCOption_CustomOnionMessageContentsZ o_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(o_ptr);
22074         o_conv = COption_CustomOnionMessageContentsZ_clone((LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(o));
22075         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
22076         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o_conv);
22077         return tag_ptr(ret_conv, true);
22078 }
22079
22080 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(uint64_t e) {
22081         void* e_ptr = untag_ptr(e);
22082         CHECK_ACCESS(e_ptr);
22083         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22084         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22085         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
22086         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e_conv);
22087         return tag_ptr(ret_conv, true);
22088 }
22089
22090 jboolean  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(uint64_t o) {
22091         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(o);
22092         jboolean ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o_conv);
22093         return ret_conv;
22094 }
22095
22096 void  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(uint64_t _res) {
22097         if (!ptr_is_owned(_res)) return;
22098         void* _res_ptr = untag_ptr(_res);
22099         CHECK_ACCESS(_res_ptr);
22100         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(_res_ptr);
22101         FREE(untag_ptr(_res));
22102         CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res_conv);
22103 }
22104
22105 static inline uint64_t CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) {
22106         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
22107         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(arg);
22108         return tag_ptr(ret_conv, true);
22109 }
22110 int64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(uint64_t arg) {
22111         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(arg);
22112         int64_t ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv);
22113         return ret_conv;
22114 }
22115
22116 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(uint64_t orig) {
22117         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(orig);
22118         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
22119         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(orig_conv);
22120         return tag_ptr(ret_conv, true);
22121 }
22122
22123 uint64_t  __attribute__((export_name("TS_COption_TypeZ_some"))) TS_COption_TypeZ_some(uint64_t o) {
22124         void* o_ptr = untag_ptr(o);
22125         CHECK_ACCESS(o_ptr);
22126         LDKType o_conv = *(LDKType*)(o_ptr);
22127         if (o_conv.free == LDKType_JCalls_free) {
22128                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22129                 LDKType_JCalls_cloned(&o_conv);
22130         }
22131         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
22132         *ret_copy = COption_TypeZ_some(o_conv);
22133         uint64_t ret_ref = tag_ptr(ret_copy, true);
22134         return ret_ref;
22135 }
22136
22137 uint64_t  __attribute__((export_name("TS_COption_TypeZ_none"))) TS_COption_TypeZ_none() {
22138         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
22139         *ret_copy = COption_TypeZ_none();
22140         uint64_t ret_ref = tag_ptr(ret_copy, true);
22141         return ret_ref;
22142 }
22143
22144 void  __attribute__((export_name("TS_COption_TypeZ_free"))) TS_COption_TypeZ_free(uint64_t _res) {
22145         if (!ptr_is_owned(_res)) return;
22146         void* _res_ptr = untag_ptr(_res);
22147         CHECK_ACCESS(_res_ptr);
22148         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
22149         FREE(untag_ptr(_res));
22150         COption_TypeZ_free(_res_conv);
22151 }
22152
22153 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
22154         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
22155         *ret_copy = COption_TypeZ_clone(arg);
22156         uint64_t ret_ref = tag_ptr(ret_copy, true);
22157         return ret_ref;
22158 }
22159 int64_t  __attribute__((export_name("TS_COption_TypeZ_clone_ptr"))) TS_COption_TypeZ_clone_ptr(uint64_t arg) {
22160         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
22161         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
22162         return ret_conv;
22163 }
22164
22165 uint64_t  __attribute__((export_name("TS_COption_TypeZ_clone"))) TS_COption_TypeZ_clone(uint64_t orig) {
22166         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
22167         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
22168         *ret_copy = COption_TypeZ_clone(orig_conv);
22169         uint64_t ret_ref = tag_ptr(ret_copy, true);
22170         return ret_ref;
22171 }
22172
22173 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint64_t o) {
22174         void* o_ptr = untag_ptr(o);
22175         CHECK_ACCESS(o_ptr);
22176         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
22177         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
22178         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
22179         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
22180         return tag_ptr(ret_conv, true);
22181 }
22182
22183 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_err"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint64_t e) {
22184         void* e_ptr = untag_ptr(e);
22185         CHECK_ACCESS(e_ptr);
22186         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22187         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22188         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
22189         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
22190         return tag_ptr(ret_conv, true);
22191 }
22192
22193 jboolean  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_is_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_is_ok(uint64_t o) {
22194         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
22195         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
22196         return ret_conv;
22197 }
22198
22199 void  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_free"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint64_t _res) {
22200         if (!ptr_is_owned(_res)) return;
22201         void* _res_ptr = untag_ptr(_res);
22202         CHECK_ACCESS(_res_ptr);
22203         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
22204         FREE(untag_ptr(_res));
22205         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
22206 }
22207
22208 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
22209         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
22210         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
22211         return tag_ptr(ret_conv, true);
22212 }
22213 int64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr(uint64_t arg) {
22214         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
22215         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
22216         return ret_conv;
22217 }
22218
22219 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint64_t orig) {
22220         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
22221         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
22222         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
22223         return tag_ptr(ret_conv, true);
22224 }
22225
22226 uint64_t  __attribute__((export_name("TS_COption_SocketAddressZ_some"))) TS_COption_SocketAddressZ_some(uint64_t o) {
22227         void* o_ptr = untag_ptr(o);
22228         CHECK_ACCESS(o_ptr);
22229         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
22230         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
22231         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
22232         *ret_copy = COption_SocketAddressZ_some(o_conv);
22233         uint64_t ret_ref = tag_ptr(ret_copy, true);
22234         return ret_ref;
22235 }
22236
22237 uint64_t  __attribute__((export_name("TS_COption_SocketAddressZ_none"))) TS_COption_SocketAddressZ_none() {
22238         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
22239         *ret_copy = COption_SocketAddressZ_none();
22240         uint64_t ret_ref = tag_ptr(ret_copy, true);
22241         return ret_ref;
22242 }
22243
22244 void  __attribute__((export_name("TS_COption_SocketAddressZ_free"))) TS_COption_SocketAddressZ_free(uint64_t _res) {
22245         if (!ptr_is_owned(_res)) return;
22246         void* _res_ptr = untag_ptr(_res);
22247         CHECK_ACCESS(_res_ptr);
22248         LDKCOption_SocketAddressZ _res_conv = *(LDKCOption_SocketAddressZ*)(_res_ptr);
22249         FREE(untag_ptr(_res));
22250         COption_SocketAddressZ_free(_res_conv);
22251 }
22252
22253 static inline uint64_t COption_SocketAddressZ_clone_ptr(LDKCOption_SocketAddressZ *NONNULL_PTR arg) {
22254         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
22255         *ret_copy = COption_SocketAddressZ_clone(arg);
22256         uint64_t ret_ref = tag_ptr(ret_copy, true);
22257         return ret_ref;
22258 }
22259 int64_t  __attribute__((export_name("TS_COption_SocketAddressZ_clone_ptr"))) TS_COption_SocketAddressZ_clone_ptr(uint64_t arg) {
22260         LDKCOption_SocketAddressZ* arg_conv = (LDKCOption_SocketAddressZ*)untag_ptr(arg);
22261         int64_t ret_conv = COption_SocketAddressZ_clone_ptr(arg_conv);
22262         return ret_conv;
22263 }
22264
22265 uint64_t  __attribute__((export_name("TS_COption_SocketAddressZ_clone"))) TS_COption_SocketAddressZ_clone(uint64_t orig) {
22266         LDKCOption_SocketAddressZ* orig_conv = (LDKCOption_SocketAddressZ*)untag_ptr(orig);
22267         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
22268         *ret_copy = COption_SocketAddressZ_clone(orig_conv);
22269         uint64_t ret_ref = tag_ptr(ret_copy, true);
22270         return ret_ref;
22271 }
22272
22273 static inline uint64_t C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR arg) {
22274         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
22275         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(arg);
22276         return tag_ptr(ret_conv, true);
22277 }
22278 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr"))) TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr(uint64_t arg) {
22279         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(arg);
22280         int64_t ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr(arg_conv);
22281         return ret_conv;
22282 }
22283
22284 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_clone"))) TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(uint64_t orig) {
22285         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(orig);
22286         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
22287         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(orig_conv);
22288         return tag_ptr(ret_conv, true);
22289 }
22290
22291 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_new"))) TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_new(int8_tArray a, uint64_t b) {
22292         LDKPublicKey a_ref;
22293         CHECK(a->arr_len == 33);
22294         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
22295         void* b_ptr = untag_ptr(b);
22296         CHECK_ACCESS(b_ptr);
22297         LDKCOption_SocketAddressZ b_conv = *(LDKCOption_SocketAddressZ*)(b_ptr);
22298         b_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(b));
22299         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
22300         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_new(a_ref, b_conv);
22301         return tag_ptr(ret_conv, true);
22302 }
22303
22304 void  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_free"))) TS_C2Tuple_PublicKeyCOption_SocketAddressZZ_free(uint64_t _res) {
22305         if (!ptr_is_owned(_res)) return;
22306         void* _res_ptr = untag_ptr(_res);
22307         CHECK_ACCESS(_res_ptr);
22308         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)(_res_ptr);
22309         FREE(untag_ptr(_res));
22310         C2Tuple_PublicKeyCOption_SocketAddressZZ_free(_res_conv);
22311 }
22312
22313 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_free"))) TS_CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_free(uint64_tArray _res) {
22314         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ _res_constr;
22315         _res_constr.datalen = _res->arr_len;
22316         if (_res_constr.datalen > 0)
22317                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ Elements");
22318         else
22319                 _res_constr.data = NULL;
22320         uint64_t* _res_vals = _res->elems;
22321         for (size_t r = 0; r < _res_constr.datalen; r++) {
22322                 uint64_t _res_conv_43 = _res_vals[r];
22323                 void* _res_conv_43_ptr = untag_ptr(_res_conv_43);
22324                 CHECK_ACCESS(_res_conv_43_ptr);
22325                 LDKC2Tuple_PublicKeyCOption_SocketAddressZZ _res_conv_43_conv = *(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)(_res_conv_43_ptr);
22326                 FREE(untag_ptr(_res_conv_43));
22327                 _res_constr.data[r] = _res_conv_43_conv;
22328         }
22329         FREE(_res);
22330         CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_free(_res_constr);
22331 }
22332
22333 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
22334         LDKCVec_u8Z o_ref;
22335         o_ref.datalen = o->arr_len;
22336         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
22337         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
22338         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
22339         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
22340         return tag_ptr(ret_conv, true);
22341 }
22342
22343 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint64_t e) {
22344         LDKPeerHandleError e_conv;
22345         e_conv.inner = untag_ptr(e);
22346         e_conv.is_owned = ptr_is_owned(e);
22347         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22348         e_conv = PeerHandleError_clone(&e_conv);
22349         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
22350         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
22351         return tag_ptr(ret_conv, true);
22352 }
22353
22354 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(uint64_t o) {
22355         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
22356         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
22357         return ret_conv;
22358 }
22359
22360 void  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_free"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint64_t _res) {
22361         if (!ptr_is_owned(_res)) return;
22362         void* _res_ptr = untag_ptr(_res);
22363         CHECK_ACCESS(_res_ptr);
22364         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
22365         FREE(untag_ptr(_res));
22366         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
22367 }
22368
22369 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
22370         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
22371         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
22372         return tag_ptr(ret_conv, true);
22373 }
22374 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(uint64_t arg) {
22375         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
22376         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
22377         return ret_conv;
22378 }
22379
22380 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint64_t orig) {
22381         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
22382         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
22383         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
22384         return tag_ptr(ret_conv, true);
22385 }
22386
22387 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_ok"))) TS_CResult_NonePeerHandleErrorZ_ok() {
22388         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
22389         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
22390         return tag_ptr(ret_conv, true);
22391 }
22392
22393 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_err"))) TS_CResult_NonePeerHandleErrorZ_err(uint64_t e) {
22394         LDKPeerHandleError e_conv;
22395         e_conv.inner = untag_ptr(e);
22396         e_conv.is_owned = ptr_is_owned(e);
22397         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22398         e_conv = PeerHandleError_clone(&e_conv);
22399         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
22400         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
22401         return tag_ptr(ret_conv, true);
22402 }
22403
22404 jboolean  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_is_ok"))) TS_CResult_NonePeerHandleErrorZ_is_ok(uint64_t o) {
22405         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
22406         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
22407         return ret_conv;
22408 }
22409
22410 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_free"))) TS_CResult_NonePeerHandleErrorZ_free(uint64_t _res) {
22411         if (!ptr_is_owned(_res)) return;
22412         void* _res_ptr = untag_ptr(_res);
22413         CHECK_ACCESS(_res_ptr);
22414         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
22415         FREE(untag_ptr(_res));
22416         CResult_NonePeerHandleErrorZ_free(_res_conv);
22417 }
22418
22419 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
22420         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
22421         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
22422         return tag_ptr(ret_conv, true);
22423 }
22424 int64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone_ptr"))) TS_CResult_NonePeerHandleErrorZ_clone_ptr(uint64_t arg) {
22425         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
22426         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
22427         return ret_conv;
22428 }
22429
22430 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone"))) TS_CResult_NonePeerHandleErrorZ_clone(uint64_t orig) {
22431         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
22432         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
22433         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
22434         return tag_ptr(ret_conv, true);
22435 }
22436
22437 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_ok"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
22438         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
22439         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
22440         return tag_ptr(ret_conv, true);
22441 }
22442
22443 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_err"))) TS_CResult_boolPeerHandleErrorZ_err(uint64_t e) {
22444         LDKPeerHandleError e_conv;
22445         e_conv.inner = untag_ptr(e);
22446         e_conv.is_owned = ptr_is_owned(e);
22447         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22448         e_conv = PeerHandleError_clone(&e_conv);
22449         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
22450         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
22451         return tag_ptr(ret_conv, true);
22452 }
22453
22454 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_is_ok"))) TS_CResult_boolPeerHandleErrorZ_is_ok(uint64_t o) {
22455         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
22456         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
22457         return ret_conv;
22458 }
22459
22460 void  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_free"))) TS_CResult_boolPeerHandleErrorZ_free(uint64_t _res) {
22461         if (!ptr_is_owned(_res)) return;
22462         void* _res_ptr = untag_ptr(_res);
22463         CHECK_ACCESS(_res_ptr);
22464         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
22465         FREE(untag_ptr(_res));
22466         CResult_boolPeerHandleErrorZ_free(_res_conv);
22467 }
22468
22469 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
22470         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
22471         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
22472         return tag_ptr(ret_conv, true);
22473 }
22474 int64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone_ptr"))) TS_CResult_boolPeerHandleErrorZ_clone_ptr(uint64_t arg) {
22475         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
22476         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
22477         return ret_conv;
22478 }
22479
22480 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone"))) TS_CResult_boolPeerHandleErrorZ_clone(uint64_t orig) {
22481         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
22482         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
22483         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
22484         return tag_ptr(ret_conv, true);
22485 }
22486
22487 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_ok"))) TS_CResult_u32GraphSyncErrorZ_ok(int32_t o) {
22488         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
22489         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
22490         return tag_ptr(ret_conv, true);
22491 }
22492
22493 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_err"))) TS_CResult_u32GraphSyncErrorZ_err(uint64_t e) {
22494         void* e_ptr = untag_ptr(e);
22495         CHECK_ACCESS(e_ptr);
22496         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
22497         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
22498         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
22499         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
22500         return tag_ptr(ret_conv, true);
22501 }
22502
22503 jboolean  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_is_ok"))) TS_CResult_u32GraphSyncErrorZ_is_ok(uint64_t o) {
22504         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
22505         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
22506         return ret_conv;
22507 }
22508
22509 void  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_free"))) TS_CResult_u32GraphSyncErrorZ_free(uint64_t _res) {
22510         if (!ptr_is_owned(_res)) return;
22511         void* _res_ptr = untag_ptr(_res);
22512         CHECK_ACCESS(_res_ptr);
22513         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
22514         FREE(untag_ptr(_res));
22515         CResult_u32GraphSyncErrorZ_free(_res_conv);
22516 }
22517
22518 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_ok"))) TS_CResult_CVec_u8ZIOErrorZ_ok(int8_tArray o) {
22519         LDKCVec_u8Z o_ref;
22520         o_ref.datalen = o->arr_len;
22521         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
22522         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
22523         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
22524         *ret_conv = CResult_CVec_u8ZIOErrorZ_ok(o_ref);
22525         return tag_ptr(ret_conv, true);
22526 }
22527
22528 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_err"))) TS_CResult_CVec_u8ZIOErrorZ_err(uint32_t e) {
22529         LDKIOError e_conv = LDKIOError_from_js(e);
22530         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
22531         *ret_conv = CResult_CVec_u8ZIOErrorZ_err(e_conv);
22532         return tag_ptr(ret_conv, true);
22533 }
22534
22535 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_is_ok"))) TS_CResult_CVec_u8ZIOErrorZ_is_ok(uint64_t o) {
22536         LDKCResult_CVec_u8ZIOErrorZ* o_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(o);
22537         jboolean ret_conv = CResult_CVec_u8ZIOErrorZ_is_ok(o_conv);
22538         return ret_conv;
22539 }
22540
22541 void  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_free"))) TS_CResult_CVec_u8ZIOErrorZ_free(uint64_t _res) {
22542         if (!ptr_is_owned(_res)) return;
22543         void* _res_ptr = untag_ptr(_res);
22544         CHECK_ACCESS(_res_ptr);
22545         LDKCResult_CVec_u8ZIOErrorZ _res_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(_res_ptr);
22546         FREE(untag_ptr(_res));
22547         CResult_CVec_u8ZIOErrorZ_free(_res_conv);
22548 }
22549
22550 static inline uint64_t CResult_CVec_u8ZIOErrorZ_clone_ptr(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR arg) {
22551         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
22552         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(arg);
22553         return tag_ptr(ret_conv, true);
22554 }
22555 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZIOErrorZ_clone_ptr(uint64_t arg) {
22556         LDKCResult_CVec_u8ZIOErrorZ* arg_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(arg);
22557         int64_t ret_conv = CResult_CVec_u8ZIOErrorZ_clone_ptr(arg_conv);
22558         return ret_conv;
22559 }
22560
22561 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_clone"))) TS_CResult_CVec_u8ZIOErrorZ_clone(uint64_t orig) {
22562         LDKCResult_CVec_u8ZIOErrorZ* orig_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(orig);
22563         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
22564         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(orig_conv);
22565         return tag_ptr(ret_conv, true);
22566 }
22567
22568 uint64_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_ok"))) TS_CResult_NoneIOErrorZ_ok() {
22569         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
22570         *ret_conv = CResult_NoneIOErrorZ_ok();
22571         return tag_ptr(ret_conv, true);
22572 }
22573
22574 uint64_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_err"))) TS_CResult_NoneIOErrorZ_err(uint32_t e) {
22575         LDKIOError e_conv = LDKIOError_from_js(e);
22576         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
22577         *ret_conv = CResult_NoneIOErrorZ_err(e_conv);
22578         return tag_ptr(ret_conv, true);
22579 }
22580
22581 jboolean  __attribute__((export_name("TS_CResult_NoneIOErrorZ_is_ok"))) TS_CResult_NoneIOErrorZ_is_ok(uint64_t o) {
22582         LDKCResult_NoneIOErrorZ* o_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(o);
22583         jboolean ret_conv = CResult_NoneIOErrorZ_is_ok(o_conv);
22584         return ret_conv;
22585 }
22586
22587 void  __attribute__((export_name("TS_CResult_NoneIOErrorZ_free"))) TS_CResult_NoneIOErrorZ_free(uint64_t _res) {
22588         if (!ptr_is_owned(_res)) return;
22589         void* _res_ptr = untag_ptr(_res);
22590         CHECK_ACCESS(_res_ptr);
22591         LDKCResult_NoneIOErrorZ _res_conv = *(LDKCResult_NoneIOErrorZ*)(_res_ptr);
22592         FREE(untag_ptr(_res));
22593         CResult_NoneIOErrorZ_free(_res_conv);
22594 }
22595
22596 static inline uint64_t CResult_NoneIOErrorZ_clone_ptr(LDKCResult_NoneIOErrorZ *NONNULL_PTR arg) {
22597         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
22598         *ret_conv = CResult_NoneIOErrorZ_clone(arg);
22599         return tag_ptr(ret_conv, true);
22600 }
22601 int64_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_clone_ptr"))) TS_CResult_NoneIOErrorZ_clone_ptr(uint64_t arg) {
22602         LDKCResult_NoneIOErrorZ* arg_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(arg);
22603         int64_t ret_conv = CResult_NoneIOErrorZ_clone_ptr(arg_conv);
22604         return ret_conv;
22605 }
22606
22607 uint64_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_clone"))) TS_CResult_NoneIOErrorZ_clone(uint64_t orig) {
22608         LDKCResult_NoneIOErrorZ* orig_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(orig);
22609         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
22610         *ret_conv = CResult_NoneIOErrorZ_clone(orig_conv);
22611         return tag_ptr(ret_conv, true);
22612 }
22613
22614 void  __attribute__((export_name("TS_CVec_StrZ_free"))) TS_CVec_StrZ_free(ptrArray _res) {
22615         LDKCVec_StrZ _res_constr;
22616         _res_constr.datalen = _res->arr_len;
22617         if (_res_constr.datalen > 0)
22618                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
22619         else
22620                 _res_constr.data = NULL;
22621         jstring* _res_vals = (void*) _res->elems;
22622         for (size_t i = 0; i < _res_constr.datalen; i++) {
22623                 jstring _res_conv_8 = _res_vals[i];
22624                 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
22625                 _res_constr.data[i] = dummy;
22626         }
22627         FREE(_res);
22628         CVec_StrZ_free(_res_constr);
22629 }
22630
22631 uint64_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_ok"))) TS_CResult_CVec_StrZIOErrorZ_ok(ptrArray o) {
22632         LDKCVec_StrZ o_constr;
22633         o_constr.datalen = o->arr_len;
22634         if (o_constr.datalen > 0)
22635                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
22636         else
22637                 o_constr.data = NULL;
22638         jstring* o_vals = (void*) o->elems;
22639         for (size_t i = 0; i < o_constr.datalen; i++) {
22640                 jstring o_conv_8 = o_vals[i];
22641                 LDKStr o_conv_8_conv = str_ref_to_owned_c(o_conv_8);
22642                 o_constr.data[i] = o_conv_8_conv;
22643         }
22644         FREE(o);
22645         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
22646         *ret_conv = CResult_CVec_StrZIOErrorZ_ok(o_constr);
22647         return tag_ptr(ret_conv, true);
22648 }
22649
22650 uint64_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_err"))) TS_CResult_CVec_StrZIOErrorZ_err(uint32_t e) {
22651         LDKIOError e_conv = LDKIOError_from_js(e);
22652         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
22653         *ret_conv = CResult_CVec_StrZIOErrorZ_err(e_conv);
22654         return tag_ptr(ret_conv, true);
22655 }
22656
22657 jboolean  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_is_ok"))) TS_CResult_CVec_StrZIOErrorZ_is_ok(uint64_t o) {
22658         LDKCResult_CVec_StrZIOErrorZ* o_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(o);
22659         jboolean ret_conv = CResult_CVec_StrZIOErrorZ_is_ok(o_conv);
22660         return ret_conv;
22661 }
22662
22663 void  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_free"))) TS_CResult_CVec_StrZIOErrorZ_free(uint64_t _res) {
22664         if (!ptr_is_owned(_res)) return;
22665         void* _res_ptr = untag_ptr(_res);
22666         CHECK_ACCESS(_res_ptr);
22667         LDKCResult_CVec_StrZIOErrorZ _res_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(_res_ptr);
22668         FREE(untag_ptr(_res));
22669         CResult_CVec_StrZIOErrorZ_free(_res_conv);
22670 }
22671
22672 static inline uint64_t CResult_CVec_StrZIOErrorZ_clone_ptr(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR arg) {
22673         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
22674         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(arg);
22675         return tag_ptr(ret_conv, true);
22676 }
22677 int64_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_clone_ptr"))) TS_CResult_CVec_StrZIOErrorZ_clone_ptr(uint64_t arg) {
22678         LDKCResult_CVec_StrZIOErrorZ* arg_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(arg);
22679         int64_t ret_conv = CResult_CVec_StrZIOErrorZ_clone_ptr(arg_conv);
22680         return ret_conv;
22681 }
22682
22683 uint64_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_clone"))) TS_CResult_CVec_StrZIOErrorZ_clone(uint64_t orig) {
22684         LDKCResult_CVec_StrZIOErrorZ* orig_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(orig);
22685         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
22686         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(orig_conv);
22687         return tag_ptr(ret_conv, true);
22688 }
22689
22690 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(uint64_tArray _res) {
22691         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ _res_constr;
22692         _res_constr.datalen = _res->arr_len;
22693         if (_res_constr.datalen > 0)
22694                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
22695         else
22696                 _res_constr.data = NULL;
22697         uint64_t* _res_vals = _res->elems;
22698         for (size_t o = 0; o < _res_constr.datalen; o++) {
22699                 uint64_t _res_conv_40 = _res_vals[o];
22700                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
22701                 CHECK_ACCESS(_res_conv_40_ptr);
22702                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_conv_40_ptr);
22703                 FREE(untag_ptr(_res_conv_40));
22704                 _res_constr.data[o] = _res_conv_40_conv;
22705         }
22706         FREE(_res);
22707         CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(_res_constr);
22708 }
22709
22710 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(uint64_tArray o) {
22711         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ o_constr;
22712         o_constr.datalen = o->arr_len;
22713         if (o_constr.datalen > 0)
22714                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
22715         else
22716                 o_constr.data = NULL;
22717         uint64_t* o_vals = o->elems;
22718         for (size_t o = 0; o < o_constr.datalen; o++) {
22719                 uint64_t o_conv_40 = o_vals[o];
22720                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
22721                 CHECK_ACCESS(o_conv_40_ptr);
22722                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_conv_40_ptr);
22723                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o_conv_40));
22724                 o_constr.data[o] = o_conv_40_conv;
22725         }
22726         FREE(o);
22727         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
22728         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(o_constr);
22729         return tag_ptr(ret_conv, true);
22730 }
22731
22732 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(uint32_t e) {
22733         LDKIOError e_conv = LDKIOError_from_js(e);
22734         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
22735         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(e_conv);
22736         return tag_ptr(ret_conv, true);
22737 }
22738
22739 jboolean  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(uint64_t o) {
22740         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(o);
22741         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o_conv);
22742         return ret_conv;
22743 }
22744
22745 void  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(uint64_t _res) {
22746         if (!ptr_is_owned(_res)) return;
22747         void* _res_ptr = untag_ptr(_res);
22748         CHECK_ACCESS(_res_ptr);
22749         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)(_res_ptr);
22750         FREE(untag_ptr(_res));
22751         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(_res_conv);
22752 }
22753
22754 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR arg) {
22755         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
22756         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(arg);
22757         return tag_ptr(ret_conv, true);
22758 }
22759 int64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(uint64_t arg) {
22760         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(arg);
22761         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(arg_conv);
22762         return ret_conv;
22763 }
22764
22765 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(uint64_t orig) {
22766         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(orig);
22767         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
22768         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(orig_conv);
22769         return tag_ptr(ret_conv, true);
22770 }
22771
22772 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(uint64_t o) {
22773         void* o_ptr = untag_ptr(o);
22774         CHECK_ACCESS(o_ptr);
22775         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
22776         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
22777         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
22778         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(o_conv);
22779         return tag_ptr(ret_conv, true);
22780 }
22781
22782 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(uint32_t e) {
22783         LDKIOError e_conv = LDKIOError_from_js(e);
22784         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
22785         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(e_conv);
22786         return tag_ptr(ret_conv, true);
22787 }
22788
22789 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(uint64_t o) {
22790         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(o);
22791         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(o_conv);
22792         return ret_conv;
22793 }
22794
22795 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(uint64_t _res) {
22796         if (!ptr_is_owned(_res)) return;
22797         void* _res_ptr = untag_ptr(_res);
22798         CHECK_ACCESS(_res_ptr);
22799         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)(_res_ptr);
22800         FREE(untag_ptr(_res));
22801         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(_res_conv);
22802 }
22803
22804 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR arg) {
22805         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
22806         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(arg);
22807         return tag_ptr(ret_conv, true);
22808 }
22809 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(uint64_t arg) {
22810         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(arg);
22811         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(arg_conv);
22812         return ret_conv;
22813 }
22814
22815 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(uint64_t orig) {
22816         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(orig);
22817         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
22818         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(orig_conv);
22819         return tag_ptr(ret_conv, true);
22820 }
22821
22822 uint64_t  __attribute__((export_name("TS_COption_SecretKeyZ_some"))) TS_COption_SecretKeyZ_some(int8_tArray o) {
22823         LDKSecretKey o_ref;
22824         CHECK(o->arr_len == 32);
22825         memcpy(o_ref.bytes, o->elems, 32); FREE(o);
22826         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
22827         *ret_copy = COption_SecretKeyZ_some(o_ref);
22828         uint64_t ret_ref = tag_ptr(ret_copy, true);
22829         return ret_ref;
22830 }
22831
22832 uint64_t  __attribute__((export_name("TS_COption_SecretKeyZ_none"))) TS_COption_SecretKeyZ_none() {
22833         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
22834         *ret_copy = COption_SecretKeyZ_none();
22835         uint64_t ret_ref = tag_ptr(ret_copy, true);
22836         return ret_ref;
22837 }
22838
22839 void  __attribute__((export_name("TS_COption_SecretKeyZ_free"))) TS_COption_SecretKeyZ_free(uint64_t _res) {
22840         if (!ptr_is_owned(_res)) return;
22841         void* _res_ptr = untag_ptr(_res);
22842         CHECK_ACCESS(_res_ptr);
22843         LDKCOption_SecretKeyZ _res_conv = *(LDKCOption_SecretKeyZ*)(_res_ptr);
22844         FREE(untag_ptr(_res));
22845         COption_SecretKeyZ_free(_res_conv);
22846 }
22847
22848 static inline uint64_t COption_SecretKeyZ_clone_ptr(LDKCOption_SecretKeyZ *NONNULL_PTR arg) {
22849         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
22850         *ret_copy = COption_SecretKeyZ_clone(arg);
22851         uint64_t ret_ref = tag_ptr(ret_copy, true);
22852         return ret_ref;
22853 }
22854 int64_t  __attribute__((export_name("TS_COption_SecretKeyZ_clone_ptr"))) TS_COption_SecretKeyZ_clone_ptr(uint64_t arg) {
22855         LDKCOption_SecretKeyZ* arg_conv = (LDKCOption_SecretKeyZ*)untag_ptr(arg);
22856         int64_t ret_conv = COption_SecretKeyZ_clone_ptr(arg_conv);
22857         return ret_conv;
22858 }
22859
22860 uint64_t  __attribute__((export_name("TS_COption_SecretKeyZ_clone"))) TS_COption_SecretKeyZ_clone(uint64_t orig) {
22861         LDKCOption_SecretKeyZ* orig_conv = (LDKCOption_SecretKeyZ*)untag_ptr(orig);
22862         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
22863         *ret_copy = COption_SecretKeyZ_clone(orig_conv);
22864         uint64_t ret_ref = tag_ptr(ret_copy, true);
22865         return ret_ref;
22866 }
22867
22868 uint64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_ok"))) TS_CResult_VerifiedInvoiceRequestNoneZ_ok(uint64_t o) {
22869         LDKVerifiedInvoiceRequest o_conv;
22870         o_conv.inner = untag_ptr(o);
22871         o_conv.is_owned = ptr_is_owned(o);
22872         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22873         o_conv = VerifiedInvoiceRequest_clone(&o_conv);
22874         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
22875         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_ok(o_conv);
22876         return tag_ptr(ret_conv, true);
22877 }
22878
22879 uint64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_err"))) TS_CResult_VerifiedInvoiceRequestNoneZ_err() {
22880         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
22881         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_err();
22882         return tag_ptr(ret_conv, true);
22883 }
22884
22885 jboolean  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_is_ok"))) TS_CResult_VerifiedInvoiceRequestNoneZ_is_ok(uint64_t o) {
22886         LDKCResult_VerifiedInvoiceRequestNoneZ* o_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(o);
22887         jboolean ret_conv = CResult_VerifiedInvoiceRequestNoneZ_is_ok(o_conv);
22888         return ret_conv;
22889 }
22890
22891 void  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_free"))) TS_CResult_VerifiedInvoiceRequestNoneZ_free(uint64_t _res) {
22892         if (!ptr_is_owned(_res)) return;
22893         void* _res_ptr = untag_ptr(_res);
22894         CHECK_ACCESS(_res_ptr);
22895         LDKCResult_VerifiedInvoiceRequestNoneZ _res_conv = *(LDKCResult_VerifiedInvoiceRequestNoneZ*)(_res_ptr);
22896         FREE(untag_ptr(_res));
22897         CResult_VerifiedInvoiceRequestNoneZ_free(_res_conv);
22898 }
22899
22900 static inline uint64_t CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR arg) {
22901         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
22902         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(arg);
22903         return tag_ptr(ret_conv, true);
22904 }
22905 int64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_clone_ptr"))) TS_CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(uint64_t arg) {
22906         LDKCResult_VerifiedInvoiceRequestNoneZ* arg_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(arg);
22907         int64_t ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(arg_conv);
22908         return ret_conv;
22909 }
22910
22911 uint64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_clone"))) TS_CResult_VerifiedInvoiceRequestNoneZ_clone(uint64_t orig) {
22912         LDKCResult_VerifiedInvoiceRequestNoneZ* orig_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(orig);
22913         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
22914         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(orig_conv);
22915         return tag_ptr(ret_conv, true);
22916 }
22917
22918 uint32_t  __attribute__((export_name("TS_COption_NoneZ_some"))) TS_COption_NoneZ_some() {
22919         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_some());
22920         return ret_conv;
22921 }
22922
22923 uint32_t  __attribute__((export_name("TS_COption_NoneZ_none"))) TS_COption_NoneZ_none() {
22924         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_none());
22925         return ret_conv;
22926 }
22927
22928 void  __attribute__((export_name("TS_COption_NoneZ_free"))) TS_COption_NoneZ_free(uint32_t _res) {
22929         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_js(_res);
22930         COption_NoneZ_free(_res_conv);
22931 }
22932
22933 void  __attribute__((export_name("TS_CVec_WitnessZ_free"))) TS_CVec_WitnessZ_free(ptrArray _res) {
22934         LDKCVec_WitnessZ _res_constr;
22935         _res_constr.datalen = _res->arr_len;
22936         if (_res_constr.datalen > 0)
22937                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
22938         else
22939                 _res_constr.data = NULL;
22940         int8_tArray* _res_vals = (void*) _res->elems;
22941         for (size_t m = 0; m < _res_constr.datalen; m++) {
22942                 int8_tArray _res_conv_12 = _res_vals[m];
22943                 LDKWitness _res_conv_12_ref;
22944                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
22945                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKWitness Bytes");
22946                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
22947                 _res_conv_12_ref.data_is_owned = true;
22948                 _res_constr.data[m] = _res_conv_12_ref;
22949         }
22950         FREE(_res);
22951         CVec_WitnessZ_free(_res_constr);
22952 }
22953
22954 uint64_t  __attribute__((export_name("TS_COption_i64Z_some"))) TS_COption_i64Z_some(int64_t o) {
22955         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
22956         *ret_copy = COption_i64Z_some(o);
22957         uint64_t ret_ref = tag_ptr(ret_copy, true);
22958         return ret_ref;
22959 }
22960
22961 uint64_t  __attribute__((export_name("TS_COption_i64Z_none"))) TS_COption_i64Z_none() {
22962         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
22963         *ret_copy = COption_i64Z_none();
22964         uint64_t ret_ref = tag_ptr(ret_copy, true);
22965         return ret_ref;
22966 }
22967
22968 void  __attribute__((export_name("TS_COption_i64Z_free"))) TS_COption_i64Z_free(uint64_t _res) {
22969         if (!ptr_is_owned(_res)) return;
22970         void* _res_ptr = untag_ptr(_res);
22971         CHECK_ACCESS(_res_ptr);
22972         LDKCOption_i64Z _res_conv = *(LDKCOption_i64Z*)(_res_ptr);
22973         FREE(untag_ptr(_res));
22974         COption_i64Z_free(_res_conv);
22975 }
22976
22977 static inline uint64_t COption_i64Z_clone_ptr(LDKCOption_i64Z *NONNULL_PTR arg) {
22978         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
22979         *ret_copy = COption_i64Z_clone(arg);
22980         uint64_t ret_ref = tag_ptr(ret_copy, true);
22981         return ret_ref;
22982 }
22983 int64_t  __attribute__((export_name("TS_COption_i64Z_clone_ptr"))) TS_COption_i64Z_clone_ptr(uint64_t arg) {
22984         LDKCOption_i64Z* arg_conv = (LDKCOption_i64Z*)untag_ptr(arg);
22985         int64_t ret_conv = COption_i64Z_clone_ptr(arg_conv);
22986         return ret_conv;
22987 }
22988
22989 uint64_t  __attribute__((export_name("TS_COption_i64Z_clone"))) TS_COption_i64Z_clone(uint64_t orig) {
22990         LDKCOption_i64Z* orig_conv = (LDKCOption_i64Z*)untag_ptr(orig);
22991         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
22992         *ret_copy = COption_i64Z_clone(orig_conv);
22993         uint64_t ret_ref = tag_ptr(ret_copy, true);
22994         return ret_ref;
22995 }
22996
22997 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_ok"))) TS_CResult_SocketAddressDecodeErrorZ_ok(uint64_t o) {
22998         void* o_ptr = untag_ptr(o);
22999         CHECK_ACCESS(o_ptr);
23000         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
23001         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
23002         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
23003         *ret_conv = CResult_SocketAddressDecodeErrorZ_ok(o_conv);
23004         return tag_ptr(ret_conv, true);
23005 }
23006
23007 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_err"))) TS_CResult_SocketAddressDecodeErrorZ_err(uint64_t e) {
23008         void* e_ptr = untag_ptr(e);
23009         CHECK_ACCESS(e_ptr);
23010         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23011         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23012         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
23013         *ret_conv = CResult_SocketAddressDecodeErrorZ_err(e_conv);
23014         return tag_ptr(ret_conv, true);
23015 }
23016
23017 jboolean  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_is_ok"))) TS_CResult_SocketAddressDecodeErrorZ_is_ok(uint64_t o) {
23018         LDKCResult_SocketAddressDecodeErrorZ* o_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(o);
23019         jboolean ret_conv = CResult_SocketAddressDecodeErrorZ_is_ok(o_conv);
23020         return ret_conv;
23021 }
23022
23023 void  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_free"))) TS_CResult_SocketAddressDecodeErrorZ_free(uint64_t _res) {
23024         if (!ptr_is_owned(_res)) return;
23025         void* _res_ptr = untag_ptr(_res);
23026         CHECK_ACCESS(_res_ptr);
23027         LDKCResult_SocketAddressDecodeErrorZ _res_conv = *(LDKCResult_SocketAddressDecodeErrorZ*)(_res_ptr);
23028         FREE(untag_ptr(_res));
23029         CResult_SocketAddressDecodeErrorZ_free(_res_conv);
23030 }
23031
23032 static inline uint64_t CResult_SocketAddressDecodeErrorZ_clone_ptr(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR arg) {
23033         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
23034         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(arg);
23035         return tag_ptr(ret_conv, true);
23036 }
23037 int64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_clone_ptr"))) TS_CResult_SocketAddressDecodeErrorZ_clone_ptr(uint64_t arg) {
23038         LDKCResult_SocketAddressDecodeErrorZ* arg_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(arg);
23039         int64_t ret_conv = CResult_SocketAddressDecodeErrorZ_clone_ptr(arg_conv);
23040         return ret_conv;
23041 }
23042
23043 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_clone"))) TS_CResult_SocketAddressDecodeErrorZ_clone(uint64_t orig) {
23044         LDKCResult_SocketAddressDecodeErrorZ* orig_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(orig);
23045         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
23046         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(orig_conv);
23047         return tag_ptr(ret_conv, true);
23048 }
23049
23050 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_ok"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_ok(uint64_t o) {
23051         void* o_ptr = untag_ptr(o);
23052         CHECK_ACCESS(o_ptr);
23053         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
23054         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
23055         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
23056         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_ok(o_conv);
23057         return tag_ptr(ret_conv, true);
23058 }
23059
23060 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_err"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_err(uint32_t e) {
23061         LDKSocketAddressParseError e_conv = LDKSocketAddressParseError_from_js(e);
23062         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
23063         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_err(e_conv);
23064         return tag_ptr(ret_conv, true);
23065 }
23066
23067 jboolean  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_is_ok"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_is_ok(uint64_t o) {
23068         LDKCResult_SocketAddressSocketAddressParseErrorZ* o_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(o);
23069         jboolean ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_is_ok(o_conv);
23070         return ret_conv;
23071 }
23072
23073 void  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_free"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_free(uint64_t _res) {
23074         if (!ptr_is_owned(_res)) return;
23075         void* _res_ptr = untag_ptr(_res);
23076         CHECK_ACCESS(_res_ptr);
23077         LDKCResult_SocketAddressSocketAddressParseErrorZ _res_conv = *(LDKCResult_SocketAddressSocketAddressParseErrorZ*)(_res_ptr);
23078         FREE(untag_ptr(_res));
23079         CResult_SocketAddressSocketAddressParseErrorZ_free(_res_conv);
23080 }
23081
23082 static inline uint64_t CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR arg) {
23083         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
23084         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(arg);
23085         return tag_ptr(ret_conv, true);
23086 }
23087 int64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(uint64_t arg) {
23088         LDKCResult_SocketAddressSocketAddressParseErrorZ* arg_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(arg);
23089         int64_t ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(arg_conv);
23090         return ret_conv;
23091 }
23092
23093 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_clone"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_clone(uint64_t orig) {
23094         LDKCResult_SocketAddressSocketAddressParseErrorZ* orig_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(orig);
23095         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
23096         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(orig_conv);
23097         return tag_ptr(ret_conv, true);
23098 }
23099
23100 void  __attribute__((export_name("TS_CVec_UpdateAddHTLCZ_free"))) TS_CVec_UpdateAddHTLCZ_free(uint64_tArray _res) {
23101         LDKCVec_UpdateAddHTLCZ _res_constr;
23102         _res_constr.datalen = _res->arr_len;
23103         if (_res_constr.datalen > 0)
23104                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
23105         else
23106                 _res_constr.data = NULL;
23107         uint64_t* _res_vals = _res->elems;
23108         for (size_t p = 0; p < _res_constr.datalen; p++) {
23109                 uint64_t _res_conv_15 = _res_vals[p];
23110                 LDKUpdateAddHTLC _res_conv_15_conv;
23111                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
23112                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
23113                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
23114                 _res_constr.data[p] = _res_conv_15_conv;
23115         }
23116         FREE(_res);
23117         CVec_UpdateAddHTLCZ_free(_res_constr);
23118 }
23119
23120 void  __attribute__((export_name("TS_CVec_UpdateFulfillHTLCZ_free"))) TS_CVec_UpdateFulfillHTLCZ_free(uint64_tArray _res) {
23121         LDKCVec_UpdateFulfillHTLCZ _res_constr;
23122         _res_constr.datalen = _res->arr_len;
23123         if (_res_constr.datalen > 0)
23124                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
23125         else
23126                 _res_constr.data = NULL;
23127         uint64_t* _res_vals = _res->elems;
23128         for (size_t t = 0; t < _res_constr.datalen; t++) {
23129                 uint64_t _res_conv_19 = _res_vals[t];
23130                 LDKUpdateFulfillHTLC _res_conv_19_conv;
23131                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
23132                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
23133                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
23134                 _res_constr.data[t] = _res_conv_19_conv;
23135         }
23136         FREE(_res);
23137         CVec_UpdateFulfillHTLCZ_free(_res_constr);
23138 }
23139
23140 void  __attribute__((export_name("TS_CVec_UpdateFailHTLCZ_free"))) TS_CVec_UpdateFailHTLCZ_free(uint64_tArray _res) {
23141         LDKCVec_UpdateFailHTLCZ _res_constr;
23142         _res_constr.datalen = _res->arr_len;
23143         if (_res_constr.datalen > 0)
23144                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
23145         else
23146                 _res_constr.data = NULL;
23147         uint64_t* _res_vals = _res->elems;
23148         for (size_t q = 0; q < _res_constr.datalen; q++) {
23149                 uint64_t _res_conv_16 = _res_vals[q];
23150                 LDKUpdateFailHTLC _res_conv_16_conv;
23151                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
23152                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
23153                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
23154                 _res_constr.data[q] = _res_conv_16_conv;
23155         }
23156         FREE(_res);
23157         CVec_UpdateFailHTLCZ_free(_res_constr);
23158 }
23159
23160 void  __attribute__((export_name("TS_CVec_UpdateFailMalformedHTLCZ_free"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint64_tArray _res) {
23161         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
23162         _res_constr.datalen = _res->arr_len;
23163         if (_res_constr.datalen > 0)
23164                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
23165         else
23166                 _res_constr.data = NULL;
23167         uint64_t* _res_vals = _res->elems;
23168         for (size_t z = 0; z < _res_constr.datalen; z++) {
23169                 uint64_t _res_conv_25 = _res_vals[z];
23170                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
23171                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
23172                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
23173                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
23174                 _res_constr.data[z] = _res_conv_25_conv;
23175         }
23176         FREE(_res);
23177         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
23178 }
23179
23180 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint64_t o) {
23181         LDKAcceptChannel o_conv;
23182         o_conv.inner = untag_ptr(o);
23183         o_conv.is_owned = ptr_is_owned(o);
23184         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23185         o_conv = AcceptChannel_clone(&o_conv);
23186         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
23187         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
23188         return tag_ptr(ret_conv, true);
23189 }
23190
23191 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_err"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint64_t e) {
23192         void* e_ptr = untag_ptr(e);
23193         CHECK_ACCESS(e_ptr);
23194         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23195         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23196         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
23197         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
23198         return tag_ptr(ret_conv, true);
23199 }
23200
23201 jboolean  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_is_ok(uint64_t o) {
23202         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
23203         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
23204         return ret_conv;
23205 }
23206
23207 void  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_free"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint64_t _res) {
23208         if (!ptr_is_owned(_res)) return;
23209         void* _res_ptr = untag_ptr(_res);
23210         CHECK_ACCESS(_res_ptr);
23211         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
23212         FREE(untag_ptr(_res));
23213         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
23214 }
23215
23216 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
23217         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
23218         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
23219         return tag_ptr(ret_conv, true);
23220 }
23221 int64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
23222         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
23223         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
23224         return ret_conv;
23225 }
23226
23227 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint64_t orig) {
23228         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
23229         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
23230         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
23231         return tag_ptr(ret_conv, true);
23232 }
23233
23234 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_ok"))) TS_CResult_AcceptChannelV2DecodeErrorZ_ok(uint64_t o) {
23235         LDKAcceptChannelV2 o_conv;
23236         o_conv.inner = untag_ptr(o);
23237         o_conv.is_owned = ptr_is_owned(o);
23238         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23239         o_conv = AcceptChannelV2_clone(&o_conv);
23240         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
23241         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_ok(o_conv);
23242         return tag_ptr(ret_conv, true);
23243 }
23244
23245 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_err"))) TS_CResult_AcceptChannelV2DecodeErrorZ_err(uint64_t e) {
23246         void* e_ptr = untag_ptr(e);
23247         CHECK_ACCESS(e_ptr);
23248         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23249         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23250         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
23251         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_err(e_conv);
23252         return tag_ptr(ret_conv, true);
23253 }
23254
23255 jboolean  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelV2DecodeErrorZ_is_ok(uint64_t o) {
23256         LDKCResult_AcceptChannelV2DecodeErrorZ* o_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(o);
23257         jboolean ret_conv = CResult_AcceptChannelV2DecodeErrorZ_is_ok(o_conv);
23258         return ret_conv;
23259 }
23260
23261 void  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_free"))) TS_CResult_AcceptChannelV2DecodeErrorZ_free(uint64_t _res) {
23262         if (!ptr_is_owned(_res)) return;
23263         void* _res_ptr = untag_ptr(_res);
23264         CHECK_ACCESS(_res_ptr);
23265         LDKCResult_AcceptChannelV2DecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelV2DecodeErrorZ*)(_res_ptr);
23266         FREE(untag_ptr(_res));
23267         CResult_AcceptChannelV2DecodeErrorZ_free(_res_conv);
23268 }
23269
23270 static inline uint64_t CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR arg) {
23271         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
23272         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(arg);
23273         return tag_ptr(ret_conv, true);
23274 }
23275 int64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(uint64_t arg) {
23276         LDKCResult_AcceptChannelV2DecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(arg);
23277         int64_t ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(arg_conv);
23278         return ret_conv;
23279 }
23280
23281 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_clone"))) TS_CResult_AcceptChannelV2DecodeErrorZ_clone(uint64_t orig) {
23282         LDKCResult_AcceptChannelV2DecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(orig);
23283         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
23284         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(orig_conv);
23285         return tag_ptr(ret_conv, true);
23286 }
23287
23288 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_ok"))) TS_CResult_TxAddInputDecodeErrorZ_ok(uint64_t o) {
23289         LDKTxAddInput o_conv;
23290         o_conv.inner = untag_ptr(o);
23291         o_conv.is_owned = ptr_is_owned(o);
23292         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23293         o_conv = TxAddInput_clone(&o_conv);
23294         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
23295         *ret_conv = CResult_TxAddInputDecodeErrorZ_ok(o_conv);
23296         return tag_ptr(ret_conv, true);
23297 }
23298
23299 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_err"))) TS_CResult_TxAddInputDecodeErrorZ_err(uint64_t e) {
23300         void* e_ptr = untag_ptr(e);
23301         CHECK_ACCESS(e_ptr);
23302         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23303         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23304         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
23305         *ret_conv = CResult_TxAddInputDecodeErrorZ_err(e_conv);
23306         return tag_ptr(ret_conv, true);
23307 }
23308
23309 jboolean  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_is_ok"))) TS_CResult_TxAddInputDecodeErrorZ_is_ok(uint64_t o) {
23310         LDKCResult_TxAddInputDecodeErrorZ* o_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(o);
23311         jboolean ret_conv = CResult_TxAddInputDecodeErrorZ_is_ok(o_conv);
23312         return ret_conv;
23313 }
23314
23315 void  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_free"))) TS_CResult_TxAddInputDecodeErrorZ_free(uint64_t _res) {
23316         if (!ptr_is_owned(_res)) return;
23317         void* _res_ptr = untag_ptr(_res);
23318         CHECK_ACCESS(_res_ptr);
23319         LDKCResult_TxAddInputDecodeErrorZ _res_conv = *(LDKCResult_TxAddInputDecodeErrorZ*)(_res_ptr);
23320         FREE(untag_ptr(_res));
23321         CResult_TxAddInputDecodeErrorZ_free(_res_conv);
23322 }
23323
23324 static inline uint64_t CResult_TxAddInputDecodeErrorZ_clone_ptr(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR arg) {
23325         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
23326         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(arg);
23327         return tag_ptr(ret_conv, true);
23328 }
23329 int64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_clone_ptr"))) TS_CResult_TxAddInputDecodeErrorZ_clone_ptr(uint64_t arg) {
23330         LDKCResult_TxAddInputDecodeErrorZ* arg_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(arg);
23331         int64_t ret_conv = CResult_TxAddInputDecodeErrorZ_clone_ptr(arg_conv);
23332         return ret_conv;
23333 }
23334
23335 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_clone"))) TS_CResult_TxAddInputDecodeErrorZ_clone(uint64_t orig) {
23336         LDKCResult_TxAddInputDecodeErrorZ* orig_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(orig);
23337         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
23338         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(orig_conv);
23339         return tag_ptr(ret_conv, true);
23340 }
23341
23342 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_ok"))) TS_CResult_TxAddOutputDecodeErrorZ_ok(uint64_t o) {
23343         LDKTxAddOutput o_conv;
23344         o_conv.inner = untag_ptr(o);
23345         o_conv.is_owned = ptr_is_owned(o);
23346         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23347         o_conv = TxAddOutput_clone(&o_conv);
23348         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
23349         *ret_conv = CResult_TxAddOutputDecodeErrorZ_ok(o_conv);
23350         return tag_ptr(ret_conv, true);
23351 }
23352
23353 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_err"))) TS_CResult_TxAddOutputDecodeErrorZ_err(uint64_t e) {
23354         void* e_ptr = untag_ptr(e);
23355         CHECK_ACCESS(e_ptr);
23356         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23357         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23358         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
23359         *ret_conv = CResult_TxAddOutputDecodeErrorZ_err(e_conv);
23360         return tag_ptr(ret_conv, true);
23361 }
23362
23363 jboolean  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_is_ok"))) TS_CResult_TxAddOutputDecodeErrorZ_is_ok(uint64_t o) {
23364         LDKCResult_TxAddOutputDecodeErrorZ* o_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(o);
23365         jboolean ret_conv = CResult_TxAddOutputDecodeErrorZ_is_ok(o_conv);
23366         return ret_conv;
23367 }
23368
23369 void  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_free"))) TS_CResult_TxAddOutputDecodeErrorZ_free(uint64_t _res) {
23370         if (!ptr_is_owned(_res)) return;
23371         void* _res_ptr = untag_ptr(_res);
23372         CHECK_ACCESS(_res_ptr);
23373         LDKCResult_TxAddOutputDecodeErrorZ _res_conv = *(LDKCResult_TxAddOutputDecodeErrorZ*)(_res_ptr);
23374         FREE(untag_ptr(_res));
23375         CResult_TxAddOutputDecodeErrorZ_free(_res_conv);
23376 }
23377
23378 static inline uint64_t CResult_TxAddOutputDecodeErrorZ_clone_ptr(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR arg) {
23379         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
23380         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(arg);
23381         return tag_ptr(ret_conv, true);
23382 }
23383 int64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_clone_ptr"))) TS_CResult_TxAddOutputDecodeErrorZ_clone_ptr(uint64_t arg) {
23384         LDKCResult_TxAddOutputDecodeErrorZ* arg_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(arg);
23385         int64_t ret_conv = CResult_TxAddOutputDecodeErrorZ_clone_ptr(arg_conv);
23386         return ret_conv;
23387 }
23388
23389 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_clone"))) TS_CResult_TxAddOutputDecodeErrorZ_clone(uint64_t orig) {
23390         LDKCResult_TxAddOutputDecodeErrorZ* orig_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(orig);
23391         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
23392         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(orig_conv);
23393         return tag_ptr(ret_conv, true);
23394 }
23395
23396 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_ok"))) TS_CResult_TxRemoveInputDecodeErrorZ_ok(uint64_t o) {
23397         LDKTxRemoveInput o_conv;
23398         o_conv.inner = untag_ptr(o);
23399         o_conv.is_owned = ptr_is_owned(o);
23400         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23401         o_conv = TxRemoveInput_clone(&o_conv);
23402         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
23403         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_ok(o_conv);
23404         return tag_ptr(ret_conv, true);
23405 }
23406
23407 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_err"))) TS_CResult_TxRemoveInputDecodeErrorZ_err(uint64_t e) {
23408         void* e_ptr = untag_ptr(e);
23409         CHECK_ACCESS(e_ptr);
23410         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23411         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23412         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
23413         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_err(e_conv);
23414         return tag_ptr(ret_conv, true);
23415 }
23416
23417 jboolean  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_is_ok"))) TS_CResult_TxRemoveInputDecodeErrorZ_is_ok(uint64_t o) {
23418         LDKCResult_TxRemoveInputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(o);
23419         jboolean ret_conv = CResult_TxRemoveInputDecodeErrorZ_is_ok(o_conv);
23420         return ret_conv;
23421 }
23422
23423 void  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_free"))) TS_CResult_TxRemoveInputDecodeErrorZ_free(uint64_t _res) {
23424         if (!ptr_is_owned(_res)) return;
23425         void* _res_ptr = untag_ptr(_res);
23426         CHECK_ACCESS(_res_ptr);
23427         LDKCResult_TxRemoveInputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveInputDecodeErrorZ*)(_res_ptr);
23428         FREE(untag_ptr(_res));
23429         CResult_TxRemoveInputDecodeErrorZ_free(_res_conv);
23430 }
23431
23432 static inline uint64_t CResult_TxRemoveInputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR arg) {
23433         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
23434         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(arg);
23435         return tag_ptr(ret_conv, true);
23436 }
23437 int64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_clone_ptr"))) TS_CResult_TxRemoveInputDecodeErrorZ_clone_ptr(uint64_t arg) {
23438         LDKCResult_TxRemoveInputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(arg);
23439         int64_t ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone_ptr(arg_conv);
23440         return ret_conv;
23441 }
23442
23443 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_clone"))) TS_CResult_TxRemoveInputDecodeErrorZ_clone(uint64_t orig) {
23444         LDKCResult_TxRemoveInputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(orig);
23445         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
23446         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(orig_conv);
23447         return tag_ptr(ret_conv, true);
23448 }
23449
23450 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_ok"))) TS_CResult_TxRemoveOutputDecodeErrorZ_ok(uint64_t o) {
23451         LDKTxRemoveOutput o_conv;
23452         o_conv.inner = untag_ptr(o);
23453         o_conv.is_owned = ptr_is_owned(o);
23454         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23455         o_conv = TxRemoveOutput_clone(&o_conv);
23456         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
23457         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_ok(o_conv);
23458         return tag_ptr(ret_conv, true);
23459 }
23460
23461 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_err"))) TS_CResult_TxRemoveOutputDecodeErrorZ_err(uint64_t e) {
23462         void* e_ptr = untag_ptr(e);
23463         CHECK_ACCESS(e_ptr);
23464         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23465         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23466         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
23467         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_err(e_conv);
23468         return tag_ptr(ret_conv, true);
23469 }
23470
23471 jboolean  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_is_ok"))) TS_CResult_TxRemoveOutputDecodeErrorZ_is_ok(uint64_t o) {
23472         LDKCResult_TxRemoveOutputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(o);
23473         jboolean ret_conv = CResult_TxRemoveOutputDecodeErrorZ_is_ok(o_conv);
23474         return ret_conv;
23475 }
23476
23477 void  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_free"))) TS_CResult_TxRemoveOutputDecodeErrorZ_free(uint64_t _res) {
23478         if (!ptr_is_owned(_res)) return;
23479         void* _res_ptr = untag_ptr(_res);
23480         CHECK_ACCESS(_res_ptr);
23481         LDKCResult_TxRemoveOutputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveOutputDecodeErrorZ*)(_res_ptr);
23482         FREE(untag_ptr(_res));
23483         CResult_TxRemoveOutputDecodeErrorZ_free(_res_conv);
23484 }
23485
23486 static inline uint64_t CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR arg) {
23487         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
23488         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(arg);
23489         return tag_ptr(ret_conv, true);
23490 }
23491 int64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_clone_ptr"))) TS_CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(uint64_t arg) {
23492         LDKCResult_TxRemoveOutputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(arg);
23493         int64_t ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(arg_conv);
23494         return ret_conv;
23495 }
23496
23497 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_clone"))) TS_CResult_TxRemoveOutputDecodeErrorZ_clone(uint64_t orig) {
23498         LDKCResult_TxRemoveOutputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(orig);
23499         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
23500         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(orig_conv);
23501         return tag_ptr(ret_conv, true);
23502 }
23503
23504 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_ok"))) TS_CResult_TxCompleteDecodeErrorZ_ok(uint64_t o) {
23505         LDKTxComplete o_conv;
23506         o_conv.inner = untag_ptr(o);
23507         o_conv.is_owned = ptr_is_owned(o);
23508         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23509         o_conv = TxComplete_clone(&o_conv);
23510         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
23511         *ret_conv = CResult_TxCompleteDecodeErrorZ_ok(o_conv);
23512         return tag_ptr(ret_conv, true);
23513 }
23514
23515 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_err"))) TS_CResult_TxCompleteDecodeErrorZ_err(uint64_t e) {
23516         void* e_ptr = untag_ptr(e);
23517         CHECK_ACCESS(e_ptr);
23518         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23519         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23520         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
23521         *ret_conv = CResult_TxCompleteDecodeErrorZ_err(e_conv);
23522         return tag_ptr(ret_conv, true);
23523 }
23524
23525 jboolean  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_is_ok"))) TS_CResult_TxCompleteDecodeErrorZ_is_ok(uint64_t o) {
23526         LDKCResult_TxCompleteDecodeErrorZ* o_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(o);
23527         jboolean ret_conv = CResult_TxCompleteDecodeErrorZ_is_ok(o_conv);
23528         return ret_conv;
23529 }
23530
23531 void  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_free"))) TS_CResult_TxCompleteDecodeErrorZ_free(uint64_t _res) {
23532         if (!ptr_is_owned(_res)) return;
23533         void* _res_ptr = untag_ptr(_res);
23534         CHECK_ACCESS(_res_ptr);
23535         LDKCResult_TxCompleteDecodeErrorZ _res_conv = *(LDKCResult_TxCompleteDecodeErrorZ*)(_res_ptr);
23536         FREE(untag_ptr(_res));
23537         CResult_TxCompleteDecodeErrorZ_free(_res_conv);
23538 }
23539
23540 static inline uint64_t CResult_TxCompleteDecodeErrorZ_clone_ptr(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR arg) {
23541         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
23542         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(arg);
23543         return tag_ptr(ret_conv, true);
23544 }
23545 int64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_clone_ptr"))) TS_CResult_TxCompleteDecodeErrorZ_clone_ptr(uint64_t arg) {
23546         LDKCResult_TxCompleteDecodeErrorZ* arg_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(arg);
23547         int64_t ret_conv = CResult_TxCompleteDecodeErrorZ_clone_ptr(arg_conv);
23548         return ret_conv;
23549 }
23550
23551 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_clone"))) TS_CResult_TxCompleteDecodeErrorZ_clone(uint64_t orig) {
23552         LDKCResult_TxCompleteDecodeErrorZ* orig_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(orig);
23553         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
23554         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(orig_conv);
23555         return tag_ptr(ret_conv, true);
23556 }
23557
23558 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_ok"))) TS_CResult_TxSignaturesDecodeErrorZ_ok(uint64_t o) {
23559         LDKTxSignatures o_conv;
23560         o_conv.inner = untag_ptr(o);
23561         o_conv.is_owned = ptr_is_owned(o);
23562         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23563         o_conv = TxSignatures_clone(&o_conv);
23564         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
23565         *ret_conv = CResult_TxSignaturesDecodeErrorZ_ok(o_conv);
23566         return tag_ptr(ret_conv, true);
23567 }
23568
23569 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_err"))) TS_CResult_TxSignaturesDecodeErrorZ_err(uint64_t e) {
23570         void* e_ptr = untag_ptr(e);
23571         CHECK_ACCESS(e_ptr);
23572         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23573         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23574         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
23575         *ret_conv = CResult_TxSignaturesDecodeErrorZ_err(e_conv);
23576         return tag_ptr(ret_conv, true);
23577 }
23578
23579 jboolean  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_is_ok"))) TS_CResult_TxSignaturesDecodeErrorZ_is_ok(uint64_t o) {
23580         LDKCResult_TxSignaturesDecodeErrorZ* o_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(o);
23581         jboolean ret_conv = CResult_TxSignaturesDecodeErrorZ_is_ok(o_conv);
23582         return ret_conv;
23583 }
23584
23585 void  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_free"))) TS_CResult_TxSignaturesDecodeErrorZ_free(uint64_t _res) {
23586         if (!ptr_is_owned(_res)) return;
23587         void* _res_ptr = untag_ptr(_res);
23588         CHECK_ACCESS(_res_ptr);
23589         LDKCResult_TxSignaturesDecodeErrorZ _res_conv = *(LDKCResult_TxSignaturesDecodeErrorZ*)(_res_ptr);
23590         FREE(untag_ptr(_res));
23591         CResult_TxSignaturesDecodeErrorZ_free(_res_conv);
23592 }
23593
23594 static inline uint64_t CResult_TxSignaturesDecodeErrorZ_clone_ptr(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR arg) {
23595         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
23596         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(arg);
23597         return tag_ptr(ret_conv, true);
23598 }
23599 int64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_TxSignaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
23600         LDKCResult_TxSignaturesDecodeErrorZ* arg_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(arg);
23601         int64_t ret_conv = CResult_TxSignaturesDecodeErrorZ_clone_ptr(arg_conv);
23602         return ret_conv;
23603 }
23604
23605 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_clone"))) TS_CResult_TxSignaturesDecodeErrorZ_clone(uint64_t orig) {
23606         LDKCResult_TxSignaturesDecodeErrorZ* orig_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(orig);
23607         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
23608         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(orig_conv);
23609         return tag_ptr(ret_conv, true);
23610 }
23611
23612 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_ok"))) TS_CResult_TxInitRbfDecodeErrorZ_ok(uint64_t o) {
23613         LDKTxInitRbf o_conv;
23614         o_conv.inner = untag_ptr(o);
23615         o_conv.is_owned = ptr_is_owned(o);
23616         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23617         o_conv = TxInitRbf_clone(&o_conv);
23618         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
23619         *ret_conv = CResult_TxInitRbfDecodeErrorZ_ok(o_conv);
23620         return tag_ptr(ret_conv, true);
23621 }
23622
23623 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_err"))) TS_CResult_TxInitRbfDecodeErrorZ_err(uint64_t e) {
23624         void* e_ptr = untag_ptr(e);
23625         CHECK_ACCESS(e_ptr);
23626         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23627         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23628         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
23629         *ret_conv = CResult_TxInitRbfDecodeErrorZ_err(e_conv);
23630         return tag_ptr(ret_conv, true);
23631 }
23632
23633 jboolean  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_is_ok"))) TS_CResult_TxInitRbfDecodeErrorZ_is_ok(uint64_t o) {
23634         LDKCResult_TxInitRbfDecodeErrorZ* o_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(o);
23635         jboolean ret_conv = CResult_TxInitRbfDecodeErrorZ_is_ok(o_conv);
23636         return ret_conv;
23637 }
23638
23639 void  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_free"))) TS_CResult_TxInitRbfDecodeErrorZ_free(uint64_t _res) {
23640         if (!ptr_is_owned(_res)) return;
23641         void* _res_ptr = untag_ptr(_res);
23642         CHECK_ACCESS(_res_ptr);
23643         LDKCResult_TxInitRbfDecodeErrorZ _res_conv = *(LDKCResult_TxInitRbfDecodeErrorZ*)(_res_ptr);
23644         FREE(untag_ptr(_res));
23645         CResult_TxInitRbfDecodeErrorZ_free(_res_conv);
23646 }
23647
23648 static inline uint64_t CResult_TxInitRbfDecodeErrorZ_clone_ptr(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR arg) {
23649         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
23650         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(arg);
23651         return tag_ptr(ret_conv, true);
23652 }
23653 int64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_clone_ptr"))) TS_CResult_TxInitRbfDecodeErrorZ_clone_ptr(uint64_t arg) {
23654         LDKCResult_TxInitRbfDecodeErrorZ* arg_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(arg);
23655         int64_t ret_conv = CResult_TxInitRbfDecodeErrorZ_clone_ptr(arg_conv);
23656         return ret_conv;
23657 }
23658
23659 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_clone"))) TS_CResult_TxInitRbfDecodeErrorZ_clone(uint64_t orig) {
23660         LDKCResult_TxInitRbfDecodeErrorZ* orig_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(orig);
23661         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
23662         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(orig_conv);
23663         return tag_ptr(ret_conv, true);
23664 }
23665
23666 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_ok"))) TS_CResult_TxAckRbfDecodeErrorZ_ok(uint64_t o) {
23667         LDKTxAckRbf o_conv;
23668         o_conv.inner = untag_ptr(o);
23669         o_conv.is_owned = ptr_is_owned(o);
23670         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23671         o_conv = TxAckRbf_clone(&o_conv);
23672         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
23673         *ret_conv = CResult_TxAckRbfDecodeErrorZ_ok(o_conv);
23674         return tag_ptr(ret_conv, true);
23675 }
23676
23677 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_err"))) TS_CResult_TxAckRbfDecodeErrorZ_err(uint64_t e) {
23678         void* e_ptr = untag_ptr(e);
23679         CHECK_ACCESS(e_ptr);
23680         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23681         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23682         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
23683         *ret_conv = CResult_TxAckRbfDecodeErrorZ_err(e_conv);
23684         return tag_ptr(ret_conv, true);
23685 }
23686
23687 jboolean  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_is_ok"))) TS_CResult_TxAckRbfDecodeErrorZ_is_ok(uint64_t o) {
23688         LDKCResult_TxAckRbfDecodeErrorZ* o_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(o);
23689         jboolean ret_conv = CResult_TxAckRbfDecodeErrorZ_is_ok(o_conv);
23690         return ret_conv;
23691 }
23692
23693 void  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_free"))) TS_CResult_TxAckRbfDecodeErrorZ_free(uint64_t _res) {
23694         if (!ptr_is_owned(_res)) return;
23695         void* _res_ptr = untag_ptr(_res);
23696         CHECK_ACCESS(_res_ptr);
23697         LDKCResult_TxAckRbfDecodeErrorZ _res_conv = *(LDKCResult_TxAckRbfDecodeErrorZ*)(_res_ptr);
23698         FREE(untag_ptr(_res));
23699         CResult_TxAckRbfDecodeErrorZ_free(_res_conv);
23700 }
23701
23702 static inline uint64_t CResult_TxAckRbfDecodeErrorZ_clone_ptr(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR arg) {
23703         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
23704         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(arg);
23705         return tag_ptr(ret_conv, true);
23706 }
23707 int64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_clone_ptr"))) TS_CResult_TxAckRbfDecodeErrorZ_clone_ptr(uint64_t arg) {
23708         LDKCResult_TxAckRbfDecodeErrorZ* arg_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(arg);
23709         int64_t ret_conv = CResult_TxAckRbfDecodeErrorZ_clone_ptr(arg_conv);
23710         return ret_conv;
23711 }
23712
23713 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_clone"))) TS_CResult_TxAckRbfDecodeErrorZ_clone(uint64_t orig) {
23714         LDKCResult_TxAckRbfDecodeErrorZ* orig_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(orig);
23715         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
23716         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(orig_conv);
23717         return tag_ptr(ret_conv, true);
23718 }
23719
23720 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_ok"))) TS_CResult_TxAbortDecodeErrorZ_ok(uint64_t o) {
23721         LDKTxAbort o_conv;
23722         o_conv.inner = untag_ptr(o);
23723         o_conv.is_owned = ptr_is_owned(o);
23724         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23725         o_conv = TxAbort_clone(&o_conv);
23726         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
23727         *ret_conv = CResult_TxAbortDecodeErrorZ_ok(o_conv);
23728         return tag_ptr(ret_conv, true);
23729 }
23730
23731 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_err"))) TS_CResult_TxAbortDecodeErrorZ_err(uint64_t e) {
23732         void* e_ptr = untag_ptr(e);
23733         CHECK_ACCESS(e_ptr);
23734         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23735         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23736         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
23737         *ret_conv = CResult_TxAbortDecodeErrorZ_err(e_conv);
23738         return tag_ptr(ret_conv, true);
23739 }
23740
23741 jboolean  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_is_ok"))) TS_CResult_TxAbortDecodeErrorZ_is_ok(uint64_t o) {
23742         LDKCResult_TxAbortDecodeErrorZ* o_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(o);
23743         jboolean ret_conv = CResult_TxAbortDecodeErrorZ_is_ok(o_conv);
23744         return ret_conv;
23745 }
23746
23747 void  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_free"))) TS_CResult_TxAbortDecodeErrorZ_free(uint64_t _res) {
23748         if (!ptr_is_owned(_res)) return;
23749         void* _res_ptr = untag_ptr(_res);
23750         CHECK_ACCESS(_res_ptr);
23751         LDKCResult_TxAbortDecodeErrorZ _res_conv = *(LDKCResult_TxAbortDecodeErrorZ*)(_res_ptr);
23752         FREE(untag_ptr(_res));
23753         CResult_TxAbortDecodeErrorZ_free(_res_conv);
23754 }
23755
23756 static inline uint64_t CResult_TxAbortDecodeErrorZ_clone_ptr(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR arg) {
23757         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
23758         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(arg);
23759         return tag_ptr(ret_conv, true);
23760 }
23761 int64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_clone_ptr"))) TS_CResult_TxAbortDecodeErrorZ_clone_ptr(uint64_t arg) {
23762         LDKCResult_TxAbortDecodeErrorZ* arg_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(arg);
23763         int64_t ret_conv = CResult_TxAbortDecodeErrorZ_clone_ptr(arg_conv);
23764         return ret_conv;
23765 }
23766
23767 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_clone"))) TS_CResult_TxAbortDecodeErrorZ_clone(uint64_t orig) {
23768         LDKCResult_TxAbortDecodeErrorZ* orig_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(orig);
23769         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
23770         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(orig_conv);
23771         return tag_ptr(ret_conv, true);
23772 }
23773
23774 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint64_t o) {
23775         LDKAnnouncementSignatures o_conv;
23776         o_conv.inner = untag_ptr(o);
23777         o_conv.is_owned = ptr_is_owned(o);
23778         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23779         o_conv = AnnouncementSignatures_clone(&o_conv);
23780         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
23781         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
23782         return tag_ptr(ret_conv, true);
23783 }
23784
23785 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint64_t e) {
23786         void* e_ptr = untag_ptr(e);
23787         CHECK_ACCESS(e_ptr);
23788         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23789         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23790         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
23791         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
23792         return tag_ptr(ret_conv, true);
23793 }
23794
23795 jboolean  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(uint64_t o) {
23796         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
23797         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
23798         return ret_conv;
23799 }
23800
23801 void  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_free"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint64_t _res) {
23802         if (!ptr_is_owned(_res)) return;
23803         void* _res_ptr = untag_ptr(_res);
23804         CHECK_ACCESS(_res_ptr);
23805         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
23806         FREE(untag_ptr(_res));
23807         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
23808 }
23809
23810 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
23811         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
23812         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
23813         return tag_ptr(ret_conv, true);
23814 }
23815 int64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
23816         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
23817         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
23818         return ret_conv;
23819 }
23820
23821 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint64_t orig) {
23822         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
23823         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
23824         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
23825         return tag_ptr(ret_conv, true);
23826 }
23827
23828 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint64_t o) {
23829         LDKChannelReestablish o_conv;
23830         o_conv.inner = untag_ptr(o);
23831         o_conv.is_owned = ptr_is_owned(o);
23832         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23833         o_conv = ChannelReestablish_clone(&o_conv);
23834         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
23835         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
23836         return tag_ptr(ret_conv, true);
23837 }
23838
23839 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint64_t e) {
23840         void* e_ptr = untag_ptr(e);
23841         CHECK_ACCESS(e_ptr);
23842         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23843         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23844         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
23845         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
23846         return tag_ptr(ret_conv, true);
23847 }
23848
23849 jboolean  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_is_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_is_ok(uint64_t o) {
23850         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
23851         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
23852         return ret_conv;
23853 }
23854
23855 void  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_free"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint64_t _res) {
23856         if (!ptr_is_owned(_res)) return;
23857         void* _res_ptr = untag_ptr(_res);
23858         CHECK_ACCESS(_res_ptr);
23859         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
23860         FREE(untag_ptr(_res));
23861         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
23862 }
23863
23864 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
23865         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
23866         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
23867         return tag_ptr(ret_conv, true);
23868 }
23869 int64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(uint64_t arg) {
23870         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
23871         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
23872         return ret_conv;
23873 }
23874
23875 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint64_t orig) {
23876         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
23877         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
23878         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
23879         return tag_ptr(ret_conv, true);
23880 }
23881
23882 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint64_t o) {
23883         LDKClosingSigned o_conv;
23884         o_conv.inner = untag_ptr(o);
23885         o_conv.is_owned = ptr_is_owned(o);
23886         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23887         o_conv = ClosingSigned_clone(&o_conv);
23888         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
23889         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
23890         return tag_ptr(ret_conv, true);
23891 }
23892
23893 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_err"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint64_t e) {
23894         void* e_ptr = untag_ptr(e);
23895         CHECK_ACCESS(e_ptr);
23896         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23897         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23898         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
23899         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
23900         return tag_ptr(ret_conv, true);
23901 }
23902
23903 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_is_ok(uint64_t o) {
23904         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
23905         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
23906         return ret_conv;
23907 }
23908
23909 void  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_free"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint64_t _res) {
23910         if (!ptr_is_owned(_res)) return;
23911         void* _res_ptr = untag_ptr(_res);
23912         CHECK_ACCESS(_res_ptr);
23913         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
23914         FREE(untag_ptr(_res));
23915         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
23916 }
23917
23918 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
23919         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
23920         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
23921         return tag_ptr(ret_conv, true);
23922 }
23923 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
23924         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
23925         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
23926         return ret_conv;
23927 }
23928
23929 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint64_t orig) {
23930         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
23931         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
23932         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
23933         return tag_ptr(ret_conv, true);
23934 }
23935
23936 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint64_t o) {
23937         LDKClosingSignedFeeRange o_conv;
23938         o_conv.inner = untag_ptr(o);
23939         o_conv.is_owned = ptr_is_owned(o);
23940         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23941         o_conv = ClosingSignedFeeRange_clone(&o_conv);
23942         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
23943         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
23944         return tag_ptr(ret_conv, true);
23945 }
23946
23947 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint64_t e) {
23948         void* e_ptr = untag_ptr(e);
23949         CHECK_ACCESS(e_ptr);
23950         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23951         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23952         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
23953         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
23954         return tag_ptr(ret_conv, true);
23955 }
23956
23957 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(uint64_t o) {
23958         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
23959         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
23960         return ret_conv;
23961 }
23962
23963 void  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint64_t _res) {
23964         if (!ptr_is_owned(_res)) return;
23965         void* _res_ptr = untag_ptr(_res);
23966         CHECK_ACCESS(_res_ptr);
23967         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
23968         FREE(untag_ptr(_res));
23969         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
23970 }
23971
23972 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
23973         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
23974         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
23975         return tag_ptr(ret_conv, true);
23976 }
23977 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
23978         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
23979         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
23980         return ret_conv;
23981 }
23982
23983 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint64_t orig) {
23984         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
23985         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
23986         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
23987         return tag_ptr(ret_conv, true);
23988 }
23989
23990 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint64_t o) {
23991         LDKCommitmentSigned o_conv;
23992         o_conv.inner = untag_ptr(o);
23993         o_conv.is_owned = ptr_is_owned(o);
23994         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23995         o_conv = CommitmentSigned_clone(&o_conv);
23996         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
23997         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
23998         return tag_ptr(ret_conv, true);
23999 }
24000
24001 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint64_t e) {
24002         void* e_ptr = untag_ptr(e);
24003         CHECK_ACCESS(e_ptr);
24004         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24005         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24006         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
24007         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
24008         return tag_ptr(ret_conv, true);
24009 }
24010
24011 jboolean  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_is_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_is_ok(uint64_t o) {
24012         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
24013         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
24014         return ret_conv;
24015 }
24016
24017 void  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_free"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint64_t _res) {
24018         if (!ptr_is_owned(_res)) return;
24019         void* _res_ptr = untag_ptr(_res);
24020         CHECK_ACCESS(_res_ptr);
24021         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
24022         FREE(untag_ptr(_res));
24023         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
24024 }
24025
24026 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
24027         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
24028         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
24029         return tag_ptr(ret_conv, true);
24030 }
24031 int64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
24032         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
24033         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
24034         return ret_conv;
24035 }
24036
24037 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint64_t orig) {
24038         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
24039         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
24040         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
24041         return tag_ptr(ret_conv, true);
24042 }
24043
24044 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint64_t o) {
24045         LDKFundingCreated o_conv;
24046         o_conv.inner = untag_ptr(o);
24047         o_conv.is_owned = ptr_is_owned(o);
24048         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24049         o_conv = FundingCreated_clone(&o_conv);
24050         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
24051         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
24052         return tag_ptr(ret_conv, true);
24053 }
24054
24055 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_err"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint64_t e) {
24056         void* e_ptr = untag_ptr(e);
24057         CHECK_ACCESS(e_ptr);
24058         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24059         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24060         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
24061         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
24062         return tag_ptr(ret_conv, true);
24063 }
24064
24065 jboolean  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_is_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_is_ok(uint64_t o) {
24066         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
24067         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
24068         return ret_conv;
24069 }
24070
24071 void  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_free"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint64_t _res) {
24072         if (!ptr_is_owned(_res)) return;
24073         void* _res_ptr = untag_ptr(_res);
24074         CHECK_ACCESS(_res_ptr);
24075         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
24076         FREE(untag_ptr(_res));
24077         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
24078 }
24079
24080 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
24081         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
24082         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
24083         return tag_ptr(ret_conv, true);
24084 }
24085 int64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr(uint64_t arg) {
24086         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
24087         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
24088         return ret_conv;
24089 }
24090
24091 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint64_t orig) {
24092         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
24093         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
24094         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
24095         return tag_ptr(ret_conv, true);
24096 }
24097
24098 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_ok"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint64_t o) {
24099         LDKFundingSigned o_conv;
24100         o_conv.inner = untag_ptr(o);
24101         o_conv.is_owned = ptr_is_owned(o);
24102         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24103         o_conv = FundingSigned_clone(&o_conv);
24104         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
24105         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
24106         return tag_ptr(ret_conv, true);
24107 }
24108
24109 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_err"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint64_t e) {
24110         void* e_ptr = untag_ptr(e);
24111         CHECK_ACCESS(e_ptr);
24112         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24113         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24114         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
24115         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
24116         return tag_ptr(ret_conv, true);
24117 }
24118
24119 jboolean  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_is_ok"))) TS_CResult_FundingSignedDecodeErrorZ_is_ok(uint64_t o) {
24120         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
24121         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
24122         return ret_conv;
24123 }
24124
24125 void  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_free"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint64_t _res) {
24126         if (!ptr_is_owned(_res)) return;
24127         void* _res_ptr = untag_ptr(_res);
24128         CHECK_ACCESS(_res_ptr);
24129         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
24130         FREE(untag_ptr(_res));
24131         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
24132 }
24133
24134 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
24135         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
24136         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
24137         return tag_ptr(ret_conv, true);
24138 }
24139 int64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
24140         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
24141         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
24142         return ret_conv;
24143 }
24144
24145 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint64_t orig) {
24146         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
24147         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
24148         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
24149         return tag_ptr(ret_conv, true);
24150 }
24151
24152 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_ok(uint64_t o) {
24153         LDKChannelReady o_conv;
24154         o_conv.inner = untag_ptr(o);
24155         o_conv.is_owned = ptr_is_owned(o);
24156         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24157         o_conv = ChannelReady_clone(&o_conv);
24158         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
24159         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
24160         return tag_ptr(ret_conv, true);
24161 }
24162
24163 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_err"))) TS_CResult_ChannelReadyDecodeErrorZ_err(uint64_t e) {
24164         void* e_ptr = untag_ptr(e);
24165         CHECK_ACCESS(e_ptr);
24166         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24167         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24168         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
24169         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
24170         return tag_ptr(ret_conv, true);
24171 }
24172
24173 jboolean  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_is_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_is_ok(uint64_t o) {
24174         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
24175         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
24176         return ret_conv;
24177 }
24178
24179 void  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_free"))) TS_CResult_ChannelReadyDecodeErrorZ_free(uint64_t _res) {
24180         if (!ptr_is_owned(_res)) return;
24181         void* _res_ptr = untag_ptr(_res);
24182         CHECK_ACCESS(_res_ptr);
24183         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
24184         FREE(untag_ptr(_res));
24185         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
24186 }
24187
24188 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
24189         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
24190         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
24191         return tag_ptr(ret_conv, true);
24192 }
24193 int64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr(uint64_t arg) {
24194         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
24195         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
24196         return ret_conv;
24197 }
24198
24199 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone"))) TS_CResult_ChannelReadyDecodeErrorZ_clone(uint64_t orig) {
24200         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
24201         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
24202         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
24203         return tag_ptr(ret_conv, true);
24204 }
24205
24206 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_ok"))) TS_CResult_InitDecodeErrorZ_ok(uint64_t o) {
24207         LDKInit o_conv;
24208         o_conv.inner = untag_ptr(o);
24209         o_conv.is_owned = ptr_is_owned(o);
24210         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24211         o_conv = Init_clone(&o_conv);
24212         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
24213         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
24214         return tag_ptr(ret_conv, true);
24215 }
24216
24217 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_err"))) TS_CResult_InitDecodeErrorZ_err(uint64_t e) {
24218         void* e_ptr = untag_ptr(e);
24219         CHECK_ACCESS(e_ptr);
24220         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24221         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24222         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
24223         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
24224         return tag_ptr(ret_conv, true);
24225 }
24226
24227 jboolean  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_is_ok"))) TS_CResult_InitDecodeErrorZ_is_ok(uint64_t o) {
24228         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
24229         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
24230         return ret_conv;
24231 }
24232
24233 void  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_free"))) TS_CResult_InitDecodeErrorZ_free(uint64_t _res) {
24234         if (!ptr_is_owned(_res)) return;
24235         void* _res_ptr = untag_ptr(_res);
24236         CHECK_ACCESS(_res_ptr);
24237         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
24238         FREE(untag_ptr(_res));
24239         CResult_InitDecodeErrorZ_free(_res_conv);
24240 }
24241
24242 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
24243         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
24244         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
24245         return tag_ptr(ret_conv, true);
24246 }
24247 int64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone_ptr"))) TS_CResult_InitDecodeErrorZ_clone_ptr(uint64_t arg) {
24248         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
24249         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
24250         return ret_conv;
24251 }
24252
24253 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone"))) TS_CResult_InitDecodeErrorZ_clone(uint64_t orig) {
24254         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
24255         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
24256         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
24257         return tag_ptr(ret_conv, true);
24258 }
24259
24260 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_ok"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint64_t o) {
24261         LDKOpenChannel o_conv;
24262         o_conv.inner = untag_ptr(o);
24263         o_conv.is_owned = ptr_is_owned(o);
24264         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24265         o_conv = OpenChannel_clone(&o_conv);
24266         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
24267         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
24268         return tag_ptr(ret_conv, true);
24269 }
24270
24271 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_err"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint64_t e) {
24272         void* e_ptr = untag_ptr(e);
24273         CHECK_ACCESS(e_ptr);
24274         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24275         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24276         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
24277         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
24278         return tag_ptr(ret_conv, true);
24279 }
24280
24281 jboolean  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_is_ok"))) TS_CResult_OpenChannelDecodeErrorZ_is_ok(uint64_t o) {
24282         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
24283         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
24284         return ret_conv;
24285 }
24286
24287 void  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_free"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint64_t _res) {
24288         if (!ptr_is_owned(_res)) return;
24289         void* _res_ptr = untag_ptr(_res);
24290         CHECK_ACCESS(_res_ptr);
24291         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
24292         FREE(untag_ptr(_res));
24293         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
24294 }
24295
24296 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
24297         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
24298         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
24299         return tag_ptr(ret_conv, true);
24300 }
24301 int64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
24302         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
24303         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
24304         return ret_conv;
24305 }
24306
24307 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint64_t orig) {
24308         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
24309         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
24310         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
24311         return tag_ptr(ret_conv, true);
24312 }
24313
24314 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_ok"))) TS_CResult_OpenChannelV2DecodeErrorZ_ok(uint64_t o) {
24315         LDKOpenChannelV2 o_conv;
24316         o_conv.inner = untag_ptr(o);
24317         o_conv.is_owned = ptr_is_owned(o);
24318         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24319         o_conv = OpenChannelV2_clone(&o_conv);
24320         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
24321         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_ok(o_conv);
24322         return tag_ptr(ret_conv, true);
24323 }
24324
24325 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_err"))) TS_CResult_OpenChannelV2DecodeErrorZ_err(uint64_t e) {
24326         void* e_ptr = untag_ptr(e);
24327         CHECK_ACCESS(e_ptr);
24328         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24329         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24330         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
24331         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_err(e_conv);
24332         return tag_ptr(ret_conv, true);
24333 }
24334
24335 jboolean  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_is_ok"))) TS_CResult_OpenChannelV2DecodeErrorZ_is_ok(uint64_t o) {
24336         LDKCResult_OpenChannelV2DecodeErrorZ* o_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(o);
24337         jboolean ret_conv = CResult_OpenChannelV2DecodeErrorZ_is_ok(o_conv);
24338         return ret_conv;
24339 }
24340
24341 void  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_free"))) TS_CResult_OpenChannelV2DecodeErrorZ_free(uint64_t _res) {
24342         if (!ptr_is_owned(_res)) return;
24343         void* _res_ptr = untag_ptr(_res);
24344         CHECK_ACCESS(_res_ptr);
24345         LDKCResult_OpenChannelV2DecodeErrorZ _res_conv = *(LDKCResult_OpenChannelV2DecodeErrorZ*)(_res_ptr);
24346         FREE(untag_ptr(_res));
24347         CResult_OpenChannelV2DecodeErrorZ_free(_res_conv);
24348 }
24349
24350 static inline uint64_t CResult_OpenChannelV2DecodeErrorZ_clone_ptr(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR arg) {
24351         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
24352         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(arg);
24353         return tag_ptr(ret_conv, true);
24354 }
24355 int64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelV2DecodeErrorZ_clone_ptr(uint64_t arg) {
24356         LDKCResult_OpenChannelV2DecodeErrorZ* arg_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(arg);
24357         int64_t ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone_ptr(arg_conv);
24358         return ret_conv;
24359 }
24360
24361 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_clone"))) TS_CResult_OpenChannelV2DecodeErrorZ_clone(uint64_t orig) {
24362         LDKCResult_OpenChannelV2DecodeErrorZ* orig_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(orig);
24363         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
24364         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(orig_conv);
24365         return tag_ptr(ret_conv, true);
24366 }
24367
24368 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint64_t o) {
24369         LDKRevokeAndACK o_conv;
24370         o_conv.inner = untag_ptr(o);
24371         o_conv.is_owned = ptr_is_owned(o);
24372         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24373         o_conv = RevokeAndACK_clone(&o_conv);
24374         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
24375         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
24376         return tag_ptr(ret_conv, true);
24377 }
24378
24379 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint64_t e) {
24380         void* e_ptr = untag_ptr(e);
24381         CHECK_ACCESS(e_ptr);
24382         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24383         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24384         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
24385         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
24386         return tag_ptr(ret_conv, true);
24387 }
24388
24389 jboolean  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_is_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_is_ok(uint64_t o) {
24390         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
24391         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
24392         return ret_conv;
24393 }
24394
24395 void  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_free"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint64_t _res) {
24396         if (!ptr_is_owned(_res)) return;
24397         void* _res_ptr = untag_ptr(_res);
24398         CHECK_ACCESS(_res_ptr);
24399         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
24400         FREE(untag_ptr(_res));
24401         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
24402 }
24403
24404 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
24405         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
24406         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
24407         return tag_ptr(ret_conv, true);
24408 }
24409 int64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(uint64_t arg) {
24410         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
24411         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
24412         return ret_conv;
24413 }
24414
24415 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint64_t orig) {
24416         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
24417         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
24418         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
24419         return tag_ptr(ret_conv, true);
24420 }
24421
24422 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_ok"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint64_t o) {
24423         LDKShutdown o_conv;
24424         o_conv.inner = untag_ptr(o);
24425         o_conv.is_owned = ptr_is_owned(o);
24426         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24427         o_conv = Shutdown_clone(&o_conv);
24428         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
24429         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
24430         return tag_ptr(ret_conv, true);
24431 }
24432
24433 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_err"))) TS_CResult_ShutdownDecodeErrorZ_err(uint64_t e) {
24434         void* e_ptr = untag_ptr(e);
24435         CHECK_ACCESS(e_ptr);
24436         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24437         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24438         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
24439         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
24440         return tag_ptr(ret_conv, true);
24441 }
24442
24443 jboolean  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_is_ok"))) TS_CResult_ShutdownDecodeErrorZ_is_ok(uint64_t o) {
24444         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
24445         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
24446         return ret_conv;
24447 }
24448
24449 void  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_free"))) TS_CResult_ShutdownDecodeErrorZ_free(uint64_t _res) {
24450         if (!ptr_is_owned(_res)) return;
24451         void* _res_ptr = untag_ptr(_res);
24452         CHECK_ACCESS(_res_ptr);
24453         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
24454         FREE(untag_ptr(_res));
24455         CResult_ShutdownDecodeErrorZ_free(_res_conv);
24456 }
24457
24458 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
24459         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
24460         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
24461         return tag_ptr(ret_conv, true);
24462 }
24463 int64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownDecodeErrorZ_clone_ptr(uint64_t arg) {
24464         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
24465         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
24466         return ret_conv;
24467 }
24468
24469 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint64_t orig) {
24470         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
24471         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
24472         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
24473         return tag_ptr(ret_conv, true);
24474 }
24475
24476 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint64_t o) {
24477         LDKUpdateFailHTLC o_conv;
24478         o_conv.inner = untag_ptr(o);
24479         o_conv.is_owned = ptr_is_owned(o);
24480         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24481         o_conv = UpdateFailHTLC_clone(&o_conv);
24482         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
24483         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
24484         return tag_ptr(ret_conv, true);
24485 }
24486
24487 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint64_t e) {
24488         void* e_ptr = untag_ptr(e);
24489         CHECK_ACCESS(e_ptr);
24490         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24491         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24492         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
24493         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
24494         return tag_ptr(ret_conv, true);
24495 }
24496
24497 jboolean  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(uint64_t o) {
24498         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
24499         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
24500         return ret_conv;
24501 }
24502
24503 void  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint64_t _res) {
24504         if (!ptr_is_owned(_res)) return;
24505         void* _res_ptr = untag_ptr(_res);
24506         CHECK_ACCESS(_res_ptr);
24507         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
24508         FREE(untag_ptr(_res));
24509         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
24510 }
24511
24512 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
24513         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
24514         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
24515         return tag_ptr(ret_conv, true);
24516 }
24517 int64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
24518         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
24519         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
24520         return ret_conv;
24521 }
24522
24523 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint64_t orig) {
24524         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
24525         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
24526         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
24527         return tag_ptr(ret_conv, true);
24528 }
24529
24530 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint64_t o) {
24531         LDKUpdateFailMalformedHTLC o_conv;
24532         o_conv.inner = untag_ptr(o);
24533         o_conv.is_owned = ptr_is_owned(o);
24534         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24535         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
24536         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
24537         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
24538         return tag_ptr(ret_conv, true);
24539 }
24540
24541 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint64_t e) {
24542         void* e_ptr = untag_ptr(e);
24543         CHECK_ACCESS(e_ptr);
24544         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24545         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24546         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
24547         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
24548         return tag_ptr(ret_conv, true);
24549 }
24550
24551 jboolean  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(uint64_t o) {
24552         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
24553         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
24554         return ret_conv;
24555 }
24556
24557 void  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint64_t _res) {
24558         if (!ptr_is_owned(_res)) return;
24559         void* _res_ptr = untag_ptr(_res);
24560         CHECK_ACCESS(_res_ptr);
24561         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
24562         FREE(untag_ptr(_res));
24563         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
24564 }
24565
24566 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
24567         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
24568         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
24569         return tag_ptr(ret_conv, true);
24570 }
24571 int64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
24572         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
24573         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
24574         return ret_conv;
24575 }
24576
24577 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint64_t orig) {
24578         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
24579         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
24580         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
24581         return tag_ptr(ret_conv, true);
24582 }
24583
24584 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint64_t o) {
24585         LDKUpdateFee o_conv;
24586         o_conv.inner = untag_ptr(o);
24587         o_conv.is_owned = ptr_is_owned(o);
24588         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24589         o_conv = UpdateFee_clone(&o_conv);
24590         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
24591         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
24592         return tag_ptr(ret_conv, true);
24593 }
24594
24595 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_err"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint64_t e) {
24596         void* e_ptr = untag_ptr(e);
24597         CHECK_ACCESS(e_ptr);
24598         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24599         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24600         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
24601         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
24602         return tag_ptr(ret_conv, true);
24603 }
24604
24605 jboolean  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_is_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_is_ok(uint64_t o) {
24606         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
24607         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
24608         return ret_conv;
24609 }
24610
24611 void  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_free"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint64_t _res) {
24612         if (!ptr_is_owned(_res)) return;
24613         void* _res_ptr = untag_ptr(_res);
24614         CHECK_ACCESS(_res_ptr);
24615         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
24616         FREE(untag_ptr(_res));
24617         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
24618 }
24619
24620 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
24621         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
24622         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
24623         return tag_ptr(ret_conv, true);
24624 }
24625 int64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr(uint64_t arg) {
24626         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
24627         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
24628         return ret_conv;
24629 }
24630
24631 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint64_t orig) {
24632         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
24633         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
24634         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
24635         return tag_ptr(ret_conv, true);
24636 }
24637
24638 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint64_t o) {
24639         LDKUpdateFulfillHTLC o_conv;
24640         o_conv.inner = untag_ptr(o);
24641         o_conv.is_owned = ptr_is_owned(o);
24642         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24643         o_conv = UpdateFulfillHTLC_clone(&o_conv);
24644         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
24645         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
24646         return tag_ptr(ret_conv, true);
24647 }
24648
24649 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint64_t e) {
24650         void* e_ptr = untag_ptr(e);
24651         CHECK_ACCESS(e_ptr);
24652         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24653         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24654         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
24655         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
24656         return tag_ptr(ret_conv, true);
24657 }
24658
24659 jboolean  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(uint64_t o) {
24660         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
24661         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
24662         return ret_conv;
24663 }
24664
24665 void  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint64_t _res) {
24666         if (!ptr_is_owned(_res)) return;
24667         void* _res_ptr = untag_ptr(_res);
24668         CHECK_ACCESS(_res_ptr);
24669         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
24670         FREE(untag_ptr(_res));
24671         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
24672 }
24673
24674 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
24675         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
24676         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
24677         return tag_ptr(ret_conv, true);
24678 }
24679 int64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
24680         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
24681         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
24682         return ret_conv;
24683 }
24684
24685 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint64_t orig) {
24686         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
24687         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
24688         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
24689         return tag_ptr(ret_conv, true);
24690 }
24691
24692 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint64_t o) {
24693         LDKUpdateAddHTLC o_conv;
24694         o_conv.inner = untag_ptr(o);
24695         o_conv.is_owned = ptr_is_owned(o);
24696         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24697         o_conv = UpdateAddHTLC_clone(&o_conv);
24698         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
24699         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
24700         return tag_ptr(ret_conv, true);
24701 }
24702
24703 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint64_t e) {
24704         void* e_ptr = untag_ptr(e);
24705         CHECK_ACCESS(e_ptr);
24706         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24707         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24708         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
24709         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
24710         return tag_ptr(ret_conv, true);
24711 }
24712
24713 jboolean  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(uint64_t o) {
24714         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
24715         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
24716         return ret_conv;
24717 }
24718
24719 void  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_free"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint64_t _res) {
24720         if (!ptr_is_owned(_res)) return;
24721         void* _res_ptr = untag_ptr(_res);
24722         CHECK_ACCESS(_res_ptr);
24723         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
24724         FREE(untag_ptr(_res));
24725         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
24726 }
24727
24728 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
24729         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
24730         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
24731         return tag_ptr(ret_conv, true);
24732 }
24733 int64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
24734         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
24735         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
24736         return ret_conv;
24737 }
24738
24739 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint64_t orig) {
24740         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
24741         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
24742         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
24743         return tag_ptr(ret_conv, true);
24744 }
24745
24746 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_ok"))) TS_CResult_OnionMessageDecodeErrorZ_ok(uint64_t o) {
24747         LDKOnionMessage o_conv;
24748         o_conv.inner = untag_ptr(o);
24749         o_conv.is_owned = ptr_is_owned(o);
24750         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24751         o_conv = OnionMessage_clone(&o_conv);
24752         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
24753         *ret_conv = CResult_OnionMessageDecodeErrorZ_ok(o_conv);
24754         return tag_ptr(ret_conv, true);
24755 }
24756
24757 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_err"))) TS_CResult_OnionMessageDecodeErrorZ_err(uint64_t e) {
24758         void* e_ptr = untag_ptr(e);
24759         CHECK_ACCESS(e_ptr);
24760         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24761         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24762         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
24763         *ret_conv = CResult_OnionMessageDecodeErrorZ_err(e_conv);
24764         return tag_ptr(ret_conv, true);
24765 }
24766
24767 jboolean  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_is_ok"))) TS_CResult_OnionMessageDecodeErrorZ_is_ok(uint64_t o) {
24768         LDKCResult_OnionMessageDecodeErrorZ* o_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(o);
24769         jboolean ret_conv = CResult_OnionMessageDecodeErrorZ_is_ok(o_conv);
24770         return ret_conv;
24771 }
24772
24773 void  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_free"))) TS_CResult_OnionMessageDecodeErrorZ_free(uint64_t _res) {
24774         if (!ptr_is_owned(_res)) return;
24775         void* _res_ptr = untag_ptr(_res);
24776         CHECK_ACCESS(_res_ptr);
24777         LDKCResult_OnionMessageDecodeErrorZ _res_conv = *(LDKCResult_OnionMessageDecodeErrorZ*)(_res_ptr);
24778         FREE(untag_ptr(_res));
24779         CResult_OnionMessageDecodeErrorZ_free(_res_conv);
24780 }
24781
24782 static inline uint64_t CResult_OnionMessageDecodeErrorZ_clone_ptr(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR arg) {
24783         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
24784         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(arg);
24785         return tag_ptr(ret_conv, true);
24786 }
24787 int64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone_ptr"))) TS_CResult_OnionMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
24788         LDKCResult_OnionMessageDecodeErrorZ* arg_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(arg);
24789         int64_t ret_conv = CResult_OnionMessageDecodeErrorZ_clone_ptr(arg_conv);
24790         return ret_conv;
24791 }
24792
24793 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone"))) TS_CResult_OnionMessageDecodeErrorZ_clone(uint64_t orig) {
24794         LDKCResult_OnionMessageDecodeErrorZ* orig_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(orig);
24795         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
24796         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(orig_conv);
24797         return tag_ptr(ret_conv, true);
24798 }
24799
24800 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_ok"))) TS_CResult_PingDecodeErrorZ_ok(uint64_t o) {
24801         LDKPing o_conv;
24802         o_conv.inner = untag_ptr(o);
24803         o_conv.is_owned = ptr_is_owned(o);
24804         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24805         o_conv = Ping_clone(&o_conv);
24806         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
24807         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
24808         return tag_ptr(ret_conv, true);
24809 }
24810
24811 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_err"))) TS_CResult_PingDecodeErrorZ_err(uint64_t e) {
24812         void* e_ptr = untag_ptr(e);
24813         CHECK_ACCESS(e_ptr);
24814         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24815         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24816         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
24817         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
24818         return tag_ptr(ret_conv, true);
24819 }
24820
24821 jboolean  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_is_ok"))) TS_CResult_PingDecodeErrorZ_is_ok(uint64_t o) {
24822         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
24823         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
24824         return ret_conv;
24825 }
24826
24827 void  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_free"))) TS_CResult_PingDecodeErrorZ_free(uint64_t _res) {
24828         if (!ptr_is_owned(_res)) return;
24829         void* _res_ptr = untag_ptr(_res);
24830         CHECK_ACCESS(_res_ptr);
24831         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
24832         FREE(untag_ptr(_res));
24833         CResult_PingDecodeErrorZ_free(_res_conv);
24834 }
24835
24836 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
24837         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
24838         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
24839         return tag_ptr(ret_conv, true);
24840 }
24841 int64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone_ptr"))) TS_CResult_PingDecodeErrorZ_clone_ptr(uint64_t arg) {
24842         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
24843         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
24844         return ret_conv;
24845 }
24846
24847 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone"))) TS_CResult_PingDecodeErrorZ_clone(uint64_t orig) {
24848         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
24849         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
24850         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
24851         return tag_ptr(ret_conv, true);
24852 }
24853
24854 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_ok"))) TS_CResult_PongDecodeErrorZ_ok(uint64_t o) {
24855         LDKPong o_conv;
24856         o_conv.inner = untag_ptr(o);
24857         o_conv.is_owned = ptr_is_owned(o);
24858         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24859         o_conv = Pong_clone(&o_conv);
24860         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
24861         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
24862         return tag_ptr(ret_conv, true);
24863 }
24864
24865 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_err"))) TS_CResult_PongDecodeErrorZ_err(uint64_t e) {
24866         void* e_ptr = untag_ptr(e);
24867         CHECK_ACCESS(e_ptr);
24868         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24869         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24870         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
24871         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
24872         return tag_ptr(ret_conv, true);
24873 }
24874
24875 jboolean  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_is_ok"))) TS_CResult_PongDecodeErrorZ_is_ok(uint64_t o) {
24876         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
24877         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
24878         return ret_conv;
24879 }
24880
24881 void  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_free"))) TS_CResult_PongDecodeErrorZ_free(uint64_t _res) {
24882         if (!ptr_is_owned(_res)) return;
24883         void* _res_ptr = untag_ptr(_res);
24884         CHECK_ACCESS(_res_ptr);
24885         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
24886         FREE(untag_ptr(_res));
24887         CResult_PongDecodeErrorZ_free(_res_conv);
24888 }
24889
24890 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
24891         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
24892         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
24893         return tag_ptr(ret_conv, true);
24894 }
24895 int64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone_ptr"))) TS_CResult_PongDecodeErrorZ_clone_ptr(uint64_t arg) {
24896         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
24897         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
24898         return ret_conv;
24899 }
24900
24901 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone"))) TS_CResult_PongDecodeErrorZ_clone(uint64_t orig) {
24902         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
24903         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
24904         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
24905         return tag_ptr(ret_conv, true);
24906 }
24907
24908 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
24909         LDKUnsignedChannelAnnouncement o_conv;
24910         o_conv.inner = untag_ptr(o);
24911         o_conv.is_owned = ptr_is_owned(o);
24912         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24913         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
24914         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
24915         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
24916         return tag_ptr(ret_conv, true);
24917 }
24918
24919 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
24920         void* e_ptr = untag_ptr(e);
24921         CHECK_ACCESS(e_ptr);
24922         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24923         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24924         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
24925         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
24926         return tag_ptr(ret_conv, true);
24927 }
24928
24929 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
24930         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
24931         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
24932         return ret_conv;
24933 }
24934
24935 void  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
24936         if (!ptr_is_owned(_res)) return;
24937         void* _res_ptr = untag_ptr(_res);
24938         CHECK_ACCESS(_res_ptr);
24939         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
24940         FREE(untag_ptr(_res));
24941         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
24942 }
24943
24944 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
24945         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
24946         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
24947         return tag_ptr(ret_conv, true);
24948 }
24949 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
24950         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
24951         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
24952         return ret_conv;
24953 }
24954
24955 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
24956         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
24957         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
24958         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
24959         return tag_ptr(ret_conv, true);
24960 }
24961
24962 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
24963         LDKChannelAnnouncement o_conv;
24964         o_conv.inner = untag_ptr(o);
24965         o_conv.is_owned = ptr_is_owned(o);
24966         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24967         o_conv = ChannelAnnouncement_clone(&o_conv);
24968         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
24969         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
24970         return tag_ptr(ret_conv, true);
24971 }
24972
24973 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
24974         void* e_ptr = untag_ptr(e);
24975         CHECK_ACCESS(e_ptr);
24976         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24977         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24978         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
24979         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
24980         return tag_ptr(ret_conv, true);
24981 }
24982
24983 jboolean  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
24984         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
24985         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
24986         return ret_conv;
24987 }
24988
24989 void  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
24990         if (!ptr_is_owned(_res)) return;
24991         void* _res_ptr = untag_ptr(_res);
24992         CHECK_ACCESS(_res_ptr);
24993         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
24994         FREE(untag_ptr(_res));
24995         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
24996 }
24997
24998 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
24999         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
25000         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
25001         return tag_ptr(ret_conv, true);
25002 }
25003 int64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
25004         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
25005         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
25006         return ret_conv;
25007 }
25008
25009 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
25010         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
25011         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
25012         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
25013         return tag_ptr(ret_conv, true);
25014 }
25015
25016 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint64_t o) {
25017         LDKUnsignedChannelUpdate o_conv;
25018         o_conv.inner = untag_ptr(o);
25019         o_conv.is_owned = ptr_is_owned(o);
25020         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25021         o_conv = UnsignedChannelUpdate_clone(&o_conv);
25022         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
25023         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
25024         return tag_ptr(ret_conv, true);
25025 }
25026
25027 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint64_t e) {
25028         void* e_ptr = untag_ptr(e);
25029         CHECK_ACCESS(e_ptr);
25030         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25031         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25032         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
25033         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
25034         return tag_ptr(ret_conv, true);
25035 }
25036
25037 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
25038         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
25039         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
25040         return ret_conv;
25041 }
25042
25043 void  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint64_t _res) {
25044         if (!ptr_is_owned(_res)) return;
25045         void* _res_ptr = untag_ptr(_res);
25046         CHECK_ACCESS(_res_ptr);
25047         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
25048         FREE(untag_ptr(_res));
25049         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
25050 }
25051
25052 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
25053         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
25054         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
25055         return tag_ptr(ret_conv, true);
25056 }
25057 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
25058         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
25059         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
25060         return ret_conv;
25061 }
25062
25063 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
25064         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
25065         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
25066         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
25067         return tag_ptr(ret_conv, true);
25068 }
25069
25070 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint64_t o) {
25071         LDKChannelUpdate o_conv;
25072         o_conv.inner = untag_ptr(o);
25073         o_conv.is_owned = ptr_is_owned(o);
25074         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25075         o_conv = ChannelUpdate_clone(&o_conv);
25076         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
25077         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
25078         return tag_ptr(ret_conv, true);
25079 }
25080
25081 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint64_t e) {
25082         void* e_ptr = untag_ptr(e);
25083         CHECK_ACCESS(e_ptr);
25084         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25085         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25086         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
25087         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
25088         return tag_ptr(ret_conv, true);
25089 }
25090
25091 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
25092         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
25093         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
25094         return ret_conv;
25095 }
25096
25097 void  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_free"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint64_t _res) {
25098         if (!ptr_is_owned(_res)) return;
25099         void* _res_ptr = untag_ptr(_res);
25100         CHECK_ACCESS(_res_ptr);
25101         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
25102         FREE(untag_ptr(_res));
25103         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
25104 }
25105
25106 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
25107         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
25108         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
25109         return tag_ptr(ret_conv, true);
25110 }
25111 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
25112         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
25113         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
25114         return ret_conv;
25115 }
25116
25117 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
25118         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
25119         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
25120         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
25121         return tag_ptr(ret_conv, true);
25122 }
25123
25124 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint64_t o) {
25125         LDKErrorMessage o_conv;
25126         o_conv.inner = untag_ptr(o);
25127         o_conv.is_owned = ptr_is_owned(o);
25128         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25129         o_conv = ErrorMessage_clone(&o_conv);
25130         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
25131         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
25132         return tag_ptr(ret_conv, true);
25133 }
25134
25135 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_err"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint64_t e) {
25136         void* e_ptr = untag_ptr(e);
25137         CHECK_ACCESS(e_ptr);
25138         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25139         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25140         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
25141         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
25142         return tag_ptr(ret_conv, true);
25143 }
25144
25145 jboolean  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_is_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_is_ok(uint64_t o) {
25146         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
25147         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
25148         return ret_conv;
25149 }
25150
25151 void  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_free"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint64_t _res) {
25152         if (!ptr_is_owned(_res)) return;
25153         void* _res_ptr = untag_ptr(_res);
25154         CHECK_ACCESS(_res_ptr);
25155         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
25156         FREE(untag_ptr(_res));
25157         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
25158 }
25159
25160 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
25161         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
25162         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
25163         return tag_ptr(ret_conv, true);
25164 }
25165 int64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr"))) TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
25166         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
25167         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
25168         return ret_conv;
25169 }
25170
25171 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint64_t orig) {
25172         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
25173         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
25174         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
25175         return tag_ptr(ret_conv, true);
25176 }
25177
25178 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_ok"))) TS_CResult_WarningMessageDecodeErrorZ_ok(uint64_t o) {
25179         LDKWarningMessage o_conv;
25180         o_conv.inner = untag_ptr(o);
25181         o_conv.is_owned = ptr_is_owned(o);
25182         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25183         o_conv = WarningMessage_clone(&o_conv);
25184         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
25185         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
25186         return tag_ptr(ret_conv, true);
25187 }
25188
25189 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_err"))) TS_CResult_WarningMessageDecodeErrorZ_err(uint64_t e) {
25190         void* e_ptr = untag_ptr(e);
25191         CHECK_ACCESS(e_ptr);
25192         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25193         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25194         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
25195         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
25196         return tag_ptr(ret_conv, true);
25197 }
25198
25199 jboolean  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_is_ok"))) TS_CResult_WarningMessageDecodeErrorZ_is_ok(uint64_t o) {
25200         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
25201         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
25202         return ret_conv;
25203 }
25204
25205 void  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_free"))) TS_CResult_WarningMessageDecodeErrorZ_free(uint64_t _res) {
25206         if (!ptr_is_owned(_res)) return;
25207         void* _res_ptr = untag_ptr(_res);
25208         CHECK_ACCESS(_res_ptr);
25209         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
25210         FREE(untag_ptr(_res));
25211         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
25212 }
25213
25214 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
25215         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
25216         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
25217         return tag_ptr(ret_conv, true);
25218 }
25219 int64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone_ptr"))) TS_CResult_WarningMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
25220         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
25221         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
25222         return ret_conv;
25223 }
25224
25225 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone"))) TS_CResult_WarningMessageDecodeErrorZ_clone(uint64_t orig) {
25226         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
25227         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
25228         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
25229         return tag_ptr(ret_conv, true);
25230 }
25231
25232 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
25233         LDKUnsignedNodeAnnouncement o_conv;
25234         o_conv.inner = untag_ptr(o);
25235         o_conv.is_owned = ptr_is_owned(o);
25236         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25237         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
25238         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
25239         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
25240         return tag_ptr(ret_conv, true);
25241 }
25242
25243 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint64_t e) {
25244         void* e_ptr = untag_ptr(e);
25245         CHECK_ACCESS(e_ptr);
25246         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25247         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25248         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
25249         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
25250         return tag_ptr(ret_conv, true);
25251 }
25252
25253 jboolean  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
25254         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
25255         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
25256         return ret_conv;
25257 }
25258
25259 void  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
25260         if (!ptr_is_owned(_res)) return;
25261         void* _res_ptr = untag_ptr(_res);
25262         CHECK_ACCESS(_res_ptr);
25263         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
25264         FREE(untag_ptr(_res));
25265         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
25266 }
25267
25268 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
25269         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
25270         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
25271         return tag_ptr(ret_conv, true);
25272 }
25273 int64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
25274         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
25275         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
25276         return ret_conv;
25277 }
25278
25279 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
25280         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
25281         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
25282         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
25283         return tag_ptr(ret_conv, true);
25284 }
25285
25286 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
25287         LDKNodeAnnouncement o_conv;
25288         o_conv.inner = untag_ptr(o);
25289         o_conv.is_owned = ptr_is_owned(o);
25290         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25291         o_conv = NodeAnnouncement_clone(&o_conv);
25292         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
25293         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
25294         return tag_ptr(ret_conv, true);
25295 }
25296
25297 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint64_t e) {
25298         void* e_ptr = untag_ptr(e);
25299         CHECK_ACCESS(e_ptr);
25300         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25301         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25302         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
25303         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
25304         return tag_ptr(ret_conv, true);
25305 }
25306
25307 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
25308         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
25309         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
25310         return ret_conv;
25311 }
25312
25313 void  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
25314         if (!ptr_is_owned(_res)) return;
25315         void* _res_ptr = untag_ptr(_res);
25316         CHECK_ACCESS(_res_ptr);
25317         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
25318         FREE(untag_ptr(_res));
25319         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
25320 }
25321
25322 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
25323         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
25324         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
25325         return tag_ptr(ret_conv, true);
25326 }
25327 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
25328         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
25329         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
25330         return ret_conv;
25331 }
25332
25333 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
25334         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
25335         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
25336         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
25337         return tag_ptr(ret_conv, true);
25338 }
25339
25340 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint64_t o) {
25341         LDKQueryShortChannelIds o_conv;
25342         o_conv.inner = untag_ptr(o);
25343         o_conv.is_owned = ptr_is_owned(o);
25344         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25345         o_conv = QueryShortChannelIds_clone(&o_conv);
25346         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
25347         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
25348         return tag_ptr(ret_conv, true);
25349 }
25350
25351 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint64_t e) {
25352         void* e_ptr = untag_ptr(e);
25353         CHECK_ACCESS(e_ptr);
25354         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25355         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25356         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
25357         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
25358         return tag_ptr(ret_conv, true);
25359 }
25360
25361 jboolean  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(uint64_t o) {
25362         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
25363         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
25364         return ret_conv;
25365 }
25366
25367 void  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_free"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint64_t _res) {
25368         if (!ptr_is_owned(_res)) return;
25369         void* _res_ptr = untag_ptr(_res);
25370         CHECK_ACCESS(_res_ptr);
25371         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
25372         FREE(untag_ptr(_res));
25373         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
25374 }
25375
25376 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
25377         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
25378         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
25379         return tag_ptr(ret_conv, true);
25380 }
25381 int64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(uint64_t arg) {
25382         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
25383         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
25384         return ret_conv;
25385 }
25386
25387 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint64_t orig) {
25388         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
25389         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
25390         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
25391         return tag_ptr(ret_conv, true);
25392 }
25393
25394 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint64_t o) {
25395         LDKReplyShortChannelIdsEnd o_conv;
25396         o_conv.inner = untag_ptr(o);
25397         o_conv.is_owned = ptr_is_owned(o);
25398         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25399         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
25400         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
25401         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
25402         return tag_ptr(ret_conv, true);
25403 }
25404
25405 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint64_t e) {
25406         void* e_ptr = untag_ptr(e);
25407         CHECK_ACCESS(e_ptr);
25408         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25409         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25410         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
25411         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
25412         return tag_ptr(ret_conv, true);
25413 }
25414
25415 jboolean  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(uint64_t o) {
25416         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
25417         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
25418         return ret_conv;
25419 }
25420
25421 void  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint64_t _res) {
25422         if (!ptr_is_owned(_res)) return;
25423         void* _res_ptr = untag_ptr(_res);
25424         CHECK_ACCESS(_res_ptr);
25425         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
25426         FREE(untag_ptr(_res));
25427         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
25428 }
25429
25430 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
25431         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
25432         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
25433         return tag_ptr(ret_conv, true);
25434 }
25435 int64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(uint64_t arg) {
25436         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
25437         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
25438         return ret_conv;
25439 }
25440
25441 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint64_t orig) {
25442         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
25443         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
25444         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
25445         return tag_ptr(ret_conv, true);
25446 }
25447
25448 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint64_t o) {
25449         LDKQueryChannelRange o_conv;
25450         o_conv.inner = untag_ptr(o);
25451         o_conv.is_owned = ptr_is_owned(o);
25452         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25453         o_conv = QueryChannelRange_clone(&o_conv);
25454         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
25455         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
25456         return tag_ptr(ret_conv, true);
25457 }
25458
25459 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint64_t e) {
25460         void* e_ptr = untag_ptr(e);
25461         CHECK_ACCESS(e_ptr);
25462         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25463         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25464         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
25465         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
25466         return tag_ptr(ret_conv, true);
25467 }
25468
25469 jboolean  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
25470         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
25471         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
25472         return ret_conv;
25473 }
25474
25475 void  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_free"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint64_t _res) {
25476         if (!ptr_is_owned(_res)) return;
25477         void* _res_ptr = untag_ptr(_res);
25478         CHECK_ACCESS(_res_ptr);
25479         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
25480         FREE(untag_ptr(_res));
25481         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
25482 }
25483
25484 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
25485         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
25486         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
25487         return tag_ptr(ret_conv, true);
25488 }
25489 int64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
25490         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
25491         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
25492         return ret_conv;
25493 }
25494
25495 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint64_t orig) {
25496         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
25497         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
25498         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
25499         return tag_ptr(ret_conv, true);
25500 }
25501
25502 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint64_t o) {
25503         LDKReplyChannelRange o_conv;
25504         o_conv.inner = untag_ptr(o);
25505         o_conv.is_owned = ptr_is_owned(o);
25506         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25507         o_conv = ReplyChannelRange_clone(&o_conv);
25508         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
25509         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
25510         return tag_ptr(ret_conv, true);
25511 }
25512
25513 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint64_t e) {
25514         void* e_ptr = untag_ptr(e);
25515         CHECK_ACCESS(e_ptr);
25516         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25517         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25518         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
25519         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
25520         return tag_ptr(ret_conv, true);
25521 }
25522
25523 jboolean  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
25524         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
25525         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
25526         return ret_conv;
25527 }
25528
25529 void  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_free"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint64_t _res) {
25530         if (!ptr_is_owned(_res)) return;
25531         void* _res_ptr = untag_ptr(_res);
25532         CHECK_ACCESS(_res_ptr);
25533         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
25534         FREE(untag_ptr(_res));
25535         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
25536 }
25537
25538 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
25539         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
25540         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
25541         return tag_ptr(ret_conv, true);
25542 }
25543 int64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
25544         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
25545         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
25546         return ret_conv;
25547 }
25548
25549 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint64_t orig) {
25550         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
25551         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
25552         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
25553         return tag_ptr(ret_conv, true);
25554 }
25555
25556 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint64_t o) {
25557         LDKGossipTimestampFilter o_conv;
25558         o_conv.inner = untag_ptr(o);
25559         o_conv.is_owned = ptr_is_owned(o);
25560         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25561         o_conv = GossipTimestampFilter_clone(&o_conv);
25562         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
25563         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
25564         return tag_ptr(ret_conv, true);
25565 }
25566
25567 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint64_t e) {
25568         void* e_ptr = untag_ptr(e);
25569         CHECK_ACCESS(e_ptr);
25570         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25571         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25572         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
25573         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
25574         return tag_ptr(ret_conv, true);
25575 }
25576
25577 jboolean  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(uint64_t o) {
25578         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
25579         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
25580         return ret_conv;
25581 }
25582
25583 void  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_free"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint64_t _res) {
25584         if (!ptr_is_owned(_res)) return;
25585         void* _res_ptr = untag_ptr(_res);
25586         CHECK_ACCESS(_res_ptr);
25587         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
25588         FREE(untag_ptr(_res));
25589         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
25590 }
25591
25592 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
25593         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
25594         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
25595         return tag_ptr(ret_conv, true);
25596 }
25597 int64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(uint64_t arg) {
25598         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
25599         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
25600         return ret_conv;
25601 }
25602
25603 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint64_t orig) {
25604         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
25605         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
25606         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
25607         return tag_ptr(ret_conv, true);
25608 }
25609
25610 void  __attribute__((export_name("TS_CVec_PhantomRouteHintsZ_free"))) TS_CVec_PhantomRouteHintsZ_free(uint64_tArray _res) {
25611         LDKCVec_PhantomRouteHintsZ _res_constr;
25612         _res_constr.datalen = _res->arr_len;
25613         if (_res_constr.datalen > 0)
25614                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
25615         else
25616                 _res_constr.data = NULL;
25617         uint64_t* _res_vals = _res->elems;
25618         for (size_t t = 0; t < _res_constr.datalen; t++) {
25619                 uint64_t _res_conv_19 = _res_vals[t];
25620                 LDKPhantomRouteHints _res_conv_19_conv;
25621                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
25622                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
25623                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
25624                 _res_constr.data[t] = _res_conv_19_conv;
25625         }
25626         FREE(_res);
25627         CVec_PhantomRouteHintsZ_free(_res_constr);
25628 }
25629
25630 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_ok"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(uint64_t o) {
25631         LDKBolt11Invoice o_conv;
25632         o_conv.inner = untag_ptr(o);
25633         o_conv.is_owned = ptr_is_owned(o);
25634         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25635         o_conv = Bolt11Invoice_clone(&o_conv);
25636         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
25637         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o_conv);
25638         return tag_ptr(ret_conv, true);
25639 }
25640
25641 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_err"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_err(uint64_t e) {
25642         void* e_ptr = untag_ptr(e);
25643         CHECK_ACCESS(e_ptr);
25644         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
25645         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
25646         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
25647         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e_conv);
25648         return tag_ptr(ret_conv, true);
25649 }
25650
25651 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(uint64_t o) {
25652         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(o);
25653         jboolean ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o_conv);
25654         return ret_conv;
25655 }
25656
25657 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_free"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_free(uint64_t _res) {
25658         if (!ptr_is_owned(_res)) return;
25659         void* _res_ptr = untag_ptr(_res);
25660         CHECK_ACCESS(_res_ptr);
25661         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)(_res_ptr);
25662         FREE(untag_ptr(_res));
25663         CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res_conv);
25664 }
25665
25666 static inline uint64_t CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
25667         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
25668         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(arg);
25669         return tag_ptr(ret_conv, true);
25670 }
25671 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(uint64_t arg) {
25672         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
25673         int64_t ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
25674         return ret_conv;
25675 }
25676
25677 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(uint64_t orig) {
25678         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
25679         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
25680         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig_conv);
25681         return tag_ptr(ret_conv, true);
25682 }
25683
25684 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_ok"))) TS_CResult_OffersMessageDecodeErrorZ_ok(uint64_t o) {
25685         void* o_ptr = untag_ptr(o);
25686         CHECK_ACCESS(o_ptr);
25687         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
25688         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
25689         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
25690         *ret_conv = CResult_OffersMessageDecodeErrorZ_ok(o_conv);
25691         return tag_ptr(ret_conv, true);
25692 }
25693
25694 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_err"))) TS_CResult_OffersMessageDecodeErrorZ_err(uint64_t e) {
25695         void* e_ptr = untag_ptr(e);
25696         CHECK_ACCESS(e_ptr);
25697         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25698         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25699         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
25700         *ret_conv = CResult_OffersMessageDecodeErrorZ_err(e_conv);
25701         return tag_ptr(ret_conv, true);
25702 }
25703
25704 jboolean  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_is_ok"))) TS_CResult_OffersMessageDecodeErrorZ_is_ok(uint64_t o) {
25705         LDKCResult_OffersMessageDecodeErrorZ* o_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(o);
25706         jboolean ret_conv = CResult_OffersMessageDecodeErrorZ_is_ok(o_conv);
25707         return ret_conv;
25708 }
25709
25710 void  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_free"))) TS_CResult_OffersMessageDecodeErrorZ_free(uint64_t _res) {
25711         if (!ptr_is_owned(_res)) return;
25712         void* _res_ptr = untag_ptr(_res);
25713         CHECK_ACCESS(_res_ptr);
25714         LDKCResult_OffersMessageDecodeErrorZ _res_conv = *(LDKCResult_OffersMessageDecodeErrorZ*)(_res_ptr);
25715         FREE(untag_ptr(_res));
25716         CResult_OffersMessageDecodeErrorZ_free(_res_conv);
25717 }
25718
25719 static inline uint64_t CResult_OffersMessageDecodeErrorZ_clone_ptr(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR arg) {
25720         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
25721         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(arg);
25722         return tag_ptr(ret_conv, true);
25723 }
25724 int64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_clone_ptr"))) TS_CResult_OffersMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
25725         LDKCResult_OffersMessageDecodeErrorZ* arg_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(arg);
25726         int64_t ret_conv = CResult_OffersMessageDecodeErrorZ_clone_ptr(arg_conv);
25727         return ret_conv;
25728 }
25729
25730 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_clone"))) TS_CResult_OffersMessageDecodeErrorZ_clone(uint64_t orig) {
25731         LDKCResult_OffersMessageDecodeErrorZ* orig_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(orig);
25732         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
25733         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(orig_conv);
25734         return tag_ptr(ret_conv, true);
25735 }
25736
25737 uint64_t  __attribute__((export_name("TS_COption_HTLCClaimZ_some"))) TS_COption_HTLCClaimZ_some(uint32_t o) {
25738         LDKHTLCClaim o_conv = LDKHTLCClaim_from_js(o);
25739         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
25740         *ret_copy = COption_HTLCClaimZ_some(o_conv);
25741         uint64_t ret_ref = tag_ptr(ret_copy, true);
25742         return ret_ref;
25743 }
25744
25745 uint64_t  __attribute__((export_name("TS_COption_HTLCClaimZ_none"))) TS_COption_HTLCClaimZ_none() {
25746         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
25747         *ret_copy = COption_HTLCClaimZ_none();
25748         uint64_t ret_ref = tag_ptr(ret_copy, true);
25749         return ret_ref;
25750 }
25751
25752 void  __attribute__((export_name("TS_COption_HTLCClaimZ_free"))) TS_COption_HTLCClaimZ_free(uint64_t _res) {
25753         if (!ptr_is_owned(_res)) return;
25754         void* _res_ptr = untag_ptr(_res);
25755         CHECK_ACCESS(_res_ptr);
25756         LDKCOption_HTLCClaimZ _res_conv = *(LDKCOption_HTLCClaimZ*)(_res_ptr);
25757         FREE(untag_ptr(_res));
25758         COption_HTLCClaimZ_free(_res_conv);
25759 }
25760
25761 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(uint64_t o) {
25762         LDKCounterpartyCommitmentSecrets o_conv;
25763         o_conv.inner = untag_ptr(o);
25764         o_conv.is_owned = ptr_is_owned(o);
25765         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25766         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
25767         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
25768         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
25769         return tag_ptr(ret_conv, true);
25770 }
25771
25772 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(uint64_t e) {
25773         void* e_ptr = untag_ptr(e);
25774         CHECK_ACCESS(e_ptr);
25775         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25776         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25777         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
25778         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
25779         return tag_ptr(ret_conv, true);
25780 }
25781
25782 jboolean  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(uint64_t o) {
25783         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
25784         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
25785         return ret_conv;
25786 }
25787
25788 void  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(uint64_t _res) {
25789         if (!ptr_is_owned(_res)) return;
25790         void* _res_ptr = untag_ptr(_res);
25791         CHECK_ACCESS(_res_ptr);
25792         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
25793         FREE(untag_ptr(_res));
25794         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
25795 }
25796
25797 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
25798         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
25799         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
25800         return tag_ptr(ret_conv, true);
25801 }
25802 int64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(uint64_t arg) {
25803         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
25804         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
25805         return ret_conv;
25806 }
25807
25808 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(uint64_t orig) {
25809         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
25810         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
25811         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
25812         return tag_ptr(ret_conv, true);
25813 }
25814
25815 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint64_t o) {
25816         LDKTxCreationKeys o_conv;
25817         o_conv.inner = untag_ptr(o);
25818         o_conv.is_owned = ptr_is_owned(o);
25819         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25820         o_conv = TxCreationKeys_clone(&o_conv);
25821         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
25822         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
25823         return tag_ptr(ret_conv, true);
25824 }
25825
25826 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint64_t e) {
25827         void* e_ptr = untag_ptr(e);
25828         CHECK_ACCESS(e_ptr);
25829         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25830         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25831         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
25832         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
25833         return tag_ptr(ret_conv, true);
25834 }
25835
25836 jboolean  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_is_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_is_ok(uint64_t o) {
25837         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
25838         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
25839         return ret_conv;
25840 }
25841
25842 void  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_free"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint64_t _res) {
25843         if (!ptr_is_owned(_res)) return;
25844         void* _res_ptr = untag_ptr(_res);
25845         CHECK_ACCESS(_res_ptr);
25846         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
25847         FREE(untag_ptr(_res));
25848         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
25849 }
25850
25851 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
25852         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
25853         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
25854         return tag_ptr(ret_conv, true);
25855 }
25856 int64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
25857         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
25858         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
25859         return ret_conv;
25860 }
25861
25862 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint64_t orig) {
25863         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
25864         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
25865         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
25866         return tag_ptr(ret_conv, true);
25867 }
25868
25869 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint64_t o) {
25870         LDKChannelPublicKeys o_conv;
25871         o_conv.inner = untag_ptr(o);
25872         o_conv.is_owned = ptr_is_owned(o);
25873         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25874         o_conv = ChannelPublicKeys_clone(&o_conv);
25875         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
25876         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
25877         return tag_ptr(ret_conv, true);
25878 }
25879
25880 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint64_t e) {
25881         void* e_ptr = untag_ptr(e);
25882         CHECK_ACCESS(e_ptr);
25883         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25884         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25885         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
25886         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
25887         return tag_ptr(ret_conv, true);
25888 }
25889
25890 jboolean  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok(uint64_t o) {
25891         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
25892         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
25893         return ret_conv;
25894 }
25895
25896 void  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_free"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint64_t _res) {
25897         if (!ptr_is_owned(_res)) return;
25898         void* _res_ptr = untag_ptr(_res);
25899         CHECK_ACCESS(_res_ptr);
25900         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
25901         FREE(untag_ptr(_res));
25902         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
25903 }
25904
25905 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
25906         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
25907         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
25908         return tag_ptr(ret_conv, true);
25909 }
25910 int64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
25911         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
25912         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
25913         return ret_conv;
25914 }
25915
25916 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint64_t orig) {
25917         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
25918         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
25919         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
25920         return tag_ptr(ret_conv, true);
25921 }
25922
25923 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint64_t o) {
25924         LDKHTLCOutputInCommitment o_conv;
25925         o_conv.inner = untag_ptr(o);
25926         o_conv.is_owned = ptr_is_owned(o);
25927         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25928         o_conv = HTLCOutputInCommitment_clone(&o_conv);
25929         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
25930         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
25931         return tag_ptr(ret_conv, true);
25932 }
25933
25934 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint64_t e) {
25935         void* e_ptr = untag_ptr(e);
25936         CHECK_ACCESS(e_ptr);
25937         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25938         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25939         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
25940         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
25941         return tag_ptr(ret_conv, true);
25942 }
25943
25944 jboolean  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(uint64_t o) {
25945         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
25946         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
25947         return ret_conv;
25948 }
25949
25950 void  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint64_t _res) {
25951         if (!ptr_is_owned(_res)) return;
25952         void* _res_ptr = untag_ptr(_res);
25953         CHECK_ACCESS(_res_ptr);
25954         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
25955         FREE(untag_ptr(_res));
25956         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
25957 }
25958
25959 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
25960         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
25961         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
25962         return tag_ptr(ret_conv, true);
25963 }
25964 int64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(uint64_t arg) {
25965         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
25966         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
25967         return ret_conv;
25968 }
25969
25970 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint64_t orig) {
25971         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
25972         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
25973         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
25974         return tag_ptr(ret_conv, true);
25975 }
25976
25977 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
25978         LDKCounterpartyChannelTransactionParameters o_conv;
25979         o_conv.inner = untag_ptr(o);
25980         o_conv.is_owned = ptr_is_owned(o);
25981         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25982         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
25983         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
25984         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
25985         return tag_ptr(ret_conv, true);
25986 }
25987
25988 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
25989         void* e_ptr = untag_ptr(e);
25990         CHECK_ACCESS(e_ptr);
25991         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25992         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25993         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
25994         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
25995         return tag_ptr(ret_conv, true);
25996 }
25997
25998 jboolean  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
25999         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
26000         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
26001         return ret_conv;
26002 }
26003
26004 void  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
26005         if (!ptr_is_owned(_res)) return;
26006         void* _res_ptr = untag_ptr(_res);
26007         CHECK_ACCESS(_res_ptr);
26008         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
26009         FREE(untag_ptr(_res));
26010         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
26011 }
26012
26013 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
26014         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
26015         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
26016         return tag_ptr(ret_conv, true);
26017 }
26018 int64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
26019         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
26020         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
26021         return ret_conv;
26022 }
26023
26024 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
26025         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
26026         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
26027         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
26028         return tag_ptr(ret_conv, true);
26029 }
26030
26031 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
26032         LDKChannelTransactionParameters o_conv;
26033         o_conv.inner = untag_ptr(o);
26034         o_conv.is_owned = ptr_is_owned(o);
26035         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26036         o_conv = ChannelTransactionParameters_clone(&o_conv);
26037         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
26038         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
26039         return tag_ptr(ret_conv, true);
26040 }
26041
26042 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
26043         void* e_ptr = untag_ptr(e);
26044         CHECK_ACCESS(e_ptr);
26045         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26046         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26047         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
26048         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
26049         return tag_ptr(ret_conv, true);
26050 }
26051
26052 jboolean  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
26053         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
26054         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
26055         return ret_conv;
26056 }
26057
26058 void  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
26059         if (!ptr_is_owned(_res)) return;
26060         void* _res_ptr = untag_ptr(_res);
26061         CHECK_ACCESS(_res_ptr);
26062         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
26063         FREE(untag_ptr(_res));
26064         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
26065 }
26066
26067 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
26068         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
26069         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
26070         return tag_ptr(ret_conv, true);
26071 }
26072 int64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
26073         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
26074         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
26075         return ret_conv;
26076 }
26077
26078 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
26079         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
26080         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
26081         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
26082         return tag_ptr(ret_conv, true);
26083 }
26084
26085 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
26086         LDKHolderCommitmentTransaction o_conv;
26087         o_conv.inner = untag_ptr(o);
26088         o_conv.is_owned = ptr_is_owned(o);
26089         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26090         o_conv = HolderCommitmentTransaction_clone(&o_conv);
26091         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
26092         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
26093         return tag_ptr(ret_conv, true);
26094 }
26095
26096 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
26097         void* e_ptr = untag_ptr(e);
26098         CHECK_ACCESS(e_ptr);
26099         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26100         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26101         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
26102         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
26103         return tag_ptr(ret_conv, true);
26104 }
26105
26106 jboolean  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
26107         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
26108         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
26109         return ret_conv;
26110 }
26111
26112 void  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
26113         if (!ptr_is_owned(_res)) return;
26114         void* _res_ptr = untag_ptr(_res);
26115         CHECK_ACCESS(_res_ptr);
26116         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
26117         FREE(untag_ptr(_res));
26118         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
26119 }
26120
26121 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
26122         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
26123         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
26124         return tag_ptr(ret_conv, true);
26125 }
26126 int64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
26127         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
26128         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
26129         return ret_conv;
26130 }
26131
26132 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
26133         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
26134         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
26135         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
26136         return tag_ptr(ret_conv, true);
26137 }
26138
26139 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
26140         LDKBuiltCommitmentTransaction o_conv;
26141         o_conv.inner = untag_ptr(o);
26142         o_conv.is_owned = ptr_is_owned(o);
26143         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26144         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
26145         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
26146         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
26147         return tag_ptr(ret_conv, true);
26148 }
26149
26150 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
26151         void* e_ptr = untag_ptr(e);
26152         CHECK_ACCESS(e_ptr);
26153         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26154         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26155         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
26156         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
26157         return tag_ptr(ret_conv, true);
26158 }
26159
26160 jboolean  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
26161         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
26162         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
26163         return ret_conv;
26164 }
26165
26166 void  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
26167         if (!ptr_is_owned(_res)) return;
26168         void* _res_ptr = untag_ptr(_res);
26169         CHECK_ACCESS(_res_ptr);
26170         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
26171         FREE(untag_ptr(_res));
26172         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
26173 }
26174
26175 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
26176         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
26177         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
26178         return tag_ptr(ret_conv, true);
26179 }
26180 int64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
26181         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
26182         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
26183         return ret_conv;
26184 }
26185
26186 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
26187         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
26188         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
26189         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
26190         return tag_ptr(ret_conv, true);
26191 }
26192
26193 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint64_t o) {
26194         LDKTrustedClosingTransaction o_conv;
26195         o_conv.inner = untag_ptr(o);
26196         o_conv.is_owned = ptr_is_owned(o);
26197         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26198         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
26199         
26200         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
26201         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
26202         return tag_ptr(ret_conv, true);
26203 }
26204
26205 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_err"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
26206         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
26207         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
26208         return tag_ptr(ret_conv, true);
26209 }
26210
26211 jboolean  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_is_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_is_ok(uint64_t o) {
26212         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
26213         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
26214         return ret_conv;
26215 }
26216
26217 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_free"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint64_t _res) {
26218         if (!ptr_is_owned(_res)) return;
26219         void* _res_ptr = untag_ptr(_res);
26220         CHECK_ACCESS(_res_ptr);
26221         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
26222         FREE(untag_ptr(_res));
26223         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
26224 }
26225
26226 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
26227         LDKCommitmentTransaction o_conv;
26228         o_conv.inner = untag_ptr(o);
26229         o_conv.is_owned = ptr_is_owned(o);
26230         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26231         o_conv = CommitmentTransaction_clone(&o_conv);
26232         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
26233         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
26234         return tag_ptr(ret_conv, true);
26235 }
26236
26237 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint64_t e) {
26238         void* e_ptr = untag_ptr(e);
26239         CHECK_ACCESS(e_ptr);
26240         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26241         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26242         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
26243         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
26244         return tag_ptr(ret_conv, true);
26245 }
26246
26247 jboolean  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
26248         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
26249         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
26250         return ret_conv;
26251 }
26252
26253 void  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_free"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
26254         if (!ptr_is_owned(_res)) return;
26255         void* _res_ptr = untag_ptr(_res);
26256         CHECK_ACCESS(_res_ptr);
26257         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
26258         FREE(untag_ptr(_res));
26259         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
26260 }
26261
26262 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
26263         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
26264         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
26265         return tag_ptr(ret_conv, true);
26266 }
26267 int64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
26268         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
26269         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
26270         return ret_conv;
26271 }
26272
26273 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
26274         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
26275         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
26276         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
26277         return tag_ptr(ret_conv, true);
26278 }
26279
26280 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint64_t o) {
26281         LDKTrustedCommitmentTransaction o_conv;
26282         o_conv.inner = untag_ptr(o);
26283         o_conv.is_owned = ptr_is_owned(o);
26284         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26285         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
26286         
26287         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
26288         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
26289         return tag_ptr(ret_conv, true);
26290 }
26291
26292 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
26293         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
26294         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
26295         return tag_ptr(ret_conv, true);
26296 }
26297
26298 jboolean  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok(uint64_t o) {
26299         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
26300         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
26301         return ret_conv;
26302 }
26303
26304 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_free"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint64_t _res) {
26305         if (!ptr_is_owned(_res)) return;
26306         void* _res_ptr = untag_ptr(_res);
26307         CHECK_ACCESS(_res_ptr);
26308         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
26309         FREE(untag_ptr(_res));
26310         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
26311 }
26312
26313 uint64_t  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_ok"))) TS_CResult_CVec_ECDSASignatureZNoneZ_ok(ptrArray o) {
26314         LDKCVec_ECDSASignatureZ o_constr;
26315         o_constr.datalen = o->arr_len;
26316         if (o_constr.datalen > 0)
26317                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
26318         else
26319                 o_constr.data = NULL;
26320         int8_tArray* o_vals = (void*) o->elems;
26321         for (size_t m = 0; m < o_constr.datalen; m++) {
26322                 int8_tArray o_conv_12 = o_vals[m];
26323                 LDKECDSASignature o_conv_12_ref;
26324                 CHECK(o_conv_12->arr_len == 64);
26325                 memcpy(o_conv_12_ref.compact_form, o_conv_12->elems, 64); FREE(o_conv_12);
26326                 o_constr.data[m] = o_conv_12_ref;
26327         }
26328         FREE(o);
26329         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
26330         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_ok(o_constr);
26331         return tag_ptr(ret_conv, true);
26332 }
26333
26334 uint64_t  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_err"))) TS_CResult_CVec_ECDSASignatureZNoneZ_err() {
26335         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
26336         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_err();
26337         return tag_ptr(ret_conv, true);
26338 }
26339
26340 jboolean  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_is_ok"))) TS_CResult_CVec_ECDSASignatureZNoneZ_is_ok(uint64_t o) {
26341         LDKCResult_CVec_ECDSASignatureZNoneZ* o_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(o);
26342         jboolean ret_conv = CResult_CVec_ECDSASignatureZNoneZ_is_ok(o_conv);
26343         return ret_conv;
26344 }
26345
26346 void  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_free"))) TS_CResult_CVec_ECDSASignatureZNoneZ_free(uint64_t _res) {
26347         if (!ptr_is_owned(_res)) return;
26348         void* _res_ptr = untag_ptr(_res);
26349         CHECK_ACCESS(_res_ptr);
26350         LDKCResult_CVec_ECDSASignatureZNoneZ _res_conv = *(LDKCResult_CVec_ECDSASignatureZNoneZ*)(_res_ptr);
26351         FREE(untag_ptr(_res));
26352         CResult_CVec_ECDSASignatureZNoneZ_free(_res_conv);
26353 }
26354
26355 static inline uint64_t CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR arg) {
26356         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
26357         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(arg);
26358         return tag_ptr(ret_conv, true);
26359 }
26360 int64_t  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_clone_ptr"))) TS_CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(uint64_t arg) {
26361         LDKCResult_CVec_ECDSASignatureZNoneZ* arg_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(arg);
26362         int64_t ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(arg_conv);
26363         return ret_conv;
26364 }
26365
26366 uint64_t  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_clone"))) TS_CResult_CVec_ECDSASignatureZNoneZ_clone(uint64_t orig) {
26367         LDKCResult_CVec_ECDSASignatureZNoneZ* orig_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(orig);
26368         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
26369         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(orig_conv);
26370         return tag_ptr(ret_conv, true);
26371 }
26372
26373 uint64_t  __attribute__((export_name("TS_COption_usizeZ_some"))) TS_COption_usizeZ_some(uint32_t o) {
26374         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
26375         *ret_copy = COption_usizeZ_some(o);
26376         uint64_t ret_ref = tag_ptr(ret_copy, true);
26377         return ret_ref;
26378 }
26379
26380 uint64_t  __attribute__((export_name("TS_COption_usizeZ_none"))) TS_COption_usizeZ_none() {
26381         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
26382         *ret_copy = COption_usizeZ_none();
26383         uint64_t ret_ref = tag_ptr(ret_copy, true);
26384         return ret_ref;
26385 }
26386
26387 void  __attribute__((export_name("TS_COption_usizeZ_free"))) TS_COption_usizeZ_free(uint64_t _res) {
26388         if (!ptr_is_owned(_res)) return;
26389         void* _res_ptr = untag_ptr(_res);
26390         CHECK_ACCESS(_res_ptr);
26391         LDKCOption_usizeZ _res_conv = *(LDKCOption_usizeZ*)(_res_ptr);
26392         FREE(untag_ptr(_res));
26393         COption_usizeZ_free(_res_conv);
26394 }
26395
26396 static inline uint64_t COption_usizeZ_clone_ptr(LDKCOption_usizeZ *NONNULL_PTR arg) {
26397         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
26398         *ret_copy = COption_usizeZ_clone(arg);
26399         uint64_t ret_ref = tag_ptr(ret_copy, true);
26400         return ret_ref;
26401 }
26402 int64_t  __attribute__((export_name("TS_COption_usizeZ_clone_ptr"))) TS_COption_usizeZ_clone_ptr(uint64_t arg) {
26403         LDKCOption_usizeZ* arg_conv = (LDKCOption_usizeZ*)untag_ptr(arg);
26404         int64_t ret_conv = COption_usizeZ_clone_ptr(arg_conv);
26405         return ret_conv;
26406 }
26407
26408 uint64_t  __attribute__((export_name("TS_COption_usizeZ_clone"))) TS_COption_usizeZ_clone(uint64_t orig) {
26409         LDKCOption_usizeZ* orig_conv = (LDKCOption_usizeZ*)untag_ptr(orig);
26410         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
26411         *ret_copy = COption_usizeZ_clone(orig_conv);
26412         uint64_t ret_ref = tag_ptr(ret_copy, true);
26413         return ret_ref;
26414 }
26415
26416 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint64_t o) {
26417         LDKShutdownScript o_conv;
26418         o_conv.inner = untag_ptr(o);
26419         o_conv.is_owned = ptr_is_owned(o);
26420         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26421         o_conv = ShutdownScript_clone(&o_conv);
26422         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
26423         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
26424         return tag_ptr(ret_conv, true);
26425 }
26426
26427 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint64_t e) {
26428         void* e_ptr = untag_ptr(e);
26429         CHECK_ACCESS(e_ptr);
26430         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26431         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26432         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
26433         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
26434         return tag_ptr(ret_conv, true);
26435 }
26436
26437 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_is_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_is_ok(uint64_t o) {
26438         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
26439         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
26440         return ret_conv;
26441 }
26442
26443 void  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_free"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint64_t _res) {
26444         if (!ptr_is_owned(_res)) return;
26445         void* _res_ptr = untag_ptr(_res);
26446         CHECK_ACCESS(_res_ptr);
26447         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
26448         FREE(untag_ptr(_res));
26449         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
26450 }
26451
26452 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
26453         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
26454         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
26455         return tag_ptr(ret_conv, true);
26456 }
26457 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr(uint64_t arg) {
26458         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
26459         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
26460         return ret_conv;
26461 }
26462
26463 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint64_t orig) {
26464         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
26465         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
26466         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
26467         return tag_ptr(ret_conv, true);
26468 }
26469
26470 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint64_t o) {
26471         LDKShutdownScript o_conv;
26472         o_conv.inner = untag_ptr(o);
26473         o_conv.is_owned = ptr_is_owned(o);
26474         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26475         o_conv = ShutdownScript_clone(&o_conv);
26476         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
26477         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
26478         return tag_ptr(ret_conv, true);
26479 }
26480
26481 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint64_t e) {
26482         LDKInvalidShutdownScript e_conv;
26483         e_conv.inner = untag_ptr(e);
26484         e_conv.is_owned = ptr_is_owned(e);
26485         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
26486         e_conv = InvalidShutdownScript_clone(&e_conv);
26487         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
26488         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
26489         return tag_ptr(ret_conv, true);
26490 }
26491
26492 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(uint64_t o) {
26493         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
26494         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
26495         return ret_conv;
26496 }
26497
26498 void  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint64_t _res) {
26499         if (!ptr_is_owned(_res)) return;
26500         void* _res_ptr = untag_ptr(_res);
26501         CHECK_ACCESS(_res_ptr);
26502         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
26503         FREE(untag_ptr(_res));
26504         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
26505 }
26506
26507 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
26508         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
26509         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
26510         return tag_ptr(ret_conv, true);
26511 }
26512 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(uint64_t arg) {
26513         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
26514         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
26515         return ret_conv;
26516 }
26517
26518 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(uint64_t orig) {
26519         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
26520         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
26521         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
26522         return tag_ptr(ret_conv, true);
26523 }
26524
26525 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_ok(uint64_t o) {
26526         void* o_ptr = untag_ptr(o);
26527         CHECK_ACCESS(o_ptr);
26528         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
26529         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
26530         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
26531         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
26532         return tag_ptr(ret_conv, true);
26533 }
26534
26535 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_err(uint64_t e) {
26536         void* e_ptr = untag_ptr(e);
26537         CHECK_ACCESS(e_ptr);
26538         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26539         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26540         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
26541         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
26542         return tag_ptr(ret_conv, true);
26543 }
26544
26545 jboolean  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_is_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_is_ok(uint64_t o) {
26546         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
26547         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
26548         return ret_conv;
26549 }
26550
26551 void  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_free"))) TS_CResult_PaymentPurposeDecodeErrorZ_free(uint64_t _res) {
26552         if (!ptr_is_owned(_res)) return;
26553         void* _res_ptr = untag_ptr(_res);
26554         CHECK_ACCESS(_res_ptr);
26555         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
26556         FREE(untag_ptr(_res));
26557         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
26558 }
26559
26560 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
26561         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
26562         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
26563         return tag_ptr(ret_conv, true);
26564 }
26565 int64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr(uint64_t arg) {
26566         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
26567         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
26568         return ret_conv;
26569 }
26570
26571 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone(uint64_t orig) {
26572         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
26573         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
26574         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
26575         return tag_ptr(ret_conv, true);
26576 }
26577
26578 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_ok"))) TS_CResult_ClaimedHTLCDecodeErrorZ_ok(uint64_t o) {
26579         LDKClaimedHTLC o_conv;
26580         o_conv.inner = untag_ptr(o);
26581         o_conv.is_owned = ptr_is_owned(o);
26582         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26583         o_conv = ClaimedHTLC_clone(&o_conv);
26584         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
26585         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_ok(o_conv);
26586         return tag_ptr(ret_conv, true);
26587 }
26588
26589 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_err"))) TS_CResult_ClaimedHTLCDecodeErrorZ_err(uint64_t e) {
26590         void* e_ptr = untag_ptr(e);
26591         CHECK_ACCESS(e_ptr);
26592         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26593         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26594         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
26595         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_err(e_conv);
26596         return tag_ptr(ret_conv, true);
26597 }
26598
26599 jboolean  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_is_ok"))) TS_CResult_ClaimedHTLCDecodeErrorZ_is_ok(uint64_t o) {
26600         LDKCResult_ClaimedHTLCDecodeErrorZ* o_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(o);
26601         jboolean ret_conv = CResult_ClaimedHTLCDecodeErrorZ_is_ok(o_conv);
26602         return ret_conv;
26603 }
26604
26605 void  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_free"))) TS_CResult_ClaimedHTLCDecodeErrorZ_free(uint64_t _res) {
26606         if (!ptr_is_owned(_res)) return;
26607         void* _res_ptr = untag_ptr(_res);
26608         CHECK_ACCESS(_res_ptr);
26609         LDKCResult_ClaimedHTLCDecodeErrorZ _res_conv = *(LDKCResult_ClaimedHTLCDecodeErrorZ*)(_res_ptr);
26610         FREE(untag_ptr(_res));
26611         CResult_ClaimedHTLCDecodeErrorZ_free(_res_conv);
26612 }
26613
26614 static inline uint64_t CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR arg) {
26615         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
26616         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(arg);
26617         return tag_ptr(ret_conv, true);
26618 }
26619 int64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
26620         LDKCResult_ClaimedHTLCDecodeErrorZ* arg_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(arg);
26621         int64_t ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(arg_conv);
26622         return ret_conv;
26623 }
26624
26625 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_clone"))) TS_CResult_ClaimedHTLCDecodeErrorZ_clone(uint64_t orig) {
26626         LDKCResult_ClaimedHTLCDecodeErrorZ* orig_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(orig);
26627         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
26628         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(orig_conv);
26629         return tag_ptr(ret_conv, true);
26630 }
26631
26632 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_some"))) TS_COption_PathFailureZ_some(uint64_t o) {
26633         void* o_ptr = untag_ptr(o);
26634         CHECK_ACCESS(o_ptr);
26635         LDKPathFailure o_conv = *(LDKPathFailure*)(o_ptr);
26636         o_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(o));
26637         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
26638         *ret_copy = COption_PathFailureZ_some(o_conv);
26639         uint64_t ret_ref = tag_ptr(ret_copy, true);
26640         return ret_ref;
26641 }
26642
26643 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_none"))) TS_COption_PathFailureZ_none() {
26644         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
26645         *ret_copy = COption_PathFailureZ_none();
26646         uint64_t ret_ref = tag_ptr(ret_copy, true);
26647         return ret_ref;
26648 }
26649
26650 void  __attribute__((export_name("TS_COption_PathFailureZ_free"))) TS_COption_PathFailureZ_free(uint64_t _res) {
26651         if (!ptr_is_owned(_res)) return;
26652         void* _res_ptr = untag_ptr(_res);
26653         CHECK_ACCESS(_res_ptr);
26654         LDKCOption_PathFailureZ _res_conv = *(LDKCOption_PathFailureZ*)(_res_ptr);
26655         FREE(untag_ptr(_res));
26656         COption_PathFailureZ_free(_res_conv);
26657 }
26658
26659 static inline uint64_t COption_PathFailureZ_clone_ptr(LDKCOption_PathFailureZ *NONNULL_PTR arg) {
26660         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
26661         *ret_copy = COption_PathFailureZ_clone(arg);
26662         uint64_t ret_ref = tag_ptr(ret_copy, true);
26663         return ret_ref;
26664 }
26665 int64_t  __attribute__((export_name("TS_COption_PathFailureZ_clone_ptr"))) TS_COption_PathFailureZ_clone_ptr(uint64_t arg) {
26666         LDKCOption_PathFailureZ* arg_conv = (LDKCOption_PathFailureZ*)untag_ptr(arg);
26667         int64_t ret_conv = COption_PathFailureZ_clone_ptr(arg_conv);
26668         return ret_conv;
26669 }
26670
26671 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_clone"))) TS_COption_PathFailureZ_clone(uint64_t orig) {
26672         LDKCOption_PathFailureZ* orig_conv = (LDKCOption_PathFailureZ*)untag_ptr(orig);
26673         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
26674         *ret_copy = COption_PathFailureZ_clone(orig_conv);
26675         uint64_t ret_ref = tag_ptr(ret_copy, true);
26676         return ret_ref;
26677 }
26678
26679 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_ok(uint64_t o) {
26680         void* o_ptr = untag_ptr(o);
26681         CHECK_ACCESS(o_ptr);
26682         LDKCOption_PathFailureZ o_conv = *(LDKCOption_PathFailureZ*)(o_ptr);
26683         o_conv = COption_PathFailureZ_clone((LDKCOption_PathFailureZ*)untag_ptr(o));
26684         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
26685         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_ok(o_conv);
26686         return tag_ptr(ret_conv, true);
26687 }
26688
26689 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_err"))) TS_CResult_COption_PathFailureZDecodeErrorZ_err(uint64_t e) {
26690         void* e_ptr = untag_ptr(e);
26691         CHECK_ACCESS(e_ptr);
26692         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26693         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26694         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
26695         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_err(e_conv);
26696         return tag_ptr(ret_conv, true);
26697 }
26698
26699 jboolean  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_is_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_is_ok(uint64_t o) {
26700         LDKCResult_COption_PathFailureZDecodeErrorZ* o_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(o);
26701         jboolean ret_conv = CResult_COption_PathFailureZDecodeErrorZ_is_ok(o_conv);
26702         return ret_conv;
26703 }
26704
26705 void  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_free"))) TS_CResult_COption_PathFailureZDecodeErrorZ_free(uint64_t _res) {
26706         if (!ptr_is_owned(_res)) return;
26707         void* _res_ptr = untag_ptr(_res);
26708         CHECK_ACCESS(_res_ptr);
26709         LDKCResult_COption_PathFailureZDecodeErrorZ _res_conv = *(LDKCResult_COption_PathFailureZDecodeErrorZ*)(_res_ptr);
26710         FREE(untag_ptr(_res));
26711         CResult_COption_PathFailureZDecodeErrorZ_free(_res_conv);
26712 }
26713
26714 static inline uint64_t CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR arg) {
26715         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
26716         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(arg);
26717         return tag_ptr(ret_conv, true);
26718 }
26719 int64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(uint64_t arg) {
26720         LDKCResult_COption_PathFailureZDecodeErrorZ* arg_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(arg);
26721         int64_t ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(arg_conv);
26722         return ret_conv;
26723 }
26724
26725 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_clone"))) TS_CResult_COption_PathFailureZDecodeErrorZ_clone(uint64_t orig) {
26726         LDKCResult_COption_PathFailureZDecodeErrorZ* orig_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(orig);
26727         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
26728         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(orig_conv);
26729         return tag_ptr(ret_conv, true);
26730 }
26731
26732 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_some"))) TS_COption_ClosureReasonZ_some(uint64_t o) {
26733         void* o_ptr = untag_ptr(o);
26734         CHECK_ACCESS(o_ptr);
26735         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
26736         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
26737         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
26738         *ret_copy = COption_ClosureReasonZ_some(o_conv);
26739         uint64_t ret_ref = tag_ptr(ret_copy, true);
26740         return ret_ref;
26741 }
26742
26743 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_none"))) TS_COption_ClosureReasonZ_none() {
26744         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
26745         *ret_copy = COption_ClosureReasonZ_none();
26746         uint64_t ret_ref = tag_ptr(ret_copy, true);
26747         return ret_ref;
26748 }
26749
26750 void  __attribute__((export_name("TS_COption_ClosureReasonZ_free"))) TS_COption_ClosureReasonZ_free(uint64_t _res) {
26751         if (!ptr_is_owned(_res)) return;
26752         void* _res_ptr = untag_ptr(_res);
26753         CHECK_ACCESS(_res_ptr);
26754         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
26755         FREE(untag_ptr(_res));
26756         COption_ClosureReasonZ_free(_res_conv);
26757 }
26758
26759 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
26760         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
26761         *ret_copy = COption_ClosureReasonZ_clone(arg);
26762         uint64_t ret_ref = tag_ptr(ret_copy, true);
26763         return ret_ref;
26764 }
26765 int64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone_ptr"))) TS_COption_ClosureReasonZ_clone_ptr(uint64_t arg) {
26766         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
26767         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
26768         return ret_conv;
26769 }
26770
26771 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone"))) TS_COption_ClosureReasonZ_clone(uint64_t orig) {
26772         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
26773         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
26774         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
26775         uint64_t ret_ref = tag_ptr(ret_copy, true);
26776         return ret_ref;
26777 }
26778
26779 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok(uint64_t o) {
26780         void* o_ptr = untag_ptr(o);
26781         CHECK_ACCESS(o_ptr);
26782         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
26783         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
26784         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
26785         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
26786         return tag_ptr(ret_conv, true);
26787 }
26788
26789 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_err(uint64_t e) {
26790         void* e_ptr = untag_ptr(e);
26791         CHECK_ACCESS(e_ptr);
26792         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26793         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26794         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
26795         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
26796         return tag_ptr(ret_conv, true);
26797 }
26798
26799 jboolean  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(uint64_t o) {
26800         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
26801         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
26802         return ret_conv;
26803 }
26804
26805 void  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_free"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_free(uint64_t _res) {
26806         if (!ptr_is_owned(_res)) return;
26807         void* _res_ptr = untag_ptr(_res);
26808         CHECK_ACCESS(_res_ptr);
26809         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
26810         FREE(untag_ptr(_res));
26811         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
26812 }
26813
26814 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
26815         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
26816         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
26817         return tag_ptr(ret_conv, true);
26818 }
26819 int64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(uint64_t arg) {
26820         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
26821         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
26822         return ret_conv;
26823 }
26824
26825 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone(uint64_t orig) {
26826         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
26827         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
26828         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
26829         return tag_ptr(ret_conv, true);
26830 }
26831
26832 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_some"))) TS_COption_HTLCDestinationZ_some(uint64_t o) {
26833         void* o_ptr = untag_ptr(o);
26834         CHECK_ACCESS(o_ptr);
26835         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
26836         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
26837         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
26838         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
26839         uint64_t ret_ref = tag_ptr(ret_copy, true);
26840         return ret_ref;
26841 }
26842
26843 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_none"))) TS_COption_HTLCDestinationZ_none() {
26844         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
26845         *ret_copy = COption_HTLCDestinationZ_none();
26846         uint64_t ret_ref = tag_ptr(ret_copy, true);
26847         return ret_ref;
26848 }
26849
26850 void  __attribute__((export_name("TS_COption_HTLCDestinationZ_free"))) TS_COption_HTLCDestinationZ_free(uint64_t _res) {
26851         if (!ptr_is_owned(_res)) return;
26852         void* _res_ptr = untag_ptr(_res);
26853         CHECK_ACCESS(_res_ptr);
26854         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
26855         FREE(untag_ptr(_res));
26856         COption_HTLCDestinationZ_free(_res_conv);
26857 }
26858
26859 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
26860         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
26861         *ret_copy = COption_HTLCDestinationZ_clone(arg);
26862         uint64_t ret_ref = tag_ptr(ret_copy, true);
26863         return ret_ref;
26864 }
26865 int64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone_ptr"))) TS_COption_HTLCDestinationZ_clone_ptr(uint64_t arg) {
26866         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
26867         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
26868         return ret_conv;
26869 }
26870
26871 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone"))) TS_COption_HTLCDestinationZ_clone(uint64_t orig) {
26872         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
26873         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
26874         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
26875         uint64_t ret_ref = tag_ptr(ret_copy, true);
26876         return ret_ref;
26877 }
26878
26879 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok(uint64_t o) {
26880         void* o_ptr = untag_ptr(o);
26881         CHECK_ACCESS(o_ptr);
26882         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
26883         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
26884         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
26885         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
26886         return tag_ptr(ret_conv, true);
26887 }
26888
26889 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err(uint64_t e) {
26890         void* e_ptr = untag_ptr(e);
26891         CHECK_ACCESS(e_ptr);
26892         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26893         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26894         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
26895         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
26896         return tag_ptr(ret_conv, true);
26897 }
26898
26899 jboolean  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(uint64_t o) {
26900         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
26901         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
26902         return ret_conv;
26903 }
26904
26905 void  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free(uint64_t _res) {
26906         if (!ptr_is_owned(_res)) return;
26907         void* _res_ptr = untag_ptr(_res);
26908         CHECK_ACCESS(_res_ptr);
26909         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
26910         FREE(untag_ptr(_res));
26911         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
26912 }
26913
26914 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
26915         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
26916         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
26917         return tag_ptr(ret_conv, true);
26918 }
26919 int64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(uint64_t arg) {
26920         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
26921         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
26922         return ret_conv;
26923 }
26924
26925 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone(uint64_t orig) {
26926         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
26927         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
26928         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
26929         return tag_ptr(ret_conv, true);
26930 }
26931
26932 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_ok"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_ok(uint32_t o) {
26933         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_js(o);
26934         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
26935         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_ok(o_conv);
26936         return tag_ptr(ret_conv, true);
26937 }
26938
26939 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_err"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_err(uint64_t e) {
26940         void* e_ptr = untag_ptr(e);
26941         CHECK_ACCESS(e_ptr);
26942         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26943         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26944         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
26945         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_err(e_conv);
26946         return tag_ptr(ret_conv, true);
26947 }
26948
26949 jboolean  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_is_ok"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_is_ok(uint64_t o) {
26950         LDKCResult_PaymentFailureReasonDecodeErrorZ* o_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(o);
26951         jboolean ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o_conv);
26952         return ret_conv;
26953 }
26954
26955 void  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_free"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_free(uint64_t _res) {
26956         if (!ptr_is_owned(_res)) return;
26957         void* _res_ptr = untag_ptr(_res);
26958         CHECK_ACCESS(_res_ptr);
26959         LDKCResult_PaymentFailureReasonDecodeErrorZ _res_conv = *(LDKCResult_PaymentFailureReasonDecodeErrorZ*)(_res_ptr);
26960         FREE(untag_ptr(_res));
26961         CResult_PaymentFailureReasonDecodeErrorZ_free(_res_conv);
26962 }
26963
26964 static inline uint64_t CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR arg) {
26965         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
26966         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(arg);
26967         return tag_ptr(ret_conv, true);
26968 }
26969 int64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(uint64_t arg) {
26970         LDKCResult_PaymentFailureReasonDecodeErrorZ* arg_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(arg);
26971         int64_t ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(arg_conv);
26972         return ret_conv;
26973 }
26974
26975 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_clone"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_clone(uint64_t orig) {
26976         LDKCResult_PaymentFailureReasonDecodeErrorZ* orig_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(orig);
26977         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
26978         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(orig_conv);
26979         return tag_ptr(ret_conv, true);
26980 }
26981
26982 uint64_t  __attribute__((export_name("TS_COption_U128Z_some"))) TS_COption_U128Z_some(int8_tArray o) {
26983         LDKU128 o_ref;
26984         CHECK(o->arr_len == 16);
26985         memcpy(o_ref.le_bytes, o->elems, 16); FREE(o);
26986         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
26987         *ret_copy = COption_U128Z_some(o_ref);
26988         uint64_t ret_ref = tag_ptr(ret_copy, true);
26989         return ret_ref;
26990 }
26991
26992 uint64_t  __attribute__((export_name("TS_COption_U128Z_none"))) TS_COption_U128Z_none() {
26993         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
26994         *ret_copy = COption_U128Z_none();
26995         uint64_t ret_ref = tag_ptr(ret_copy, true);
26996         return ret_ref;
26997 }
26998
26999 void  __attribute__((export_name("TS_COption_U128Z_free"))) TS_COption_U128Z_free(uint64_t _res) {
27000         if (!ptr_is_owned(_res)) return;
27001         void* _res_ptr = untag_ptr(_res);
27002         CHECK_ACCESS(_res_ptr);
27003         LDKCOption_U128Z _res_conv = *(LDKCOption_U128Z*)(_res_ptr);
27004         FREE(untag_ptr(_res));
27005         COption_U128Z_free(_res_conv);
27006 }
27007
27008 static inline uint64_t COption_U128Z_clone_ptr(LDKCOption_U128Z *NONNULL_PTR arg) {
27009         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
27010         *ret_copy = COption_U128Z_clone(arg);
27011         uint64_t ret_ref = tag_ptr(ret_copy, true);
27012         return ret_ref;
27013 }
27014 int64_t  __attribute__((export_name("TS_COption_U128Z_clone_ptr"))) TS_COption_U128Z_clone_ptr(uint64_t arg) {
27015         LDKCOption_U128Z* arg_conv = (LDKCOption_U128Z*)untag_ptr(arg);
27016         int64_t ret_conv = COption_U128Z_clone_ptr(arg_conv);
27017         return ret_conv;
27018 }
27019
27020 uint64_t  __attribute__((export_name("TS_COption_U128Z_clone"))) TS_COption_U128Z_clone(uint64_t orig) {
27021         LDKCOption_U128Z* orig_conv = (LDKCOption_U128Z*)untag_ptr(orig);
27022         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
27023         *ret_copy = COption_U128Z_clone(orig_conv);
27024         uint64_t ret_ref = tag_ptr(ret_copy, true);
27025         return ret_ref;
27026 }
27027
27028 void  __attribute__((export_name("TS_CVec_ClaimedHTLCZ_free"))) TS_CVec_ClaimedHTLCZ_free(uint64_tArray _res) {
27029         LDKCVec_ClaimedHTLCZ _res_constr;
27030         _res_constr.datalen = _res->arr_len;
27031         if (_res_constr.datalen > 0)
27032                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
27033         else
27034                 _res_constr.data = NULL;
27035         uint64_t* _res_vals = _res->elems;
27036         for (size_t n = 0; n < _res_constr.datalen; n++) {
27037                 uint64_t _res_conv_13 = _res_vals[n];
27038                 LDKClaimedHTLC _res_conv_13_conv;
27039                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
27040                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
27041                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
27042                 _res_constr.data[n] = _res_conv_13_conv;
27043         }
27044         FREE(_res);
27045         CVec_ClaimedHTLCZ_free(_res_constr);
27046 }
27047
27048 uint64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_some"))) TS_COption_PaymentFailureReasonZ_some(uint32_t o) {
27049         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_js(o);
27050         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
27051         *ret_copy = COption_PaymentFailureReasonZ_some(o_conv);
27052         uint64_t ret_ref = tag_ptr(ret_copy, true);
27053         return ret_ref;
27054 }
27055
27056 uint64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_none"))) TS_COption_PaymentFailureReasonZ_none() {
27057         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
27058         *ret_copy = COption_PaymentFailureReasonZ_none();
27059         uint64_t ret_ref = tag_ptr(ret_copy, true);
27060         return ret_ref;
27061 }
27062
27063 void  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_free"))) TS_COption_PaymentFailureReasonZ_free(uint64_t _res) {
27064         if (!ptr_is_owned(_res)) return;
27065         void* _res_ptr = untag_ptr(_res);
27066         CHECK_ACCESS(_res_ptr);
27067         LDKCOption_PaymentFailureReasonZ _res_conv = *(LDKCOption_PaymentFailureReasonZ*)(_res_ptr);
27068         FREE(untag_ptr(_res));
27069         COption_PaymentFailureReasonZ_free(_res_conv);
27070 }
27071
27072 static inline uint64_t COption_PaymentFailureReasonZ_clone_ptr(LDKCOption_PaymentFailureReasonZ *NONNULL_PTR arg) {
27073         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
27074         *ret_copy = COption_PaymentFailureReasonZ_clone(arg);
27075         uint64_t ret_ref = tag_ptr(ret_copy, true);
27076         return ret_ref;
27077 }
27078 int64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_clone_ptr"))) TS_COption_PaymentFailureReasonZ_clone_ptr(uint64_t arg) {
27079         LDKCOption_PaymentFailureReasonZ* arg_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(arg);
27080         int64_t ret_conv = COption_PaymentFailureReasonZ_clone_ptr(arg_conv);
27081         return ret_conv;
27082 }
27083
27084 uint64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_clone"))) TS_COption_PaymentFailureReasonZ_clone(uint64_t orig) {
27085         LDKCOption_PaymentFailureReasonZ* orig_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(orig);
27086         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
27087         *ret_copy = COption_PaymentFailureReasonZ_clone(orig_conv);
27088         uint64_t ret_ref = tag_ptr(ret_copy, true);
27089         return ret_ref;
27090 }
27091
27092 uint64_t  __attribute__((export_name("TS_COption_EventZ_some"))) TS_COption_EventZ_some(uint64_t o) {
27093         void* o_ptr = untag_ptr(o);
27094         CHECK_ACCESS(o_ptr);
27095         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
27096         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
27097         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
27098         *ret_copy = COption_EventZ_some(o_conv);
27099         uint64_t ret_ref = tag_ptr(ret_copy, true);
27100         return ret_ref;
27101 }
27102
27103 uint64_t  __attribute__((export_name("TS_COption_EventZ_none"))) TS_COption_EventZ_none() {
27104         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
27105         *ret_copy = COption_EventZ_none();
27106         uint64_t ret_ref = tag_ptr(ret_copy, true);
27107         return ret_ref;
27108 }
27109
27110 void  __attribute__((export_name("TS_COption_EventZ_free"))) TS_COption_EventZ_free(uint64_t _res) {
27111         if (!ptr_is_owned(_res)) return;
27112         void* _res_ptr = untag_ptr(_res);
27113         CHECK_ACCESS(_res_ptr);
27114         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
27115         FREE(untag_ptr(_res));
27116         COption_EventZ_free(_res_conv);
27117 }
27118
27119 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
27120         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
27121         *ret_copy = COption_EventZ_clone(arg);
27122         uint64_t ret_ref = tag_ptr(ret_copy, true);
27123         return ret_ref;
27124 }
27125 int64_t  __attribute__((export_name("TS_COption_EventZ_clone_ptr"))) TS_COption_EventZ_clone_ptr(uint64_t arg) {
27126         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
27127         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
27128         return ret_conv;
27129 }
27130
27131 uint64_t  __attribute__((export_name("TS_COption_EventZ_clone"))) TS_COption_EventZ_clone(uint64_t orig) {
27132         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
27133         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
27134         *ret_copy = COption_EventZ_clone(orig_conv);
27135         uint64_t ret_ref = tag_ptr(ret_copy, true);
27136         return ret_ref;
27137 }
27138
27139 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_ok"))) TS_CResult_COption_EventZDecodeErrorZ_ok(uint64_t o) {
27140         void* o_ptr = untag_ptr(o);
27141         CHECK_ACCESS(o_ptr);
27142         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
27143         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
27144         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
27145         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
27146         return tag_ptr(ret_conv, true);
27147 }
27148
27149 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_err"))) TS_CResult_COption_EventZDecodeErrorZ_err(uint64_t e) {
27150         void* e_ptr = untag_ptr(e);
27151         CHECK_ACCESS(e_ptr);
27152         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27153         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27154         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
27155         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
27156         return tag_ptr(ret_conv, true);
27157 }
27158
27159 jboolean  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_is_ok"))) TS_CResult_COption_EventZDecodeErrorZ_is_ok(uint64_t o) {
27160         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
27161         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
27162         return ret_conv;
27163 }
27164
27165 void  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_free"))) TS_CResult_COption_EventZDecodeErrorZ_free(uint64_t _res) {
27166         if (!ptr_is_owned(_res)) return;
27167         void* _res_ptr = untag_ptr(_res);
27168         CHECK_ACCESS(_res_ptr);
27169         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
27170         FREE(untag_ptr(_res));
27171         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
27172 }
27173
27174 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
27175         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
27176         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
27177         return tag_ptr(ret_conv, true);
27178 }
27179 int64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_EventZDecodeErrorZ_clone_ptr(uint64_t arg) {
27180         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
27181         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
27182         return ret_conv;
27183 }
27184
27185 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone"))) TS_CResult_COption_EventZDecodeErrorZ_clone(uint64_t orig) {
27186         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
27187         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
27188         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
27189         return tag_ptr(ret_conv, true);
27190 }
27191
27192 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_ok"))) TS_CResult_SiPrefixBolt11ParseErrorZ_ok(uint32_t o) {
27193         LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
27194         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
27195         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_ok(o_conv);
27196         return tag_ptr(ret_conv, true);
27197 }
27198
27199 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_err"))) TS_CResult_SiPrefixBolt11ParseErrorZ_err(uint64_t e) {
27200         void* e_ptr = untag_ptr(e);
27201         CHECK_ACCESS(e_ptr);
27202         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
27203         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
27204         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
27205         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_err(e_conv);
27206         return tag_ptr(ret_conv, true);
27207 }
27208
27209 jboolean  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_is_ok"))) TS_CResult_SiPrefixBolt11ParseErrorZ_is_ok(uint64_t o) {
27210         LDKCResult_SiPrefixBolt11ParseErrorZ* o_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(o);
27211         jboolean ret_conv = CResult_SiPrefixBolt11ParseErrorZ_is_ok(o_conv);
27212         return ret_conv;
27213 }
27214
27215 void  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_free"))) TS_CResult_SiPrefixBolt11ParseErrorZ_free(uint64_t _res) {
27216         if (!ptr_is_owned(_res)) return;
27217         void* _res_ptr = untag_ptr(_res);
27218         CHECK_ACCESS(_res_ptr);
27219         LDKCResult_SiPrefixBolt11ParseErrorZ _res_conv = *(LDKCResult_SiPrefixBolt11ParseErrorZ*)(_res_ptr);
27220         FREE(untag_ptr(_res));
27221         CResult_SiPrefixBolt11ParseErrorZ_free(_res_conv);
27222 }
27223
27224 static inline uint64_t CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR arg) {
27225         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
27226         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(arg);
27227         return tag_ptr(ret_conv, true);
27228 }
27229 int64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_clone_ptr"))) TS_CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(uint64_t arg) {
27230         LDKCResult_SiPrefixBolt11ParseErrorZ* arg_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(arg);
27231         int64_t ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(arg_conv);
27232         return ret_conv;
27233 }
27234
27235 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_clone"))) TS_CResult_SiPrefixBolt11ParseErrorZ_clone(uint64_t orig) {
27236         LDKCResult_SiPrefixBolt11ParseErrorZ* orig_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(orig);
27237         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
27238         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(orig_conv);
27239         return tag_ptr(ret_conv, true);
27240 }
27241
27242 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(uint64_t o) {
27243         LDKBolt11Invoice o_conv;
27244         o_conv.inner = untag_ptr(o);
27245         o_conv.is_owned = ptr_is_owned(o);
27246         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27247         o_conv = Bolt11Invoice_clone(&o_conv);
27248         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
27249         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o_conv);
27250         return tag_ptr(ret_conv, true);
27251 }
27252
27253 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_err"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(uint64_t e) {
27254         void* e_ptr = untag_ptr(e);
27255         CHECK_ACCESS(e_ptr);
27256         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
27257         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
27258         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
27259         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e_conv);
27260         return tag_ptr(ret_conv, true);
27261 }
27262
27263 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(uint64_t o) {
27264         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
27265         jboolean ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
27266         return ret_conv;
27267 }
27268
27269 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_free"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(uint64_t _res) {
27270         if (!ptr_is_owned(_res)) return;
27271         void* _res_ptr = untag_ptr(_res);
27272         CHECK_ACCESS(_res_ptr);
27273         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)(_res_ptr);
27274         FREE(untag_ptr(_res));
27275         CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res_conv);
27276 }
27277
27278 static inline uint64_t CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
27279         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
27280         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(arg);
27281         return tag_ptr(ret_conv, true);
27282 }
27283 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(uint64_t arg) {
27284         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
27285         int64_t ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
27286         return ret_conv;
27287 }
27288
27289 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(uint64_t orig) {
27290         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
27291         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
27292         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig_conv);
27293         return tag_ptr(ret_conv, true);
27294 }
27295
27296 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(uint64_t o) {
27297         LDKSignedRawBolt11Invoice o_conv;
27298         o_conv.inner = untag_ptr(o);
27299         o_conv.is_owned = ptr_is_owned(o);
27300         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27301         o_conv = SignedRawBolt11Invoice_clone(&o_conv);
27302         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
27303         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o_conv);
27304         return tag_ptr(ret_conv, true);
27305 }
27306
27307 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(uint64_t e) {
27308         void* e_ptr = untag_ptr(e);
27309         CHECK_ACCESS(e_ptr);
27310         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
27311         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
27312         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
27313         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e_conv);
27314         return tag_ptr(ret_conv, true);
27315 }
27316
27317 jboolean  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(uint64_t o) {
27318         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* o_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(o);
27319         jboolean ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o_conv);
27320         return ret_conv;
27321 }
27322
27323 void  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(uint64_t _res) {
27324         if (!ptr_is_owned(_res)) return;
27325         void* _res_ptr = untag_ptr(_res);
27326         CHECK_ACCESS(_res_ptr);
27327         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ _res_conv = *(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)(_res_ptr);
27328         FREE(untag_ptr(_res));
27329         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res_conv);
27330 }
27331
27332 static inline uint64_t CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR arg) {
27333         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
27334         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(arg);
27335         return tag_ptr(ret_conv, true);
27336 }
27337 int64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(uint64_t arg) {
27338         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* arg_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(arg);
27339         int64_t ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(arg_conv);
27340         return ret_conv;
27341 }
27342
27343 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(uint64_t orig) {
27344         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* orig_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(orig);
27345         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
27346         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig_conv);
27347         return tag_ptr(ret_conv, true);
27348 }
27349
27350 static inline uint64_t C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR arg) {
27351         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
27352         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(arg);
27353         return tag_ptr(ret_conv, true);
27354 }
27355 int64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(uint64_t arg) {
27356         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(arg);
27357         int64_t ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(arg_conv);
27358         return ret_conv;
27359 }
27360
27361 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(uint64_t orig) {
27362         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(orig);
27363         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
27364         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig_conv);
27365         return tag_ptr(ret_conv, true);
27366 }
27367
27368 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(uint64_t a, int8_tArray b, uint64_t c) {
27369         LDKRawBolt11Invoice a_conv;
27370         a_conv.inner = untag_ptr(a);
27371         a_conv.is_owned = ptr_is_owned(a);
27372         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27373         a_conv = RawBolt11Invoice_clone(&a_conv);
27374         LDKThirtyTwoBytes b_ref;
27375         CHECK(b->arr_len == 32);
27376         memcpy(b_ref.data, b->elems, 32); FREE(b);
27377         LDKBolt11InvoiceSignature c_conv;
27378         c_conv.inner = untag_ptr(c);
27379         c_conv.is_owned = ptr_is_owned(c);
27380         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
27381         c_conv = Bolt11InvoiceSignature_clone(&c_conv);
27382         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
27383         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
27384         return tag_ptr(ret_conv, true);
27385 }
27386
27387 void  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(uint64_t _res) {
27388         if (!ptr_is_owned(_res)) return;
27389         void* _res_ptr = untag_ptr(_res);
27390         CHECK_ACCESS(_res_ptr);
27391         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)(_res_ptr);
27392         FREE(untag_ptr(_res));
27393         C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res_conv);
27394 }
27395
27396 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_ok"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_ok(uint64_t o) {
27397         LDKPayeePubKey o_conv;
27398         o_conv.inner = untag_ptr(o);
27399         o_conv.is_owned = ptr_is_owned(o);
27400         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27401         o_conv = PayeePubKey_clone(&o_conv);
27402         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
27403         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_ok(o_conv);
27404         return tag_ptr(ret_conv, true);
27405 }
27406
27407 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_err"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_err(uint32_t e) {
27408         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
27409         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
27410         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_err(e_conv);
27411         return tag_ptr(ret_conv, true);
27412 }
27413
27414 jboolean  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_is_ok"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_is_ok(uint64_t o) {
27415         LDKCResult_PayeePubKeySecp256k1ErrorZ* o_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(o);
27416         jboolean ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_is_ok(o_conv);
27417         return ret_conv;
27418 }
27419
27420 void  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_free"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_free(uint64_t _res) {
27421         if (!ptr_is_owned(_res)) return;
27422         void* _res_ptr = untag_ptr(_res);
27423         CHECK_ACCESS(_res_ptr);
27424         LDKCResult_PayeePubKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PayeePubKeySecp256k1ErrorZ*)(_res_ptr);
27425         FREE(untag_ptr(_res));
27426         CResult_PayeePubKeySecp256k1ErrorZ_free(_res_conv);
27427 }
27428
27429 static inline uint64_t CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR arg) {
27430         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
27431         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(arg);
27432         return tag_ptr(ret_conv, true);
27433 }
27434 int64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(uint64_t arg) {
27435         LDKCResult_PayeePubKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(arg);
27436         int64_t ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(arg_conv);
27437         return ret_conv;
27438 }
27439
27440 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_clone"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_clone(uint64_t orig) {
27441         LDKCResult_PayeePubKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(orig);
27442         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
27443         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(orig_conv);
27444         return tag_ptr(ret_conv, true);
27445 }
27446
27447 void  __attribute__((export_name("TS_CVec_PrivateRouteZ_free"))) TS_CVec_PrivateRouteZ_free(uint64_tArray _res) {
27448         LDKCVec_PrivateRouteZ _res_constr;
27449         _res_constr.datalen = _res->arr_len;
27450         if (_res_constr.datalen > 0)
27451                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
27452         else
27453                 _res_constr.data = NULL;
27454         uint64_t* _res_vals = _res->elems;
27455         for (size_t o = 0; o < _res_constr.datalen; o++) {
27456                 uint64_t _res_conv_14 = _res_vals[o];
27457                 LDKPrivateRoute _res_conv_14_conv;
27458                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
27459                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
27460                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
27461                 _res_constr.data[o] = _res_conv_14_conv;
27462         }
27463         FREE(_res);
27464         CVec_PrivateRouteZ_free(_res_constr);
27465 }
27466
27467 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint64_t o) {
27468         LDKPositiveTimestamp o_conv;
27469         o_conv.inner = untag_ptr(o);
27470         o_conv.is_owned = ptr_is_owned(o);
27471         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27472         o_conv = PositiveTimestamp_clone(&o_conv);
27473         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
27474         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
27475         return tag_ptr(ret_conv, true);
27476 }
27477
27478 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_err"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
27479         LDKCreationError e_conv = LDKCreationError_from_js(e);
27480         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
27481         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
27482         return tag_ptr(ret_conv, true);
27483 }
27484
27485 jboolean  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_is_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_is_ok(uint64_t o) {
27486         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
27487         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
27488         return ret_conv;
27489 }
27490
27491 void  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_free"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint64_t _res) {
27492         if (!ptr_is_owned(_res)) return;
27493         void* _res_ptr = untag_ptr(_res);
27494         CHECK_ACCESS(_res_ptr);
27495         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
27496         FREE(untag_ptr(_res));
27497         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
27498 }
27499
27500 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
27501         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
27502         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
27503         return tag_ptr(ret_conv, true);
27504 }
27505 int64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr"))) TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr(uint64_t arg) {
27506         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
27507         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
27508         return ret_conv;
27509 }
27510
27511 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint64_t orig) {
27512         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
27513         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
27514         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
27515         return tag_ptr(ret_conv, true);
27516 }
27517
27518 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_ok"))) TS_CResult_NoneBolt11SemanticErrorZ_ok() {
27519         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
27520         *ret_conv = CResult_NoneBolt11SemanticErrorZ_ok();
27521         return tag_ptr(ret_conv, true);
27522 }
27523
27524 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_err"))) TS_CResult_NoneBolt11SemanticErrorZ_err(uint32_t e) {
27525         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_js(e);
27526         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
27527         *ret_conv = CResult_NoneBolt11SemanticErrorZ_err(e_conv);
27528         return tag_ptr(ret_conv, true);
27529 }
27530
27531 jboolean  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_is_ok"))) TS_CResult_NoneBolt11SemanticErrorZ_is_ok(uint64_t o) {
27532         LDKCResult_NoneBolt11SemanticErrorZ* o_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(o);
27533         jboolean ret_conv = CResult_NoneBolt11SemanticErrorZ_is_ok(o_conv);
27534         return ret_conv;
27535 }
27536
27537 void  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_free"))) TS_CResult_NoneBolt11SemanticErrorZ_free(uint64_t _res) {
27538         if (!ptr_is_owned(_res)) return;
27539         void* _res_ptr = untag_ptr(_res);
27540         CHECK_ACCESS(_res_ptr);
27541         LDKCResult_NoneBolt11SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt11SemanticErrorZ*)(_res_ptr);
27542         FREE(untag_ptr(_res));
27543         CResult_NoneBolt11SemanticErrorZ_free(_res_conv);
27544 }
27545
27546 static inline uint64_t CResult_NoneBolt11SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR arg) {
27547         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
27548         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(arg);
27549         return tag_ptr(ret_conv, true);
27550 }
27551 int64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_clone_ptr"))) TS_CResult_NoneBolt11SemanticErrorZ_clone_ptr(uint64_t arg) {
27552         LDKCResult_NoneBolt11SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(arg);
27553         int64_t ret_conv = CResult_NoneBolt11SemanticErrorZ_clone_ptr(arg_conv);
27554         return ret_conv;
27555 }
27556
27557 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_clone"))) TS_CResult_NoneBolt11SemanticErrorZ_clone(uint64_t orig) {
27558         LDKCResult_NoneBolt11SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(orig);
27559         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
27560         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(orig_conv);
27561         return tag_ptr(ret_conv, true);
27562 }
27563
27564 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(uint64_t o) {
27565         LDKBolt11Invoice o_conv;
27566         o_conv.inner = untag_ptr(o);
27567         o_conv.is_owned = ptr_is_owned(o);
27568         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27569         o_conv = Bolt11Invoice_clone(&o_conv);
27570         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
27571         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o_conv);
27572         return tag_ptr(ret_conv, true);
27573 }
27574
27575 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_err"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(uint32_t e) {
27576         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_js(e);
27577         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
27578         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e_conv);
27579         return tag_ptr(ret_conv, true);
27580 }
27581
27582 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(uint64_t o) {
27583         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(o);
27584         jboolean ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o_conv);
27585         return ret_conv;
27586 }
27587
27588 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_free"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(uint64_t _res) {
27589         if (!ptr_is_owned(_res)) return;
27590         void* _res_ptr = untag_ptr(_res);
27591         CHECK_ACCESS(_res_ptr);
27592         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)(_res_ptr);
27593         FREE(untag_ptr(_res));
27594         CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res_conv);
27595 }
27596
27597 static inline uint64_t CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR arg) {
27598         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
27599         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(arg);
27600         return tag_ptr(ret_conv, true);
27601 }
27602 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(uint64_t arg) {
27603         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(arg);
27604         int64_t ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(arg_conv);
27605         return ret_conv;
27606 }
27607
27608 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(uint64_t orig) {
27609         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(orig);
27610         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
27611         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig_conv);
27612         return tag_ptr(ret_conv, true);
27613 }
27614
27615 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_ok"))) TS_CResult_DescriptionCreationErrorZ_ok(uint64_t o) {
27616         LDKDescription o_conv;
27617         o_conv.inner = untag_ptr(o);
27618         o_conv.is_owned = ptr_is_owned(o);
27619         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27620         o_conv = Description_clone(&o_conv);
27621         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
27622         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
27623         return tag_ptr(ret_conv, true);
27624 }
27625
27626 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_err"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
27627         LDKCreationError e_conv = LDKCreationError_from_js(e);
27628         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
27629         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
27630         return tag_ptr(ret_conv, true);
27631 }
27632
27633 jboolean  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_is_ok"))) TS_CResult_DescriptionCreationErrorZ_is_ok(uint64_t o) {
27634         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
27635         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
27636         return ret_conv;
27637 }
27638
27639 void  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_free"))) TS_CResult_DescriptionCreationErrorZ_free(uint64_t _res) {
27640         if (!ptr_is_owned(_res)) return;
27641         void* _res_ptr = untag_ptr(_res);
27642         CHECK_ACCESS(_res_ptr);
27643         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
27644         FREE(untag_ptr(_res));
27645         CResult_DescriptionCreationErrorZ_free(_res_conv);
27646 }
27647
27648 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
27649         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
27650         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
27651         return tag_ptr(ret_conv, true);
27652 }
27653 int64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone_ptr"))) TS_CResult_DescriptionCreationErrorZ_clone_ptr(uint64_t arg) {
27654         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
27655         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
27656         return ret_conv;
27657 }
27658
27659 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone"))) TS_CResult_DescriptionCreationErrorZ_clone(uint64_t orig) {
27660         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
27661         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
27662         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
27663         return tag_ptr(ret_conv, true);
27664 }
27665
27666 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_ok"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint64_t o) {
27667         LDKPrivateRoute o_conv;
27668         o_conv.inner = untag_ptr(o);
27669         o_conv.is_owned = ptr_is_owned(o);
27670         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27671         o_conv = PrivateRoute_clone(&o_conv);
27672         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
27673         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
27674         return tag_ptr(ret_conv, true);
27675 }
27676
27677 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_err"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
27678         LDKCreationError e_conv = LDKCreationError_from_js(e);
27679         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
27680         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
27681         return tag_ptr(ret_conv, true);
27682 }
27683
27684 jboolean  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_is_ok"))) TS_CResult_PrivateRouteCreationErrorZ_is_ok(uint64_t o) {
27685         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
27686         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
27687         return ret_conv;
27688 }
27689
27690 void  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_free"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint64_t _res) {
27691         if (!ptr_is_owned(_res)) return;
27692         void* _res_ptr = untag_ptr(_res);
27693         CHECK_ACCESS(_res_ptr);
27694         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
27695         FREE(untag_ptr(_res));
27696         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
27697 }
27698
27699 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
27700         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
27701         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
27702         return tag_ptr(ret_conv, true);
27703 }
27704 int64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone_ptr"))) TS_CResult_PrivateRouteCreationErrorZ_clone_ptr(uint64_t arg) {
27705         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
27706         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
27707         return ret_conv;
27708 }
27709
27710 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint64_t orig) {
27711         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
27712         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
27713         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
27714         return tag_ptr(ret_conv, true);
27715 }
27716
27717 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_ok"))) TS_CResult_OutPointDecodeErrorZ_ok(uint64_t o) {
27718         LDKOutPoint o_conv;
27719         o_conv.inner = untag_ptr(o);
27720         o_conv.is_owned = ptr_is_owned(o);
27721         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27722         o_conv = OutPoint_clone(&o_conv);
27723         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
27724         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
27725         return tag_ptr(ret_conv, true);
27726 }
27727
27728 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_err"))) TS_CResult_OutPointDecodeErrorZ_err(uint64_t e) {
27729         void* e_ptr = untag_ptr(e);
27730         CHECK_ACCESS(e_ptr);
27731         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27732         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27733         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
27734         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
27735         return tag_ptr(ret_conv, true);
27736 }
27737
27738 jboolean  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_is_ok"))) TS_CResult_OutPointDecodeErrorZ_is_ok(uint64_t o) {
27739         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
27740         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
27741         return ret_conv;
27742 }
27743
27744 void  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_free"))) TS_CResult_OutPointDecodeErrorZ_free(uint64_t _res) {
27745         if (!ptr_is_owned(_res)) return;
27746         void* _res_ptr = untag_ptr(_res);
27747         CHECK_ACCESS(_res_ptr);
27748         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
27749         FREE(untag_ptr(_res));
27750         CResult_OutPointDecodeErrorZ_free(_res_conv);
27751 }
27752
27753 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
27754         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
27755         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
27756         return tag_ptr(ret_conv, true);
27757 }
27758 int64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone_ptr"))) TS_CResult_OutPointDecodeErrorZ_clone_ptr(uint64_t arg) {
27759         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
27760         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
27761         return ret_conv;
27762 }
27763
27764 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone"))) TS_CResult_OutPointDecodeErrorZ_clone(uint64_t orig) {
27765         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
27766         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
27767         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
27768         return tag_ptr(ret_conv, true);
27769 }
27770
27771 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_ok"))) TS_CResult_BigSizeDecodeErrorZ_ok(uint64_t o) {
27772         LDKBigSize o_conv;
27773         o_conv.inner = untag_ptr(o);
27774         o_conv.is_owned = ptr_is_owned(o);
27775         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27776         o_conv = BigSize_clone(&o_conv);
27777         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
27778         *ret_conv = CResult_BigSizeDecodeErrorZ_ok(o_conv);
27779         return tag_ptr(ret_conv, true);
27780 }
27781
27782 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_err"))) TS_CResult_BigSizeDecodeErrorZ_err(uint64_t e) {
27783         void* e_ptr = untag_ptr(e);
27784         CHECK_ACCESS(e_ptr);
27785         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27786         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27787         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
27788         *ret_conv = CResult_BigSizeDecodeErrorZ_err(e_conv);
27789         return tag_ptr(ret_conv, true);
27790 }
27791
27792 jboolean  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_is_ok"))) TS_CResult_BigSizeDecodeErrorZ_is_ok(uint64_t o) {
27793         LDKCResult_BigSizeDecodeErrorZ* o_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(o);
27794         jboolean ret_conv = CResult_BigSizeDecodeErrorZ_is_ok(o_conv);
27795         return ret_conv;
27796 }
27797
27798 void  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_free"))) TS_CResult_BigSizeDecodeErrorZ_free(uint64_t _res) {
27799         if (!ptr_is_owned(_res)) return;
27800         void* _res_ptr = untag_ptr(_res);
27801         CHECK_ACCESS(_res_ptr);
27802         LDKCResult_BigSizeDecodeErrorZ _res_conv = *(LDKCResult_BigSizeDecodeErrorZ*)(_res_ptr);
27803         FREE(untag_ptr(_res));
27804         CResult_BigSizeDecodeErrorZ_free(_res_conv);
27805 }
27806
27807 static inline uint64_t CResult_BigSizeDecodeErrorZ_clone_ptr(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR arg) {
27808         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
27809         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(arg);
27810         return tag_ptr(ret_conv, true);
27811 }
27812 int64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_clone_ptr"))) TS_CResult_BigSizeDecodeErrorZ_clone_ptr(uint64_t arg) {
27813         LDKCResult_BigSizeDecodeErrorZ* arg_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(arg);
27814         int64_t ret_conv = CResult_BigSizeDecodeErrorZ_clone_ptr(arg_conv);
27815         return ret_conv;
27816 }
27817
27818 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_clone"))) TS_CResult_BigSizeDecodeErrorZ_clone(uint64_t orig) {
27819         LDKCResult_BigSizeDecodeErrorZ* orig_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(orig);
27820         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
27821         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(orig_conv);
27822         return tag_ptr(ret_conv, true);
27823 }
27824
27825 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_ok"))) TS_CResult_HostnameDecodeErrorZ_ok(uint64_t o) {
27826         LDKHostname o_conv;
27827         o_conv.inner = untag_ptr(o);
27828         o_conv.is_owned = ptr_is_owned(o);
27829         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27830         o_conv = Hostname_clone(&o_conv);
27831         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
27832         *ret_conv = CResult_HostnameDecodeErrorZ_ok(o_conv);
27833         return tag_ptr(ret_conv, true);
27834 }
27835
27836 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_err"))) TS_CResult_HostnameDecodeErrorZ_err(uint64_t e) {
27837         void* e_ptr = untag_ptr(e);
27838         CHECK_ACCESS(e_ptr);
27839         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27840         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27841         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
27842         *ret_conv = CResult_HostnameDecodeErrorZ_err(e_conv);
27843         return tag_ptr(ret_conv, true);
27844 }
27845
27846 jboolean  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_is_ok"))) TS_CResult_HostnameDecodeErrorZ_is_ok(uint64_t o) {
27847         LDKCResult_HostnameDecodeErrorZ* o_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(o);
27848         jboolean ret_conv = CResult_HostnameDecodeErrorZ_is_ok(o_conv);
27849         return ret_conv;
27850 }
27851
27852 void  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_free"))) TS_CResult_HostnameDecodeErrorZ_free(uint64_t _res) {
27853         if (!ptr_is_owned(_res)) return;
27854         void* _res_ptr = untag_ptr(_res);
27855         CHECK_ACCESS(_res_ptr);
27856         LDKCResult_HostnameDecodeErrorZ _res_conv = *(LDKCResult_HostnameDecodeErrorZ*)(_res_ptr);
27857         FREE(untag_ptr(_res));
27858         CResult_HostnameDecodeErrorZ_free(_res_conv);
27859 }
27860
27861 static inline uint64_t CResult_HostnameDecodeErrorZ_clone_ptr(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR arg) {
27862         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
27863         *ret_conv = CResult_HostnameDecodeErrorZ_clone(arg);
27864         return tag_ptr(ret_conv, true);
27865 }
27866 int64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_clone_ptr"))) TS_CResult_HostnameDecodeErrorZ_clone_ptr(uint64_t arg) {
27867         LDKCResult_HostnameDecodeErrorZ* arg_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(arg);
27868         int64_t ret_conv = CResult_HostnameDecodeErrorZ_clone_ptr(arg_conv);
27869         return ret_conv;
27870 }
27871
27872 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_clone"))) TS_CResult_HostnameDecodeErrorZ_clone(uint64_t orig) {
27873         LDKCResult_HostnameDecodeErrorZ* orig_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(orig);
27874         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
27875         *ret_conv = CResult_HostnameDecodeErrorZ_clone(orig_conv);
27876         return tag_ptr(ret_conv, true);
27877 }
27878
27879 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_ok"))) TS_CResult_TransactionU16LenLimitedNoneZ_ok(uint64_t o) {
27880         LDKTransactionU16LenLimited o_conv;
27881         o_conv.inner = untag_ptr(o);
27882         o_conv.is_owned = ptr_is_owned(o);
27883         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27884         o_conv = TransactionU16LenLimited_clone(&o_conv);
27885         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
27886         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_ok(o_conv);
27887         return tag_ptr(ret_conv, true);
27888 }
27889
27890 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_err"))) TS_CResult_TransactionU16LenLimitedNoneZ_err() {
27891         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
27892         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_err();
27893         return tag_ptr(ret_conv, true);
27894 }
27895
27896 jboolean  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_is_ok"))) TS_CResult_TransactionU16LenLimitedNoneZ_is_ok(uint64_t o) {
27897         LDKCResult_TransactionU16LenLimitedNoneZ* o_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(o);
27898         jboolean ret_conv = CResult_TransactionU16LenLimitedNoneZ_is_ok(o_conv);
27899         return ret_conv;
27900 }
27901
27902 void  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_free"))) TS_CResult_TransactionU16LenLimitedNoneZ_free(uint64_t _res) {
27903         if (!ptr_is_owned(_res)) return;
27904         void* _res_ptr = untag_ptr(_res);
27905         CHECK_ACCESS(_res_ptr);
27906         LDKCResult_TransactionU16LenLimitedNoneZ _res_conv = *(LDKCResult_TransactionU16LenLimitedNoneZ*)(_res_ptr);
27907         FREE(untag_ptr(_res));
27908         CResult_TransactionU16LenLimitedNoneZ_free(_res_conv);
27909 }
27910
27911 static inline uint64_t CResult_TransactionU16LenLimitedNoneZ_clone_ptr(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR arg) {
27912         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
27913         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(arg);
27914         return tag_ptr(ret_conv, true);
27915 }
27916 int64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_clone_ptr"))) TS_CResult_TransactionU16LenLimitedNoneZ_clone_ptr(uint64_t arg) {
27917         LDKCResult_TransactionU16LenLimitedNoneZ* arg_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(arg);
27918         int64_t ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone_ptr(arg_conv);
27919         return ret_conv;
27920 }
27921
27922 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_clone"))) TS_CResult_TransactionU16LenLimitedNoneZ_clone(uint64_t orig) {
27923         LDKCResult_TransactionU16LenLimitedNoneZ* orig_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(orig);
27924         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
27925         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(orig_conv);
27926         return tag_ptr(ret_conv, true);
27927 }
27928
27929 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_ok"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_ok(uint64_t o) {
27930         LDKTransactionU16LenLimited o_conv;
27931         o_conv.inner = untag_ptr(o);
27932         o_conv.is_owned = ptr_is_owned(o);
27933         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27934         o_conv = TransactionU16LenLimited_clone(&o_conv);
27935         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
27936         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o_conv);
27937         return tag_ptr(ret_conv, true);
27938 }
27939
27940 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_err"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_err(uint64_t e) {
27941         void* e_ptr = untag_ptr(e);
27942         CHECK_ACCESS(e_ptr);
27943         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27944         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27945         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
27946         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_err(e_conv);
27947         return tag_ptr(ret_conv, true);
27948 }
27949
27950 jboolean  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(uint64_t o) {
27951         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* o_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(o);
27952         jboolean ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o_conv);
27953         return ret_conv;
27954 }
27955
27956 void  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_free"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_free(uint64_t _res) {
27957         if (!ptr_is_owned(_res)) return;
27958         void* _res_ptr = untag_ptr(_res);
27959         CHECK_ACCESS(_res_ptr);
27960         LDKCResult_TransactionU16LenLimitedDecodeErrorZ _res_conv = *(LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)(_res_ptr);
27961         FREE(untag_ptr(_res));
27962         CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res_conv);
27963 }
27964
27965 static inline uint64_t CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR arg) {
27966         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
27967         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(arg);
27968         return tag_ptr(ret_conv, true);
27969 }
27970 int64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(uint64_t arg) {
27971         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* arg_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(arg);
27972         int64_t ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(arg_conv);
27973         return ret_conv;
27974 }
27975
27976 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone(uint64_t orig) {
27977         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* orig_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(orig);
27978         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
27979         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig_conv);
27980         return tag_ptr(ret_conv, true);
27981 }
27982
27983 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_ok(uint64_t o) {
27984         LDKUntrustedString o_conv;
27985         o_conv.inner = untag_ptr(o);
27986         o_conv.is_owned = ptr_is_owned(o);
27987         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27988         o_conv = UntrustedString_clone(&o_conv);
27989         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
27990         *ret_conv = CResult_UntrustedStringDecodeErrorZ_ok(o_conv);
27991         return tag_ptr(ret_conv, true);
27992 }
27993
27994 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_err"))) TS_CResult_UntrustedStringDecodeErrorZ_err(uint64_t e) {
27995         void* e_ptr = untag_ptr(e);
27996         CHECK_ACCESS(e_ptr);
27997         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27998         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27999         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
28000         *ret_conv = CResult_UntrustedStringDecodeErrorZ_err(e_conv);
28001         return tag_ptr(ret_conv, true);
28002 }
28003
28004 jboolean  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_is_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_is_ok(uint64_t o) {
28005         LDKCResult_UntrustedStringDecodeErrorZ* o_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(o);
28006         jboolean ret_conv = CResult_UntrustedStringDecodeErrorZ_is_ok(o_conv);
28007         return ret_conv;
28008 }
28009
28010 void  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_free"))) TS_CResult_UntrustedStringDecodeErrorZ_free(uint64_t _res) {
28011         if (!ptr_is_owned(_res)) return;
28012         void* _res_ptr = untag_ptr(_res);
28013         CHECK_ACCESS(_res_ptr);
28014         LDKCResult_UntrustedStringDecodeErrorZ _res_conv = *(LDKCResult_UntrustedStringDecodeErrorZ*)(_res_ptr);
28015         FREE(untag_ptr(_res));
28016         CResult_UntrustedStringDecodeErrorZ_free(_res_conv);
28017 }
28018
28019 static inline uint64_t CResult_UntrustedStringDecodeErrorZ_clone_ptr(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR arg) {
28020         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
28021         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(arg);
28022         return tag_ptr(ret_conv, true);
28023 }
28024 int64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_clone_ptr"))) TS_CResult_UntrustedStringDecodeErrorZ_clone_ptr(uint64_t arg) {
28025         LDKCResult_UntrustedStringDecodeErrorZ* arg_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(arg);
28026         int64_t ret_conv = CResult_UntrustedStringDecodeErrorZ_clone_ptr(arg_conv);
28027         return ret_conv;
28028 }
28029
28030 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_clone"))) TS_CResult_UntrustedStringDecodeErrorZ_clone(uint64_t orig) {
28031         LDKCResult_UntrustedStringDecodeErrorZ* orig_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(orig);
28032         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
28033         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(orig_conv);
28034         return tag_ptr(ret_conv, true);
28035 }
28036
28037 uint64_t  __attribute__((export_name("TS_CResult_ReceiveTlvsDecodeErrorZ_ok"))) TS_CResult_ReceiveTlvsDecodeErrorZ_ok(uint64_t o) {
28038         LDKReceiveTlvs o_conv;
28039         o_conv.inner = untag_ptr(o);
28040         o_conv.is_owned = ptr_is_owned(o);
28041         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28042         o_conv = ReceiveTlvs_clone(&o_conv);
28043         LDKCResult_ReceiveTlvsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ), "LDKCResult_ReceiveTlvsDecodeErrorZ");
28044         *ret_conv = CResult_ReceiveTlvsDecodeErrorZ_ok(o_conv);
28045         return tag_ptr(ret_conv, true);
28046 }
28047
28048 uint64_t  __attribute__((export_name("TS_CResult_ReceiveTlvsDecodeErrorZ_err"))) TS_CResult_ReceiveTlvsDecodeErrorZ_err(uint64_t e) {
28049         void* e_ptr = untag_ptr(e);
28050         CHECK_ACCESS(e_ptr);
28051         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28052         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28053         LDKCResult_ReceiveTlvsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ), "LDKCResult_ReceiveTlvsDecodeErrorZ");
28054         *ret_conv = CResult_ReceiveTlvsDecodeErrorZ_err(e_conv);
28055         return tag_ptr(ret_conv, true);
28056 }
28057
28058 jboolean  __attribute__((export_name("TS_CResult_ReceiveTlvsDecodeErrorZ_is_ok"))) TS_CResult_ReceiveTlvsDecodeErrorZ_is_ok(uint64_t o) {
28059         LDKCResult_ReceiveTlvsDecodeErrorZ* o_conv = (LDKCResult_ReceiveTlvsDecodeErrorZ*)untag_ptr(o);
28060         jboolean ret_conv = CResult_ReceiveTlvsDecodeErrorZ_is_ok(o_conv);
28061         return ret_conv;
28062 }
28063
28064 void  __attribute__((export_name("TS_CResult_ReceiveTlvsDecodeErrorZ_free"))) TS_CResult_ReceiveTlvsDecodeErrorZ_free(uint64_t _res) {
28065         if (!ptr_is_owned(_res)) return;
28066         void* _res_ptr = untag_ptr(_res);
28067         CHECK_ACCESS(_res_ptr);
28068         LDKCResult_ReceiveTlvsDecodeErrorZ _res_conv = *(LDKCResult_ReceiveTlvsDecodeErrorZ*)(_res_ptr);
28069         FREE(untag_ptr(_res));
28070         CResult_ReceiveTlvsDecodeErrorZ_free(_res_conv);
28071 }
28072
28073 static inline uint64_t CResult_ReceiveTlvsDecodeErrorZ_clone_ptr(LDKCResult_ReceiveTlvsDecodeErrorZ *NONNULL_PTR arg) {
28074         LDKCResult_ReceiveTlvsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ), "LDKCResult_ReceiveTlvsDecodeErrorZ");
28075         *ret_conv = CResult_ReceiveTlvsDecodeErrorZ_clone(arg);
28076         return tag_ptr(ret_conv, true);
28077 }
28078 int64_t  __attribute__((export_name("TS_CResult_ReceiveTlvsDecodeErrorZ_clone_ptr"))) TS_CResult_ReceiveTlvsDecodeErrorZ_clone_ptr(uint64_t arg) {
28079         LDKCResult_ReceiveTlvsDecodeErrorZ* arg_conv = (LDKCResult_ReceiveTlvsDecodeErrorZ*)untag_ptr(arg);
28080         int64_t ret_conv = CResult_ReceiveTlvsDecodeErrorZ_clone_ptr(arg_conv);
28081         return ret_conv;
28082 }
28083
28084 uint64_t  __attribute__((export_name("TS_CResult_ReceiveTlvsDecodeErrorZ_clone"))) TS_CResult_ReceiveTlvsDecodeErrorZ_clone(uint64_t orig) {
28085         LDKCResult_ReceiveTlvsDecodeErrorZ* orig_conv = (LDKCResult_ReceiveTlvsDecodeErrorZ*)untag_ptr(orig);
28086         LDKCResult_ReceiveTlvsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ), "LDKCResult_ReceiveTlvsDecodeErrorZ");
28087         *ret_conv = CResult_ReceiveTlvsDecodeErrorZ_clone(orig_conv);
28088         return tag_ptr(ret_conv, true);
28089 }
28090
28091 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_ok"))) TS_CResult_PaymentRelayDecodeErrorZ_ok(uint64_t o) {
28092         LDKPaymentRelay o_conv;
28093         o_conv.inner = untag_ptr(o);
28094         o_conv.is_owned = ptr_is_owned(o);
28095         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28096         o_conv = PaymentRelay_clone(&o_conv);
28097         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
28098         *ret_conv = CResult_PaymentRelayDecodeErrorZ_ok(o_conv);
28099         return tag_ptr(ret_conv, true);
28100 }
28101
28102 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_err"))) TS_CResult_PaymentRelayDecodeErrorZ_err(uint64_t e) {
28103         void* e_ptr = untag_ptr(e);
28104         CHECK_ACCESS(e_ptr);
28105         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28106         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28107         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
28108         *ret_conv = CResult_PaymentRelayDecodeErrorZ_err(e_conv);
28109         return tag_ptr(ret_conv, true);
28110 }
28111
28112 jboolean  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_is_ok"))) TS_CResult_PaymentRelayDecodeErrorZ_is_ok(uint64_t o) {
28113         LDKCResult_PaymentRelayDecodeErrorZ* o_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(o);
28114         jboolean ret_conv = CResult_PaymentRelayDecodeErrorZ_is_ok(o_conv);
28115         return ret_conv;
28116 }
28117
28118 void  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_free"))) TS_CResult_PaymentRelayDecodeErrorZ_free(uint64_t _res) {
28119         if (!ptr_is_owned(_res)) return;
28120         void* _res_ptr = untag_ptr(_res);
28121         CHECK_ACCESS(_res_ptr);
28122         LDKCResult_PaymentRelayDecodeErrorZ _res_conv = *(LDKCResult_PaymentRelayDecodeErrorZ*)(_res_ptr);
28123         FREE(untag_ptr(_res));
28124         CResult_PaymentRelayDecodeErrorZ_free(_res_conv);
28125 }
28126
28127 static inline uint64_t CResult_PaymentRelayDecodeErrorZ_clone_ptr(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR arg) {
28128         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
28129         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(arg);
28130         return tag_ptr(ret_conv, true);
28131 }
28132 int64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentRelayDecodeErrorZ_clone_ptr(uint64_t arg) {
28133         LDKCResult_PaymentRelayDecodeErrorZ* arg_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(arg);
28134         int64_t ret_conv = CResult_PaymentRelayDecodeErrorZ_clone_ptr(arg_conv);
28135         return ret_conv;
28136 }
28137
28138 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_clone"))) TS_CResult_PaymentRelayDecodeErrorZ_clone(uint64_t orig) {
28139         LDKCResult_PaymentRelayDecodeErrorZ* orig_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(orig);
28140         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
28141         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(orig_conv);
28142         return tag_ptr(ret_conv, true);
28143 }
28144
28145 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_ok"))) TS_CResult_PaymentConstraintsDecodeErrorZ_ok(uint64_t o) {
28146         LDKPaymentConstraints o_conv;
28147         o_conv.inner = untag_ptr(o);
28148         o_conv.is_owned = ptr_is_owned(o);
28149         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28150         o_conv = PaymentConstraints_clone(&o_conv);
28151         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
28152         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_ok(o_conv);
28153         return tag_ptr(ret_conv, true);
28154 }
28155
28156 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_err"))) TS_CResult_PaymentConstraintsDecodeErrorZ_err(uint64_t e) {
28157         void* e_ptr = untag_ptr(e);
28158         CHECK_ACCESS(e_ptr);
28159         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28160         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28161         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
28162         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_err(e_conv);
28163         return tag_ptr(ret_conv, true);
28164 }
28165
28166 jboolean  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_is_ok"))) TS_CResult_PaymentConstraintsDecodeErrorZ_is_ok(uint64_t o) {
28167         LDKCResult_PaymentConstraintsDecodeErrorZ* o_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(o);
28168         jboolean ret_conv = CResult_PaymentConstraintsDecodeErrorZ_is_ok(o_conv);
28169         return ret_conv;
28170 }
28171
28172 void  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_free"))) TS_CResult_PaymentConstraintsDecodeErrorZ_free(uint64_t _res) {
28173         if (!ptr_is_owned(_res)) return;
28174         void* _res_ptr = untag_ptr(_res);
28175         CHECK_ACCESS(_res_ptr);
28176         LDKCResult_PaymentConstraintsDecodeErrorZ _res_conv = *(LDKCResult_PaymentConstraintsDecodeErrorZ*)(_res_ptr);
28177         FREE(untag_ptr(_res));
28178         CResult_PaymentConstraintsDecodeErrorZ_free(_res_conv);
28179 }
28180
28181 static inline uint64_t CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR arg) {
28182         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
28183         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(arg);
28184         return tag_ptr(ret_conv, true);
28185 }
28186 int64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(uint64_t arg) {
28187         LDKCResult_PaymentConstraintsDecodeErrorZ* arg_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(arg);
28188         int64_t ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(arg_conv);
28189         return ret_conv;
28190 }
28191
28192 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_clone"))) TS_CResult_PaymentConstraintsDecodeErrorZ_clone(uint64_t orig) {
28193         LDKCResult_PaymentConstraintsDecodeErrorZ* orig_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(orig);
28194         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
28195         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(orig_conv);
28196         return tag_ptr(ret_conv, true);
28197 }
28198
28199 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentErrorZ_ok"))) TS_CResult_ThirtyTwoBytesPaymentErrorZ_ok(int8_tArray o) {
28200         LDKThirtyTwoBytes o_ref;
28201         CHECK(o->arr_len == 32);
28202         memcpy(o_ref.data, o->elems, 32); FREE(o);
28203         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
28204         *ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_ok(o_ref);
28205         return tag_ptr(ret_conv, true);
28206 }
28207
28208 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentErrorZ_err"))) TS_CResult_ThirtyTwoBytesPaymentErrorZ_err(uint64_t e) {
28209         void* e_ptr = untag_ptr(e);
28210         CHECK_ACCESS(e_ptr);
28211         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
28212         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
28213         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
28214         *ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_err(e_conv);
28215         return tag_ptr(ret_conv, true);
28216 }
28217
28218 jboolean  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentErrorZ_is_ok"))) TS_CResult_ThirtyTwoBytesPaymentErrorZ_is_ok(uint64_t o) {
28219         LDKCResult_ThirtyTwoBytesPaymentErrorZ* o_conv = (LDKCResult_ThirtyTwoBytesPaymentErrorZ*)untag_ptr(o);
28220         jboolean ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_is_ok(o_conv);
28221         return ret_conv;
28222 }
28223
28224 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentErrorZ_free"))) TS_CResult_ThirtyTwoBytesPaymentErrorZ_free(uint64_t _res) {
28225         if (!ptr_is_owned(_res)) return;
28226         void* _res_ptr = untag_ptr(_res);
28227         CHECK_ACCESS(_res_ptr);
28228         LDKCResult_ThirtyTwoBytesPaymentErrorZ _res_conv = *(LDKCResult_ThirtyTwoBytesPaymentErrorZ*)(_res_ptr);
28229         FREE(untag_ptr(_res));
28230         CResult_ThirtyTwoBytesPaymentErrorZ_free(_res_conv);
28231 }
28232
28233 static inline uint64_t CResult_ThirtyTwoBytesPaymentErrorZ_clone_ptr(LDKCResult_ThirtyTwoBytesPaymentErrorZ *NONNULL_PTR arg) {
28234         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
28235         *ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_clone(arg);
28236         return tag_ptr(ret_conv, true);
28237 }
28238 int64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentErrorZ_clone_ptr"))) TS_CResult_ThirtyTwoBytesPaymentErrorZ_clone_ptr(uint64_t arg) {
28239         LDKCResult_ThirtyTwoBytesPaymentErrorZ* arg_conv = (LDKCResult_ThirtyTwoBytesPaymentErrorZ*)untag_ptr(arg);
28240         int64_t ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_clone_ptr(arg_conv);
28241         return ret_conv;
28242 }
28243
28244 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentErrorZ_clone"))) TS_CResult_ThirtyTwoBytesPaymentErrorZ_clone(uint64_t orig) {
28245         LDKCResult_ThirtyTwoBytesPaymentErrorZ* orig_conv = (LDKCResult_ThirtyTwoBytesPaymentErrorZ*)untag_ptr(orig);
28246         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
28247         *ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_clone(orig_conv);
28248         return tag_ptr(ret_conv, true);
28249 }
28250
28251 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_ok"))) TS_CResult_NonePaymentErrorZ_ok() {
28252         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
28253         *ret_conv = CResult_NonePaymentErrorZ_ok();
28254         return tag_ptr(ret_conv, true);
28255 }
28256
28257 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_err"))) TS_CResult_NonePaymentErrorZ_err(uint64_t e) {
28258         void* e_ptr = untag_ptr(e);
28259         CHECK_ACCESS(e_ptr);
28260         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
28261         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
28262         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
28263         *ret_conv = CResult_NonePaymentErrorZ_err(e_conv);
28264         return tag_ptr(ret_conv, true);
28265 }
28266
28267 jboolean  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_is_ok"))) TS_CResult_NonePaymentErrorZ_is_ok(uint64_t o) {
28268         LDKCResult_NonePaymentErrorZ* o_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(o);
28269         jboolean ret_conv = CResult_NonePaymentErrorZ_is_ok(o_conv);
28270         return ret_conv;
28271 }
28272
28273 void  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_free"))) TS_CResult_NonePaymentErrorZ_free(uint64_t _res) {
28274         if (!ptr_is_owned(_res)) return;
28275         void* _res_ptr = untag_ptr(_res);
28276         CHECK_ACCESS(_res_ptr);
28277         LDKCResult_NonePaymentErrorZ _res_conv = *(LDKCResult_NonePaymentErrorZ*)(_res_ptr);
28278         FREE(untag_ptr(_res));
28279         CResult_NonePaymentErrorZ_free(_res_conv);
28280 }
28281
28282 static inline uint64_t CResult_NonePaymentErrorZ_clone_ptr(LDKCResult_NonePaymentErrorZ *NONNULL_PTR arg) {
28283         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
28284         *ret_conv = CResult_NonePaymentErrorZ_clone(arg);
28285         return tag_ptr(ret_conv, true);
28286 }
28287 int64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_clone_ptr"))) TS_CResult_NonePaymentErrorZ_clone_ptr(uint64_t arg) {
28288         LDKCResult_NonePaymentErrorZ* arg_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(arg);
28289         int64_t ret_conv = CResult_NonePaymentErrorZ_clone_ptr(arg_conv);
28290         return ret_conv;
28291 }
28292
28293 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_clone"))) TS_CResult_NonePaymentErrorZ_clone(uint64_t orig) {
28294         LDKCResult_NonePaymentErrorZ* orig_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(orig);
28295         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
28296         *ret_conv = CResult_NonePaymentErrorZ_clone(orig_conv);
28297         return tag_ptr(ret_conv, true);
28298 }
28299
28300 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_ok(uint64_tArray o) {
28301         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o_constr;
28302         o_constr.datalen = o->arr_len;
28303         if (o_constr.datalen > 0)
28304                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
28305         else
28306                 o_constr.data = NULL;
28307         uint64_t* o_vals = o->elems;
28308         for (size_t o = 0; o < o_constr.datalen; o++) {
28309                 uint64_t o_conv_40 = o_vals[o];
28310                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
28311                 CHECK_ACCESS(o_conv_40_ptr);
28312                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_conv_40_ptr);
28313                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o_conv_40));
28314                 o_constr.data[o] = o_conv_40_conv;
28315         }
28316         FREE(o);
28317         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
28318         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_ok(o_constr);
28319         return tag_ptr(ret_conv, true);
28320 }
28321
28322 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_err(uint64_t e) {
28323         void* e_ptr = untag_ptr(e);
28324         CHECK_ACCESS(e_ptr);
28325         LDKProbingError e_conv = *(LDKProbingError*)(e_ptr);
28326         e_conv = ProbingError_clone((LDKProbingError*)untag_ptr(e));
28327         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
28328         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_err(e_conv);
28329         return tag_ptr(ret_conv, true);
28330 }
28331
28332 jboolean  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_is_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_is_ok(uint64_t o) {
28333         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)untag_ptr(o);
28334         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_is_ok(o_conv);
28335         return ret_conv;
28336 }
28337
28338 void  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_free"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_free(uint64_t _res) {
28339         if (!ptr_is_owned(_res)) return;
28340         void* _res_ptr = untag_ptr(_res);
28341         CHECK_ACCESS(_res_ptr);
28342         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)(_res_ptr);
28343         FREE(untag_ptr(_res));
28344         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_free(_res_conv);
28345 }
28346
28347 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ *NONNULL_PTR arg) {
28348         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
28349         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone(arg);
28350         return tag_ptr(ret_conv, true);
28351 }
28352 int64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone_ptr"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone_ptr(uint64_t arg) {
28353         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)untag_ptr(arg);
28354         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone_ptr(arg_conv);
28355         return ret_conv;
28356 }
28357
28358 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone(uint64_t orig) {
28359         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)untag_ptr(orig);
28360         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
28361         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone(orig_conv);
28362         return tag_ptr(ret_conv, true);
28363 }
28364
28365 uint64_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_ok"))) TS_CResult_StrSecp256k1ErrorZ_ok(jstring o) {
28366         LDKStr o_conv = str_ref_to_owned_c(o);
28367         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
28368         *ret_conv = CResult_StrSecp256k1ErrorZ_ok(o_conv);
28369         return tag_ptr(ret_conv, true);
28370 }
28371
28372 uint64_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_err"))) TS_CResult_StrSecp256k1ErrorZ_err(uint32_t e) {
28373         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
28374         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
28375         *ret_conv = CResult_StrSecp256k1ErrorZ_err(e_conv);
28376         return tag_ptr(ret_conv, true);
28377 }
28378
28379 jboolean  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_is_ok"))) TS_CResult_StrSecp256k1ErrorZ_is_ok(uint64_t o) {
28380         LDKCResult_StrSecp256k1ErrorZ* o_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(o);
28381         jboolean ret_conv = CResult_StrSecp256k1ErrorZ_is_ok(o_conv);
28382         return ret_conv;
28383 }
28384
28385 void  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_free"))) TS_CResult_StrSecp256k1ErrorZ_free(uint64_t _res) {
28386         if (!ptr_is_owned(_res)) return;
28387         void* _res_ptr = untag_ptr(_res);
28388         CHECK_ACCESS(_res_ptr);
28389         LDKCResult_StrSecp256k1ErrorZ _res_conv = *(LDKCResult_StrSecp256k1ErrorZ*)(_res_ptr);
28390         FREE(untag_ptr(_res));
28391         CResult_StrSecp256k1ErrorZ_free(_res_conv);
28392 }
28393
28394 static inline uint64_t CResult_StrSecp256k1ErrorZ_clone_ptr(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR arg) {
28395         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
28396         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(arg);
28397         return tag_ptr(ret_conv, true);
28398 }
28399 int64_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_clone_ptr"))) TS_CResult_StrSecp256k1ErrorZ_clone_ptr(uint64_t arg) {
28400         LDKCResult_StrSecp256k1ErrorZ* arg_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(arg);
28401         int64_t ret_conv = CResult_StrSecp256k1ErrorZ_clone_ptr(arg_conv);
28402         return ret_conv;
28403 }
28404
28405 uint64_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_clone"))) TS_CResult_StrSecp256k1ErrorZ_clone(uint64_t orig) {
28406         LDKCResult_StrSecp256k1ErrorZ* orig_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(orig);
28407         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
28408         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(orig_conv);
28409         return tag_ptr(ret_conv, true);
28410 }
28411
28412 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_ok(uint64_t o) {
28413         void* o_ptr = untag_ptr(o);
28414         CHECK_ACCESS(o_ptr);
28415         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
28416         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
28417         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
28418         *ret_conv = CResult_TxOutUtxoLookupErrorZ_ok(o_conv);
28419         return tag_ptr(ret_conv, true);
28420 }
28421
28422 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_err"))) TS_CResult_TxOutUtxoLookupErrorZ_err(uint32_t e) {
28423         LDKUtxoLookupError e_conv = LDKUtxoLookupError_from_js(e);
28424         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
28425         *ret_conv = CResult_TxOutUtxoLookupErrorZ_err(e_conv);
28426         return tag_ptr(ret_conv, true);
28427 }
28428
28429 jboolean  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_is_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_is_ok(uint64_t o) {
28430         LDKCResult_TxOutUtxoLookupErrorZ* o_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(o);
28431         jboolean ret_conv = CResult_TxOutUtxoLookupErrorZ_is_ok(o_conv);
28432         return ret_conv;
28433 }
28434
28435 void  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_free"))) TS_CResult_TxOutUtxoLookupErrorZ_free(uint64_t _res) {
28436         if (!ptr_is_owned(_res)) return;
28437         void* _res_ptr = untag_ptr(_res);
28438         CHECK_ACCESS(_res_ptr);
28439         LDKCResult_TxOutUtxoLookupErrorZ _res_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(_res_ptr);
28440         FREE(untag_ptr(_res));
28441         CResult_TxOutUtxoLookupErrorZ_free(_res_conv);
28442 }
28443
28444 static inline uint64_t CResult_TxOutUtxoLookupErrorZ_clone_ptr(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR arg) {
28445         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
28446         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(arg);
28447         return tag_ptr(ret_conv, true);
28448 }
28449 int64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_clone_ptr"))) TS_CResult_TxOutUtxoLookupErrorZ_clone_ptr(uint64_t arg) {
28450         LDKCResult_TxOutUtxoLookupErrorZ* arg_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(arg);
28451         int64_t ret_conv = CResult_TxOutUtxoLookupErrorZ_clone_ptr(arg_conv);
28452         return ret_conv;
28453 }
28454
28455 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_clone"))) TS_CResult_TxOutUtxoLookupErrorZ_clone(uint64_t orig) {
28456         LDKCResult_TxOutUtxoLookupErrorZ* orig_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(orig);
28457         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
28458         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(orig_conv);
28459         return tag_ptr(ret_conv, true);
28460 }
28461
28462 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_ok"))) TS_CResult_OnionMessagePathNoneZ_ok(uint64_t o) {
28463         LDKOnionMessagePath o_conv;
28464         o_conv.inner = untag_ptr(o);
28465         o_conv.is_owned = ptr_is_owned(o);
28466         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28467         o_conv = OnionMessagePath_clone(&o_conv);
28468         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
28469         *ret_conv = CResult_OnionMessagePathNoneZ_ok(o_conv);
28470         return tag_ptr(ret_conv, true);
28471 }
28472
28473 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_err"))) TS_CResult_OnionMessagePathNoneZ_err() {
28474         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
28475         *ret_conv = CResult_OnionMessagePathNoneZ_err();
28476         return tag_ptr(ret_conv, true);
28477 }
28478
28479 jboolean  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_is_ok"))) TS_CResult_OnionMessagePathNoneZ_is_ok(uint64_t o) {
28480         LDKCResult_OnionMessagePathNoneZ* o_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(o);
28481         jboolean ret_conv = CResult_OnionMessagePathNoneZ_is_ok(o_conv);
28482         return ret_conv;
28483 }
28484
28485 void  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_free"))) TS_CResult_OnionMessagePathNoneZ_free(uint64_t _res) {
28486         if (!ptr_is_owned(_res)) return;
28487         void* _res_ptr = untag_ptr(_res);
28488         CHECK_ACCESS(_res_ptr);
28489         LDKCResult_OnionMessagePathNoneZ _res_conv = *(LDKCResult_OnionMessagePathNoneZ*)(_res_ptr);
28490         FREE(untag_ptr(_res));
28491         CResult_OnionMessagePathNoneZ_free(_res_conv);
28492 }
28493
28494 static inline uint64_t CResult_OnionMessagePathNoneZ_clone_ptr(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR arg) {
28495         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
28496         *ret_conv = CResult_OnionMessagePathNoneZ_clone(arg);
28497         return tag_ptr(ret_conv, true);
28498 }
28499 int64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_clone_ptr"))) TS_CResult_OnionMessagePathNoneZ_clone_ptr(uint64_t arg) {
28500         LDKCResult_OnionMessagePathNoneZ* arg_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(arg);
28501         int64_t ret_conv = CResult_OnionMessagePathNoneZ_clone_ptr(arg_conv);
28502         return ret_conv;
28503 }
28504
28505 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_clone"))) TS_CResult_OnionMessagePathNoneZ_clone(uint64_t orig) {
28506         LDKCResult_OnionMessagePathNoneZ* orig_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(orig);
28507         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
28508         *ret_conv = CResult_OnionMessagePathNoneZ_clone(orig_conv);
28509         return tag_ptr(ret_conv, true);
28510 }
28511
28512 static inline uint64_t C2Tuple_PublicKeyOnionMessageZ_clone_ptr(LDKC2Tuple_PublicKeyOnionMessageZ *NONNULL_PTR arg) {
28513         LDKC2Tuple_PublicKeyOnionMessageZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyOnionMessageZ), "LDKC2Tuple_PublicKeyOnionMessageZ");
28514         *ret_conv = C2Tuple_PublicKeyOnionMessageZ_clone(arg);
28515         return tag_ptr(ret_conv, true);
28516 }
28517 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyOnionMessageZ_clone_ptr"))) TS_C2Tuple_PublicKeyOnionMessageZ_clone_ptr(uint64_t arg) {
28518         LDKC2Tuple_PublicKeyOnionMessageZ* arg_conv = (LDKC2Tuple_PublicKeyOnionMessageZ*)untag_ptr(arg);
28519         int64_t ret_conv = C2Tuple_PublicKeyOnionMessageZ_clone_ptr(arg_conv);
28520         return ret_conv;
28521 }
28522
28523 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyOnionMessageZ_clone"))) TS_C2Tuple_PublicKeyOnionMessageZ_clone(uint64_t orig) {
28524         LDKC2Tuple_PublicKeyOnionMessageZ* orig_conv = (LDKC2Tuple_PublicKeyOnionMessageZ*)untag_ptr(orig);
28525         LDKC2Tuple_PublicKeyOnionMessageZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyOnionMessageZ), "LDKC2Tuple_PublicKeyOnionMessageZ");
28526         *ret_conv = C2Tuple_PublicKeyOnionMessageZ_clone(orig_conv);
28527         return tag_ptr(ret_conv, true);
28528 }
28529
28530 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyOnionMessageZ_new"))) TS_C2Tuple_PublicKeyOnionMessageZ_new(int8_tArray a, uint64_t b) {
28531         LDKPublicKey a_ref;
28532         CHECK(a->arr_len == 33);
28533         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
28534         LDKOnionMessage b_conv;
28535         b_conv.inner = untag_ptr(b);
28536         b_conv.is_owned = ptr_is_owned(b);
28537         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
28538         b_conv = OnionMessage_clone(&b_conv);
28539         LDKC2Tuple_PublicKeyOnionMessageZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyOnionMessageZ), "LDKC2Tuple_PublicKeyOnionMessageZ");
28540         *ret_conv = C2Tuple_PublicKeyOnionMessageZ_new(a_ref, b_conv);
28541         return tag_ptr(ret_conv, true);
28542 }
28543
28544 void  __attribute__((export_name("TS_C2Tuple_PublicKeyOnionMessageZ_free"))) TS_C2Tuple_PublicKeyOnionMessageZ_free(uint64_t _res) {
28545         if (!ptr_is_owned(_res)) return;
28546         void* _res_ptr = untag_ptr(_res);
28547         CHECK_ACCESS(_res_ptr);
28548         LDKC2Tuple_PublicKeyOnionMessageZ _res_conv = *(LDKC2Tuple_PublicKeyOnionMessageZ*)(_res_ptr);
28549         FREE(untag_ptr(_res));
28550         C2Tuple_PublicKeyOnionMessageZ_free(_res_conv);
28551 }
28552
28553 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_ok"))) TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_ok(uint64_t o) {
28554         void* o_ptr = untag_ptr(o);
28555         CHECK_ACCESS(o_ptr);
28556         LDKC2Tuple_PublicKeyOnionMessageZ o_conv = *(LDKC2Tuple_PublicKeyOnionMessageZ*)(o_ptr);
28557         o_conv = C2Tuple_PublicKeyOnionMessageZ_clone((LDKC2Tuple_PublicKeyOnionMessageZ*)untag_ptr(o));
28558         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ), "LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ");
28559         *ret_conv = CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_ok(o_conv);
28560         return tag_ptr(ret_conv, true);
28561 }
28562
28563 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_err"))) TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_err(uint64_t e) {
28564         void* e_ptr = untag_ptr(e);
28565         CHECK_ACCESS(e_ptr);
28566         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
28567         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
28568         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ), "LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ");
28569         *ret_conv = CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_err(e_conv);
28570         return tag_ptr(ret_conv, true);
28571 }
28572
28573 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_is_ok"))) TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_is_ok(uint64_t o) {
28574         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* o_conv = (LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ*)untag_ptr(o);
28575         jboolean ret_conv = CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_is_ok(o_conv);
28576         return ret_conv;
28577 }
28578
28579 void  __attribute__((export_name("TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_free"))) TS_CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_free(uint64_t _res) {
28580         if (!ptr_is_owned(_res)) return;
28581         void* _res_ptr = untag_ptr(_res);
28582         CHECK_ACCESS(_res_ptr);
28583         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ _res_conv = *(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ*)(_res_ptr);
28584         FREE(untag_ptr(_res));
28585         CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_free(_res_conv);
28586 }
28587
28588 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_ok"))) TS_CResult_NoneSendErrorZ_ok() {
28589         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
28590         *ret_conv = CResult_NoneSendErrorZ_ok();
28591         return tag_ptr(ret_conv, true);
28592 }
28593
28594 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_err"))) TS_CResult_NoneSendErrorZ_err(uint64_t e) {
28595         void* e_ptr = untag_ptr(e);
28596         CHECK_ACCESS(e_ptr);
28597         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
28598         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
28599         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
28600         *ret_conv = CResult_NoneSendErrorZ_err(e_conv);
28601         return tag_ptr(ret_conv, true);
28602 }
28603
28604 jboolean  __attribute__((export_name("TS_CResult_NoneSendErrorZ_is_ok"))) TS_CResult_NoneSendErrorZ_is_ok(uint64_t o) {
28605         LDKCResult_NoneSendErrorZ* o_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(o);
28606         jboolean ret_conv = CResult_NoneSendErrorZ_is_ok(o_conv);
28607         return ret_conv;
28608 }
28609
28610 void  __attribute__((export_name("TS_CResult_NoneSendErrorZ_free"))) TS_CResult_NoneSendErrorZ_free(uint64_t _res) {
28611         if (!ptr_is_owned(_res)) return;
28612         void* _res_ptr = untag_ptr(_res);
28613         CHECK_ACCESS(_res_ptr);
28614         LDKCResult_NoneSendErrorZ _res_conv = *(LDKCResult_NoneSendErrorZ*)(_res_ptr);
28615         FREE(untag_ptr(_res));
28616         CResult_NoneSendErrorZ_free(_res_conv);
28617 }
28618
28619 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_ok"))) TS_CResult_BlindedPathNoneZ_ok(uint64_t o) {
28620         LDKBlindedPath o_conv;
28621         o_conv.inner = untag_ptr(o);
28622         o_conv.is_owned = ptr_is_owned(o);
28623         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28624         o_conv = BlindedPath_clone(&o_conv);
28625         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
28626         *ret_conv = CResult_BlindedPathNoneZ_ok(o_conv);
28627         return tag_ptr(ret_conv, true);
28628 }
28629
28630 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_err"))) TS_CResult_BlindedPathNoneZ_err() {
28631         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
28632         *ret_conv = CResult_BlindedPathNoneZ_err();
28633         return tag_ptr(ret_conv, true);
28634 }
28635
28636 jboolean  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_is_ok"))) TS_CResult_BlindedPathNoneZ_is_ok(uint64_t o) {
28637         LDKCResult_BlindedPathNoneZ* o_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(o);
28638         jboolean ret_conv = CResult_BlindedPathNoneZ_is_ok(o_conv);
28639         return ret_conv;
28640 }
28641
28642 void  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_free"))) TS_CResult_BlindedPathNoneZ_free(uint64_t _res) {
28643         if (!ptr_is_owned(_res)) return;
28644         void* _res_ptr = untag_ptr(_res);
28645         CHECK_ACCESS(_res_ptr);
28646         LDKCResult_BlindedPathNoneZ _res_conv = *(LDKCResult_BlindedPathNoneZ*)(_res_ptr);
28647         FREE(untag_ptr(_res));
28648         CResult_BlindedPathNoneZ_free(_res_conv);
28649 }
28650
28651 static inline uint64_t CResult_BlindedPathNoneZ_clone_ptr(LDKCResult_BlindedPathNoneZ *NONNULL_PTR arg) {
28652         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
28653         *ret_conv = CResult_BlindedPathNoneZ_clone(arg);
28654         return tag_ptr(ret_conv, true);
28655 }
28656 int64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_clone_ptr"))) TS_CResult_BlindedPathNoneZ_clone_ptr(uint64_t arg) {
28657         LDKCResult_BlindedPathNoneZ* arg_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(arg);
28658         int64_t ret_conv = CResult_BlindedPathNoneZ_clone_ptr(arg_conv);
28659         return ret_conv;
28660 }
28661
28662 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_clone"))) TS_CResult_BlindedPathNoneZ_clone(uint64_t orig) {
28663         LDKCResult_BlindedPathNoneZ* orig_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(orig);
28664         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
28665         *ret_conv = CResult_BlindedPathNoneZ_clone(orig_conv);
28666         return tag_ptr(ret_conv, true);
28667 }
28668
28669 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(uint64_t o) {
28670         void* o_ptr = untag_ptr(o);
28671         CHECK_ACCESS(o_ptr);
28672         LDKC2Tuple_BlindedPayInfoBlindedPathZ o_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(o_ptr);
28673         o_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(o));
28674         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
28675         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(o_conv);
28676         return tag_ptr(ret_conv, true);
28677 }
28678
28679 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err() {
28680         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
28681         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err();
28682         return tag_ptr(ret_conv, true);
28683 }
28684
28685 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(uint64_t o) {
28686         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* o_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(o);
28687         jboolean ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(o_conv);
28688         return ret_conv;
28689 }
28690
28691 void  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(uint64_t _res) {
28692         if (!ptr_is_owned(_res)) return;
28693         void* _res_ptr = untag_ptr(_res);
28694         CHECK_ACCESS(_res_ptr);
28695         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ _res_conv = *(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)(_res_ptr);
28696         FREE(untag_ptr(_res));
28697         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(_res_conv);
28698 }
28699
28700 static inline uint64_t CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR arg) {
28701         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
28702         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(arg);
28703         return tag_ptr(ret_conv, true);
28704 }
28705 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(uint64_t arg) {
28706         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* arg_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(arg);
28707         int64_t ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(arg_conv);
28708         return ret_conv;
28709 }
28710
28711 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(uint64_t orig) {
28712         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* orig_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(orig);
28713         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
28714         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(orig_conv);
28715         return tag_ptr(ret_conv, true);
28716 }
28717
28718 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_ok"))) TS_CResult_BlindedPathDecodeErrorZ_ok(uint64_t o) {
28719         LDKBlindedPath o_conv;
28720         o_conv.inner = untag_ptr(o);
28721         o_conv.is_owned = ptr_is_owned(o);
28722         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28723         o_conv = BlindedPath_clone(&o_conv);
28724         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
28725         *ret_conv = CResult_BlindedPathDecodeErrorZ_ok(o_conv);
28726         return tag_ptr(ret_conv, true);
28727 }
28728
28729 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_err"))) TS_CResult_BlindedPathDecodeErrorZ_err(uint64_t e) {
28730         void* e_ptr = untag_ptr(e);
28731         CHECK_ACCESS(e_ptr);
28732         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28733         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28734         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
28735         *ret_conv = CResult_BlindedPathDecodeErrorZ_err(e_conv);
28736         return tag_ptr(ret_conv, true);
28737 }
28738
28739 jboolean  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_is_ok"))) TS_CResult_BlindedPathDecodeErrorZ_is_ok(uint64_t o) {
28740         LDKCResult_BlindedPathDecodeErrorZ* o_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(o);
28741         jboolean ret_conv = CResult_BlindedPathDecodeErrorZ_is_ok(o_conv);
28742         return ret_conv;
28743 }
28744
28745 void  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_free"))) TS_CResult_BlindedPathDecodeErrorZ_free(uint64_t _res) {
28746         if (!ptr_is_owned(_res)) return;
28747         void* _res_ptr = untag_ptr(_res);
28748         CHECK_ACCESS(_res_ptr);
28749         LDKCResult_BlindedPathDecodeErrorZ _res_conv = *(LDKCResult_BlindedPathDecodeErrorZ*)(_res_ptr);
28750         FREE(untag_ptr(_res));
28751         CResult_BlindedPathDecodeErrorZ_free(_res_conv);
28752 }
28753
28754 static inline uint64_t CResult_BlindedPathDecodeErrorZ_clone_ptr(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR arg) {
28755         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
28756         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(arg);
28757         return tag_ptr(ret_conv, true);
28758 }
28759 int64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedPathDecodeErrorZ_clone_ptr(uint64_t arg) {
28760         LDKCResult_BlindedPathDecodeErrorZ* arg_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(arg);
28761         int64_t ret_conv = CResult_BlindedPathDecodeErrorZ_clone_ptr(arg_conv);
28762         return ret_conv;
28763 }
28764
28765 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_clone"))) TS_CResult_BlindedPathDecodeErrorZ_clone(uint64_t orig) {
28766         LDKCResult_BlindedPathDecodeErrorZ* orig_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(orig);
28767         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
28768         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(orig_conv);
28769         return tag_ptr(ret_conv, true);
28770 }
28771
28772 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_ok"))) TS_CResult_BlindedHopDecodeErrorZ_ok(uint64_t o) {
28773         LDKBlindedHop o_conv;
28774         o_conv.inner = untag_ptr(o);
28775         o_conv.is_owned = ptr_is_owned(o);
28776         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28777         o_conv = BlindedHop_clone(&o_conv);
28778         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
28779         *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv);
28780         return tag_ptr(ret_conv, true);
28781 }
28782
28783 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_err"))) TS_CResult_BlindedHopDecodeErrorZ_err(uint64_t e) {
28784         void* e_ptr = untag_ptr(e);
28785         CHECK_ACCESS(e_ptr);
28786         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28787         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28788         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
28789         *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv);
28790         return tag_ptr(ret_conv, true);
28791 }
28792
28793 jboolean  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopDecodeErrorZ_is_ok(uint64_t o) {
28794         LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o);
28795         jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv);
28796         return ret_conv;
28797 }
28798
28799 void  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_free"))) TS_CResult_BlindedHopDecodeErrorZ_free(uint64_t _res) {
28800         if (!ptr_is_owned(_res)) return;
28801         void* _res_ptr = untag_ptr(_res);
28802         CHECK_ACCESS(_res_ptr);
28803         LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr);
28804         FREE(untag_ptr(_res));
28805         CResult_BlindedHopDecodeErrorZ_free(_res_conv);
28806 }
28807
28808 static inline uint64_t CResult_BlindedHopDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR arg) {
28809         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
28810         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(arg);
28811         return tag_ptr(ret_conv, true);
28812 }
28813 int64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedHopDecodeErrorZ_clone_ptr(uint64_t arg) {
28814         LDKCResult_BlindedHopDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(arg);
28815         int64_t ret_conv = CResult_BlindedHopDecodeErrorZ_clone_ptr(arg_conv);
28816         return ret_conv;
28817 }
28818
28819 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_clone"))) TS_CResult_BlindedHopDecodeErrorZ_clone(uint64_t orig) {
28820         LDKCResult_BlindedHopDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(orig);
28821         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
28822         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(orig_conv);
28823         return tag_ptr(ret_conv, true);
28824 }
28825
28826 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_ok"))) TS_CResult_InvoiceErrorDecodeErrorZ_ok(uint64_t o) {
28827         LDKInvoiceError o_conv;
28828         o_conv.inner = untag_ptr(o);
28829         o_conv.is_owned = ptr_is_owned(o);
28830         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28831         o_conv = InvoiceError_clone(&o_conv);
28832         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
28833         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_ok(o_conv);
28834         return tag_ptr(ret_conv, true);
28835 }
28836
28837 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_err"))) TS_CResult_InvoiceErrorDecodeErrorZ_err(uint64_t e) {
28838         void* e_ptr = untag_ptr(e);
28839         CHECK_ACCESS(e_ptr);
28840         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28841         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28842         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
28843         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_err(e_conv);
28844         return tag_ptr(ret_conv, true);
28845 }
28846
28847 jboolean  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_is_ok"))) TS_CResult_InvoiceErrorDecodeErrorZ_is_ok(uint64_t o) {
28848         LDKCResult_InvoiceErrorDecodeErrorZ* o_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(o);
28849         jboolean ret_conv = CResult_InvoiceErrorDecodeErrorZ_is_ok(o_conv);
28850         return ret_conv;
28851 }
28852
28853 void  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_free"))) TS_CResult_InvoiceErrorDecodeErrorZ_free(uint64_t _res) {
28854         if (!ptr_is_owned(_res)) return;
28855         void* _res_ptr = untag_ptr(_res);
28856         CHECK_ACCESS(_res_ptr);
28857         LDKCResult_InvoiceErrorDecodeErrorZ _res_conv = *(LDKCResult_InvoiceErrorDecodeErrorZ*)(_res_ptr);
28858         FREE(untag_ptr(_res));
28859         CResult_InvoiceErrorDecodeErrorZ_free(_res_conv);
28860 }
28861
28862 static inline uint64_t CResult_InvoiceErrorDecodeErrorZ_clone_ptr(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR arg) {
28863         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
28864         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(arg);
28865         return tag_ptr(ret_conv, true);
28866 }
28867 int64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_clone_ptr"))) TS_CResult_InvoiceErrorDecodeErrorZ_clone_ptr(uint64_t arg) {
28868         LDKCResult_InvoiceErrorDecodeErrorZ* arg_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(arg);
28869         int64_t ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone_ptr(arg_conv);
28870         return ret_conv;
28871 }
28872
28873 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_clone"))) TS_CResult_InvoiceErrorDecodeErrorZ_clone(uint64_t orig) {
28874         LDKCResult_InvoiceErrorDecodeErrorZ* orig_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(orig);
28875         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
28876         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(orig_conv);
28877         return tag_ptr(ret_conv, true);
28878 }
28879
28880 uint64_t  __attribute__((export_name("TS_COption_FilterZ_some"))) TS_COption_FilterZ_some(uint64_t o) {
28881         void* o_ptr = untag_ptr(o);
28882         CHECK_ACCESS(o_ptr);
28883         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
28884         if (o_conv.free == LDKFilter_JCalls_free) {
28885                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28886                 LDKFilter_JCalls_cloned(&o_conv);
28887         }
28888         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
28889         *ret_copy = COption_FilterZ_some(o_conv);
28890         uint64_t ret_ref = tag_ptr(ret_copy, true);
28891         return ret_ref;
28892 }
28893
28894 uint64_t  __attribute__((export_name("TS_COption_FilterZ_none"))) TS_COption_FilterZ_none() {
28895         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
28896         *ret_copy = COption_FilterZ_none();
28897         uint64_t ret_ref = tag_ptr(ret_copy, true);
28898         return ret_ref;
28899 }
28900
28901 void  __attribute__((export_name("TS_COption_FilterZ_free"))) TS_COption_FilterZ_free(uint64_t _res) {
28902         if (!ptr_is_owned(_res)) return;
28903         void* _res_ptr = untag_ptr(_res);
28904         CHECK_ACCESS(_res_ptr);
28905         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
28906         FREE(untag_ptr(_res));
28907         COption_FilterZ_free(_res_conv);
28908 }
28909
28910 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_ok"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint64_t o) {
28911         LDKLockedChannelMonitor o_conv;
28912         o_conv.inner = untag_ptr(o);
28913         o_conv.is_owned = ptr_is_owned(o);
28914         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28915         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
28916         
28917         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
28918         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
28919         return tag_ptr(ret_conv, true);
28920 }
28921
28922 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_err"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
28923         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
28924         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
28925         return tag_ptr(ret_conv, true);
28926 }
28927
28928 jboolean  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_is_ok"))) TS_CResult_LockedChannelMonitorNoneZ_is_ok(uint64_t o) {
28929         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
28930         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
28931         return ret_conv;
28932 }
28933
28934 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_free"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint64_t _res) {
28935         if (!ptr_is_owned(_res)) return;
28936         void* _res_ptr = untag_ptr(_res);
28937         CHECK_ACCESS(_res_ptr);
28938         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
28939         FREE(untag_ptr(_res));
28940         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
28941 }
28942
28943 void  __attribute__((export_name("TS_CVec_OutPointZ_free"))) TS_CVec_OutPointZ_free(uint64_tArray _res) {
28944         LDKCVec_OutPointZ _res_constr;
28945         _res_constr.datalen = _res->arr_len;
28946         if (_res_constr.datalen > 0)
28947                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
28948         else
28949                 _res_constr.data = NULL;
28950         uint64_t* _res_vals = _res->elems;
28951         for (size_t k = 0; k < _res_constr.datalen; k++) {
28952                 uint64_t _res_conv_10 = _res_vals[k];
28953                 LDKOutPoint _res_conv_10_conv;
28954                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
28955                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
28956                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
28957                 _res_constr.data[k] = _res_conv_10_conv;
28958         }
28959         FREE(_res);
28960         CVec_OutPointZ_free(_res_constr);
28961 }
28962
28963 void  __attribute__((export_name("TS_CVec_MonitorUpdateIdZ_free"))) TS_CVec_MonitorUpdateIdZ_free(uint64_tArray _res) {
28964         LDKCVec_MonitorUpdateIdZ _res_constr;
28965         _res_constr.datalen = _res->arr_len;
28966         if (_res_constr.datalen > 0)
28967                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
28968         else
28969                 _res_constr.data = NULL;
28970         uint64_t* _res_vals = _res->elems;
28971         for (size_t r = 0; r < _res_constr.datalen; r++) {
28972                 uint64_t _res_conv_17 = _res_vals[r];
28973                 LDKMonitorUpdateId _res_conv_17_conv;
28974                 _res_conv_17_conv.inner = untag_ptr(_res_conv_17);
28975                 _res_conv_17_conv.is_owned = ptr_is_owned(_res_conv_17);
28976                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_17_conv);
28977                 _res_constr.data[r] = _res_conv_17_conv;
28978         }
28979         FREE(_res);
28980         CVec_MonitorUpdateIdZ_free(_res_constr);
28981 }
28982
28983 static inline uint64_t C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR arg) {
28984         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
28985         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(arg);
28986         return tag_ptr(ret_conv, true);
28987 }
28988 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(uint64_t arg) {
28989         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(arg);
28990         int64_t ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(arg_conv);
28991         return ret_conv;
28992 }
28993
28994 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(uint64_t orig) {
28995         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(orig);
28996         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
28997         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig_conv);
28998         return tag_ptr(ret_conv, true);
28999 }
29000
29001 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(uint64_t a, uint64_tArray b) {
29002         LDKOutPoint a_conv;
29003         a_conv.inner = untag_ptr(a);
29004         a_conv.is_owned = ptr_is_owned(a);
29005         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29006         a_conv = OutPoint_clone(&a_conv);
29007         LDKCVec_MonitorUpdateIdZ b_constr;
29008         b_constr.datalen = b->arr_len;
29009         if (b_constr.datalen > 0)
29010                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
29011         else
29012                 b_constr.data = NULL;
29013         uint64_t* b_vals = b->elems;
29014         for (size_t r = 0; r < b_constr.datalen; r++) {
29015                 uint64_t b_conv_17 = b_vals[r];
29016                 LDKMonitorUpdateId b_conv_17_conv;
29017                 b_conv_17_conv.inner = untag_ptr(b_conv_17);
29018                 b_conv_17_conv.is_owned = ptr_is_owned(b_conv_17);
29019                 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv_17_conv);
29020                 b_conv_17_conv = MonitorUpdateId_clone(&b_conv_17_conv);
29021                 b_constr.data[r] = b_conv_17_conv;
29022         }
29023         FREE(b);
29024         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
29025         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a_conv, b_constr);
29026         return tag_ptr(ret_conv, true);
29027 }
29028
29029 void  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(uint64_t _res) {
29030         if (!ptr_is_owned(_res)) return;
29031         void* _res_ptr = untag_ptr(_res);
29032         CHECK_ACCESS(_res_ptr);
29033         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_ptr);
29034         FREE(untag_ptr(_res));
29035         C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res_conv);
29036 }
29037
29038 void  __attribute__((export_name("TS_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free"))) TS_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(uint64_tArray _res) {
29039         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res_constr;
29040         _res_constr.datalen = _res->arr_len;
29041         if (_res_constr.datalen > 0)
29042                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ Elements");
29043         else
29044                 _res_constr.data = NULL;
29045         uint64_t* _res_vals = _res->elems;
29046         for (size_t p = 0; p < _res_constr.datalen; p++) {
29047                 uint64_t _res_conv_41 = _res_vals[p];
29048                 void* _res_conv_41_ptr = untag_ptr(_res_conv_41);
29049                 CHECK_ACCESS(_res_conv_41_ptr);
29050                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv_41_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_conv_41_ptr);
29051                 FREE(untag_ptr(_res_conv_41));
29052                 _res_constr.data[p] = _res_conv_41_conv;
29053         }
29054         FREE(_res);
29055         CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res_constr);
29056 }
29057
29058 void  __attribute__((export_name("TS_APIError_free"))) TS_APIError_free(uint64_t this_ptr) {
29059         if (!ptr_is_owned(this_ptr)) return;
29060         void* this_ptr_ptr = untag_ptr(this_ptr);
29061         CHECK_ACCESS(this_ptr_ptr);
29062         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
29063         FREE(untag_ptr(this_ptr));
29064         APIError_free(this_ptr_conv);
29065 }
29066
29067 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
29068         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
29069         *ret_copy = APIError_clone(arg);
29070         uint64_t ret_ref = tag_ptr(ret_copy, true);
29071         return ret_ref;
29072 }
29073 int64_t  __attribute__((export_name("TS_APIError_clone_ptr"))) TS_APIError_clone_ptr(uint64_t arg) {
29074         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
29075         int64_t ret_conv = APIError_clone_ptr(arg_conv);
29076         return ret_conv;
29077 }
29078
29079 uint64_t  __attribute__((export_name("TS_APIError_clone"))) TS_APIError_clone(uint64_t orig) {
29080         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
29081         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
29082         *ret_copy = APIError_clone(orig_conv);
29083         uint64_t ret_ref = tag_ptr(ret_copy, true);
29084         return ret_ref;
29085 }
29086
29087 uint64_t  __attribute__((export_name("TS_APIError_apimisuse_error"))) TS_APIError_apimisuse_error(jstring err) {
29088         LDKStr err_conv = str_ref_to_owned_c(err);
29089         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
29090         *ret_copy = APIError_apimisuse_error(err_conv);
29091         uint64_t ret_ref = tag_ptr(ret_copy, true);
29092         return ret_ref;
29093 }
29094
29095 uint64_t  __attribute__((export_name("TS_APIError_fee_rate_too_high"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
29096         LDKStr err_conv = str_ref_to_owned_c(err);
29097         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
29098         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
29099         uint64_t ret_ref = tag_ptr(ret_copy, true);
29100         return ret_ref;
29101 }
29102
29103 uint64_t  __attribute__((export_name("TS_APIError_invalid_route"))) TS_APIError_invalid_route(jstring err) {
29104         LDKStr err_conv = str_ref_to_owned_c(err);
29105         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
29106         *ret_copy = APIError_invalid_route(err_conv);
29107         uint64_t ret_ref = tag_ptr(ret_copy, true);
29108         return ret_ref;
29109 }
29110
29111 uint64_t  __attribute__((export_name("TS_APIError_channel_unavailable"))) TS_APIError_channel_unavailable(jstring err) {
29112         LDKStr err_conv = str_ref_to_owned_c(err);
29113         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
29114         *ret_copy = APIError_channel_unavailable(err_conv);
29115         uint64_t ret_ref = tag_ptr(ret_copy, true);
29116         return ret_ref;
29117 }
29118
29119 uint64_t  __attribute__((export_name("TS_APIError_monitor_update_in_progress"))) TS_APIError_monitor_update_in_progress() {
29120         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
29121         *ret_copy = APIError_monitor_update_in_progress();
29122         uint64_t ret_ref = tag_ptr(ret_copy, true);
29123         return ret_ref;
29124 }
29125
29126 uint64_t  __attribute__((export_name("TS_APIError_incompatible_shutdown_script"))) TS_APIError_incompatible_shutdown_script(uint64_t script) {
29127         LDKShutdownScript script_conv;
29128         script_conv.inner = untag_ptr(script);
29129         script_conv.is_owned = ptr_is_owned(script);
29130         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
29131         script_conv = ShutdownScript_clone(&script_conv);
29132         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
29133         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
29134         uint64_t ret_ref = tag_ptr(ret_copy, true);
29135         return ret_ref;
29136 }
29137
29138 jboolean  __attribute__((export_name("TS_APIError_eq"))) TS_APIError_eq(uint64_t a, uint64_t b) {
29139         LDKAPIError* a_conv = (LDKAPIError*)untag_ptr(a);
29140         LDKAPIError* b_conv = (LDKAPIError*)untag_ptr(b);
29141         jboolean ret_conv = APIError_eq(a_conv, b_conv);
29142         return ret_conv;
29143 }
29144
29145 int8_tArray  __attribute__((export_name("TS_APIError_write"))) TS_APIError_write(uint64_t obj) {
29146         LDKAPIError* obj_conv = (LDKAPIError*)untag_ptr(obj);
29147         LDKCVec_u8Z ret_var = APIError_write(obj_conv);
29148         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29149         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29150         CVec_u8Z_free(ret_var);
29151         return ret_arr;
29152 }
29153
29154 uint64_t  __attribute__((export_name("TS_APIError_read"))) TS_APIError_read(int8_tArray ser) {
29155         LDKu8slice ser_ref;
29156         ser_ref.datalen = ser->arr_len;
29157         ser_ref.data = ser->elems;
29158         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
29159         *ret_conv = APIError_read(ser_ref);
29160         FREE(ser);
29161         return tag_ptr(ret_conv, true);
29162 }
29163
29164 void  __attribute__((export_name("TS_BigSize_free"))) TS_BigSize_free(uint64_t this_obj) {
29165         LDKBigSize this_obj_conv;
29166         this_obj_conv.inner = untag_ptr(this_obj);
29167         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29169         BigSize_free(this_obj_conv);
29170 }
29171
29172 int64_t  __attribute__((export_name("TS_BigSize_get_a"))) TS_BigSize_get_a(uint64_t this_ptr) {
29173         LDKBigSize this_ptr_conv;
29174         this_ptr_conv.inner = untag_ptr(this_ptr);
29175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29177         this_ptr_conv.is_owned = false;
29178         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
29179         return ret_conv;
29180 }
29181
29182 void  __attribute__((export_name("TS_BigSize_set_a"))) TS_BigSize_set_a(uint64_t this_ptr, int64_t val) {
29183         LDKBigSize this_ptr_conv;
29184         this_ptr_conv.inner = untag_ptr(this_ptr);
29185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29187         this_ptr_conv.is_owned = false;
29188         BigSize_set_a(&this_ptr_conv, val);
29189 }
29190
29191 uint64_t  __attribute__((export_name("TS_BigSize_new"))) TS_BigSize_new(int64_t a_arg) {
29192         LDKBigSize ret_var = BigSize_new(a_arg);
29193         uint64_t ret_ref = 0;
29194         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29195         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29196         return ret_ref;
29197 }
29198
29199 static inline uint64_t BigSize_clone_ptr(LDKBigSize *NONNULL_PTR arg) {
29200         LDKBigSize ret_var = BigSize_clone(arg);
29201         uint64_t ret_ref = 0;
29202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29204         return ret_ref;
29205 }
29206 int64_t  __attribute__((export_name("TS_BigSize_clone_ptr"))) TS_BigSize_clone_ptr(uint64_t arg) {
29207         LDKBigSize arg_conv;
29208         arg_conv.inner = untag_ptr(arg);
29209         arg_conv.is_owned = ptr_is_owned(arg);
29210         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29211         arg_conv.is_owned = false;
29212         int64_t ret_conv = BigSize_clone_ptr(&arg_conv);
29213         return ret_conv;
29214 }
29215
29216 uint64_t  __attribute__((export_name("TS_BigSize_clone"))) TS_BigSize_clone(uint64_t orig) {
29217         LDKBigSize orig_conv;
29218         orig_conv.inner = untag_ptr(orig);
29219         orig_conv.is_owned = ptr_is_owned(orig);
29220         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29221         orig_conv.is_owned = false;
29222         LDKBigSize ret_var = BigSize_clone(&orig_conv);
29223         uint64_t ret_ref = 0;
29224         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29225         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29226         return ret_ref;
29227 }
29228
29229 int64_t  __attribute__((export_name("TS_BigSize_hash"))) TS_BigSize_hash(uint64_t o) {
29230         LDKBigSize o_conv;
29231         o_conv.inner = untag_ptr(o);
29232         o_conv.is_owned = ptr_is_owned(o);
29233         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29234         o_conv.is_owned = false;
29235         int64_t ret_conv = BigSize_hash(&o_conv);
29236         return ret_conv;
29237 }
29238
29239 jboolean  __attribute__((export_name("TS_BigSize_eq"))) TS_BigSize_eq(uint64_t a, uint64_t b) {
29240         LDKBigSize a_conv;
29241         a_conv.inner = untag_ptr(a);
29242         a_conv.is_owned = ptr_is_owned(a);
29243         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29244         a_conv.is_owned = false;
29245         LDKBigSize b_conv;
29246         b_conv.inner = untag_ptr(b);
29247         b_conv.is_owned = ptr_is_owned(b);
29248         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29249         b_conv.is_owned = false;
29250         jboolean ret_conv = BigSize_eq(&a_conv, &b_conv);
29251         return ret_conv;
29252 }
29253
29254 int8_tArray  __attribute__((export_name("TS_BigSize_write"))) TS_BigSize_write(uint64_t obj) {
29255         LDKBigSize obj_conv;
29256         obj_conv.inner = untag_ptr(obj);
29257         obj_conv.is_owned = ptr_is_owned(obj);
29258         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29259         obj_conv.is_owned = false;
29260         LDKCVec_u8Z ret_var = BigSize_write(&obj_conv);
29261         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29262         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29263         CVec_u8Z_free(ret_var);
29264         return ret_arr;
29265 }
29266
29267 uint64_t  __attribute__((export_name("TS_BigSize_read"))) TS_BigSize_read(int8_tArray ser) {
29268         LDKu8slice ser_ref;
29269         ser_ref.datalen = ser->arr_len;
29270         ser_ref.data = ser->elems;
29271         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
29272         *ret_conv = BigSize_read(ser_ref);
29273         FREE(ser);
29274         return tag_ptr(ret_conv, true);
29275 }
29276
29277 void  __attribute__((export_name("TS_Hostname_free"))) TS_Hostname_free(uint64_t this_obj) {
29278         LDKHostname this_obj_conv;
29279         this_obj_conv.inner = untag_ptr(this_obj);
29280         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29282         Hostname_free(this_obj_conv);
29283 }
29284
29285 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
29286         LDKHostname ret_var = Hostname_clone(arg);
29287         uint64_t ret_ref = 0;
29288         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29289         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29290         return ret_ref;
29291 }
29292 int64_t  __attribute__((export_name("TS_Hostname_clone_ptr"))) TS_Hostname_clone_ptr(uint64_t arg) {
29293         LDKHostname arg_conv;
29294         arg_conv.inner = untag_ptr(arg);
29295         arg_conv.is_owned = ptr_is_owned(arg);
29296         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29297         arg_conv.is_owned = false;
29298         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
29299         return ret_conv;
29300 }
29301
29302 uint64_t  __attribute__((export_name("TS_Hostname_clone"))) TS_Hostname_clone(uint64_t orig) {
29303         LDKHostname orig_conv;
29304         orig_conv.inner = untag_ptr(orig);
29305         orig_conv.is_owned = ptr_is_owned(orig);
29306         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29307         orig_conv.is_owned = false;
29308         LDKHostname ret_var = Hostname_clone(&orig_conv);
29309         uint64_t ret_ref = 0;
29310         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29311         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29312         return ret_ref;
29313 }
29314
29315 jboolean  __attribute__((export_name("TS_Hostname_eq"))) TS_Hostname_eq(uint64_t a, uint64_t b) {
29316         LDKHostname a_conv;
29317         a_conv.inner = untag_ptr(a);
29318         a_conv.is_owned = ptr_is_owned(a);
29319         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29320         a_conv.is_owned = false;
29321         LDKHostname b_conv;
29322         b_conv.inner = untag_ptr(b);
29323         b_conv.is_owned = ptr_is_owned(b);
29324         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29325         b_conv.is_owned = false;
29326         jboolean ret_conv = Hostname_eq(&a_conv, &b_conv);
29327         return ret_conv;
29328 }
29329
29330 int8_t  __attribute__((export_name("TS_Hostname_len"))) TS_Hostname_len(uint64_t this_arg) {
29331         LDKHostname this_arg_conv;
29332         this_arg_conv.inner = untag_ptr(this_arg);
29333         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29335         this_arg_conv.is_owned = false;
29336         int8_t ret_conv = Hostname_len(&this_arg_conv);
29337         return ret_conv;
29338 }
29339
29340 int8_tArray  __attribute__((export_name("TS_Hostname_write"))) TS_Hostname_write(uint64_t obj) {
29341         LDKHostname obj_conv;
29342         obj_conv.inner = untag_ptr(obj);
29343         obj_conv.is_owned = ptr_is_owned(obj);
29344         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29345         obj_conv.is_owned = false;
29346         LDKCVec_u8Z ret_var = Hostname_write(&obj_conv);
29347         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29348         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29349         CVec_u8Z_free(ret_var);
29350         return ret_arr;
29351 }
29352
29353 uint64_t  __attribute__((export_name("TS_Hostname_read"))) TS_Hostname_read(int8_tArray ser) {
29354         LDKu8slice ser_ref;
29355         ser_ref.datalen = ser->arr_len;
29356         ser_ref.data = ser->elems;
29357         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
29358         *ret_conv = Hostname_read(ser_ref);
29359         FREE(ser);
29360         return tag_ptr(ret_conv, true);
29361 }
29362
29363 void  __attribute__((export_name("TS_TransactionU16LenLimited_free"))) TS_TransactionU16LenLimited_free(uint64_t this_obj) {
29364         LDKTransactionU16LenLimited this_obj_conv;
29365         this_obj_conv.inner = untag_ptr(this_obj);
29366         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29368         TransactionU16LenLimited_free(this_obj_conv);
29369 }
29370
29371 static inline uint64_t TransactionU16LenLimited_clone_ptr(LDKTransactionU16LenLimited *NONNULL_PTR arg) {
29372         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(arg);
29373         uint64_t ret_ref = 0;
29374         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29375         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29376         return ret_ref;
29377 }
29378 int64_t  __attribute__((export_name("TS_TransactionU16LenLimited_clone_ptr"))) TS_TransactionU16LenLimited_clone_ptr(uint64_t arg) {
29379         LDKTransactionU16LenLimited arg_conv;
29380         arg_conv.inner = untag_ptr(arg);
29381         arg_conv.is_owned = ptr_is_owned(arg);
29382         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29383         arg_conv.is_owned = false;
29384         int64_t ret_conv = TransactionU16LenLimited_clone_ptr(&arg_conv);
29385         return ret_conv;
29386 }
29387
29388 uint64_t  __attribute__((export_name("TS_TransactionU16LenLimited_clone"))) TS_TransactionU16LenLimited_clone(uint64_t orig) {
29389         LDKTransactionU16LenLimited orig_conv;
29390         orig_conv.inner = untag_ptr(orig);
29391         orig_conv.is_owned = ptr_is_owned(orig);
29392         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29393         orig_conv.is_owned = false;
29394         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(&orig_conv);
29395         uint64_t ret_ref = 0;
29396         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29397         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29398         return ret_ref;
29399 }
29400
29401 jboolean  __attribute__((export_name("TS_TransactionU16LenLimited_eq"))) TS_TransactionU16LenLimited_eq(uint64_t a, uint64_t b) {
29402         LDKTransactionU16LenLimited a_conv;
29403         a_conv.inner = untag_ptr(a);
29404         a_conv.is_owned = ptr_is_owned(a);
29405         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29406         a_conv.is_owned = false;
29407         LDKTransactionU16LenLimited b_conv;
29408         b_conv.inner = untag_ptr(b);
29409         b_conv.is_owned = ptr_is_owned(b);
29410         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29411         b_conv.is_owned = false;
29412         jboolean ret_conv = TransactionU16LenLimited_eq(&a_conv, &b_conv);
29413         return ret_conv;
29414 }
29415
29416 uint64_t  __attribute__((export_name("TS_TransactionU16LenLimited_new"))) TS_TransactionU16LenLimited_new(int8_tArray transaction) {
29417         LDKTransaction transaction_ref;
29418         transaction_ref.datalen = transaction->arr_len;
29419         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
29420         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
29421         transaction_ref.data_is_owned = true;
29422         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
29423         *ret_conv = TransactionU16LenLimited_new(transaction_ref);
29424         return tag_ptr(ret_conv, true);
29425 }
29426
29427 int8_tArray  __attribute__((export_name("TS_TransactionU16LenLimited_into_transaction"))) TS_TransactionU16LenLimited_into_transaction(uint64_t this_arg) {
29428         LDKTransactionU16LenLimited this_arg_conv;
29429         this_arg_conv.inner = untag_ptr(this_arg);
29430         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29432         this_arg_conv = TransactionU16LenLimited_clone(&this_arg_conv);
29433         LDKTransaction ret_var = TransactionU16LenLimited_into_transaction(this_arg_conv);
29434         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29435         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29436         Transaction_free(ret_var);
29437         return ret_arr;
29438 }
29439
29440 int8_tArray  __attribute__((export_name("TS_TransactionU16LenLimited_write"))) TS_TransactionU16LenLimited_write(uint64_t obj) {
29441         LDKTransactionU16LenLimited obj_conv;
29442         obj_conv.inner = untag_ptr(obj);
29443         obj_conv.is_owned = ptr_is_owned(obj);
29444         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29445         obj_conv.is_owned = false;
29446         LDKCVec_u8Z ret_var = TransactionU16LenLimited_write(&obj_conv);
29447         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29448         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29449         CVec_u8Z_free(ret_var);
29450         return ret_arr;
29451 }
29452
29453 uint64_t  __attribute__((export_name("TS_TransactionU16LenLimited_read"))) TS_TransactionU16LenLimited_read(int8_tArray ser) {
29454         LDKu8slice ser_ref;
29455         ser_ref.datalen = ser->arr_len;
29456         ser_ref.data = ser->elems;
29457         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
29458         *ret_conv = TransactionU16LenLimited_read(ser_ref);
29459         FREE(ser);
29460         return tag_ptr(ret_conv, true);
29461 }
29462
29463 uint64_t  __attribute__((export_name("TS_sign"))) TS_sign(int8_tArray msg, int8_tArray sk) {
29464         LDKu8slice msg_ref;
29465         msg_ref.datalen = msg->arr_len;
29466         msg_ref.data = msg->elems;
29467         uint8_t sk_arr[32];
29468         CHECK(sk->arr_len == 32);
29469         memcpy(sk_arr, sk->elems, 32); FREE(sk);
29470         uint8_t (*sk_ref)[32] = &sk_arr;
29471         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
29472         *ret_conv = sign(msg_ref, sk_ref);
29473         FREE(msg);
29474         return tag_ptr(ret_conv, true);
29475 }
29476
29477 uint64_t  __attribute__((export_name("TS_recover_pk"))) TS_recover_pk(int8_tArray msg, jstring sig) {
29478         LDKu8slice msg_ref;
29479         msg_ref.datalen = msg->arr_len;
29480         msg_ref.data = msg->elems;
29481         LDKStr sig_conv = str_ref_to_owned_c(sig);
29482         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
29483         *ret_conv = recover_pk(msg_ref, sig_conv);
29484         FREE(msg);
29485         return tag_ptr(ret_conv, true);
29486 }
29487
29488 jboolean  __attribute__((export_name("TS_verify"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
29489         LDKu8slice msg_ref;
29490         msg_ref.datalen = msg->arr_len;
29491         msg_ref.data = msg->elems;
29492         LDKStr sig_conv = str_ref_to_owned_c(sig);
29493         LDKPublicKey pk_ref;
29494         CHECK(pk->arr_len == 33);
29495         memcpy(pk_ref.compressed_form, pk->elems, 33); FREE(pk);
29496         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
29497         FREE(msg);
29498         return ret_conv;
29499 }
29500
29501 int8_tArray  __attribute__((export_name("TS_construct_invoice_preimage"))) TS_construct_invoice_preimage(int8_tArray hrp_bytes, ptrArray data_without_signature) {
29502         LDKu8slice hrp_bytes_ref;
29503         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
29504         hrp_bytes_ref.data = hrp_bytes->elems;
29505         LDKCVec_U5Z data_without_signature_constr;
29506         data_without_signature_constr.datalen = data_without_signature->arr_len;
29507         if (data_without_signature_constr.datalen > 0)
29508                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
29509         else
29510                 data_without_signature_constr.data = NULL;
29511         int8_t* data_without_signature_vals = (void*) data_without_signature->elems;
29512         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
29513                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
29514                 
29515                 data_without_signature_constr.data[h] = (LDKU5){ ._0 = data_without_signature_conv_7 };
29516         }
29517         FREE(data_without_signature);
29518         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
29519         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29520         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29521         CVec_u8Z_free(ret_var);
29522         FREE(hrp_bytes);
29523         return ret_arr;
29524 }
29525
29526 void  __attribute__((export_name("TS_KVStore_free"))) TS_KVStore_free(uint64_t this_ptr) {
29527         if (!ptr_is_owned(this_ptr)) return;
29528         void* this_ptr_ptr = untag_ptr(this_ptr);
29529         CHECK_ACCESS(this_ptr_ptr);
29530         LDKKVStore this_ptr_conv = *(LDKKVStore*)(this_ptr_ptr);
29531         FREE(untag_ptr(this_ptr));
29532         KVStore_free(this_ptr_conv);
29533 }
29534
29535 void  __attribute__((export_name("TS_Persister_free"))) TS_Persister_free(uint64_t this_ptr) {
29536         if (!ptr_is_owned(this_ptr)) return;
29537         void* this_ptr_ptr = untag_ptr(this_ptr);
29538         CHECK_ACCESS(this_ptr_ptr);
29539         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
29540         FREE(untag_ptr(this_ptr));
29541         Persister_free(this_ptr_conv);
29542 }
29543
29544 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) {
29545         void* kv_store_ptr = untag_ptr(kv_store);
29546         CHECK_ACCESS(kv_store_ptr);
29547         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
29548         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
29549                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29550                 LDKKVStore_JCalls_cloned(&kv_store_conv);
29551         }
29552         void* entropy_source_ptr = untag_ptr(entropy_source);
29553         CHECK_ACCESS(entropy_source_ptr);
29554         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
29555         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
29556                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29557                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
29558         }
29559         void* signer_provider_ptr = untag_ptr(signer_provider);
29560         CHECK_ACCESS(signer_provider_ptr);
29561         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
29562         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
29563                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29564                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
29565         }
29566         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
29567         *ret_conv = read_channel_monitors(kv_store_conv, entropy_source_conv, signer_provider_conv);
29568         return tag_ptr(ret_conv, true);
29569 }
29570
29571 void  __attribute__((export_name("TS_MonitorUpdatingPersister_free"))) TS_MonitorUpdatingPersister_free(uint64_t this_obj) {
29572         LDKMonitorUpdatingPersister this_obj_conv;
29573         this_obj_conv.inner = untag_ptr(this_obj);
29574         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29576         MonitorUpdatingPersister_free(this_obj_conv);
29577 }
29578
29579 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) {
29580         void* kv_store_ptr = untag_ptr(kv_store);
29581         CHECK_ACCESS(kv_store_ptr);
29582         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
29583         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
29584                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29585                 LDKKVStore_JCalls_cloned(&kv_store_conv);
29586         }
29587         void* logger_ptr = untag_ptr(logger);
29588         CHECK_ACCESS(logger_ptr);
29589         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
29590         if (logger_conv.free == LDKLogger_JCalls_free) {
29591                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29592                 LDKLogger_JCalls_cloned(&logger_conv);
29593         }
29594         void* entropy_source_ptr = untag_ptr(entropy_source);
29595         CHECK_ACCESS(entropy_source_ptr);
29596         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
29597         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
29598                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29599                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
29600         }
29601         void* signer_provider_ptr = untag_ptr(signer_provider);
29602         CHECK_ACCESS(signer_provider_ptr);
29603         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
29604         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
29605                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29606                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
29607         }
29608         LDKMonitorUpdatingPersister ret_var = MonitorUpdatingPersister_new(kv_store_conv, logger_conv, maximum_pending_updates, entropy_source_conv, signer_provider_conv);
29609         uint64_t ret_ref = 0;
29610         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29611         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29612         return ret_ref;
29613 }
29614
29615 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) {
29616         LDKMonitorUpdatingPersister this_arg_conv;
29617         this_arg_conv.inner = untag_ptr(this_arg);
29618         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29620         this_arg_conv.is_owned = false;
29621         void* broadcaster_ptr = untag_ptr(broadcaster);
29622         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
29623         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
29624         void* fee_estimator_ptr = untag_ptr(fee_estimator);
29625         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
29626         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
29627         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
29628         *ret_conv = MonitorUpdatingPersister_read_all_channel_monitors_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv);
29629         return tag_ptr(ret_conv, true);
29630 }
29631
29632 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) {
29633         LDKMonitorUpdatingPersister this_arg_conv;
29634         this_arg_conv.inner = untag_ptr(this_arg);
29635         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29637         this_arg_conv.is_owned = false;
29638         void* broadcaster_ptr = untag_ptr(broadcaster);
29639         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
29640         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
29641         void* fee_estimator_ptr = untag_ptr(fee_estimator);
29642         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
29643         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
29644         LDKStr monitor_key_conv = str_ref_to_owned_c(monitor_key);
29645         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
29646         *ret_conv = MonitorUpdatingPersister_read_channel_monitor_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv, monitor_key_conv);
29647         return tag_ptr(ret_conv, true);
29648 }
29649
29650 uint64_t  __attribute__((export_name("TS_MonitorUpdatingPersister_cleanup_stale_updates"))) TS_MonitorUpdatingPersister_cleanup_stale_updates(uint64_t this_arg, jboolean lazy) {
29651         LDKMonitorUpdatingPersister this_arg_conv;
29652         this_arg_conv.inner = untag_ptr(this_arg);
29653         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29655         this_arg_conv.is_owned = false;
29656         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
29657         *ret_conv = MonitorUpdatingPersister_cleanup_stale_updates(&this_arg_conv, lazy);
29658         return tag_ptr(ret_conv, true);
29659 }
29660
29661 uint64_t  __attribute__((export_name("TS_MonitorUpdatingPersister_as_Persist"))) TS_MonitorUpdatingPersister_as_Persist(uint64_t this_arg) {
29662         LDKMonitorUpdatingPersister this_arg_conv;
29663         this_arg_conv.inner = untag_ptr(this_arg);
29664         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29666         this_arg_conv.is_owned = false;
29667         LDKPersist* ret_ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
29668         *ret_ret = MonitorUpdatingPersister_as_Persist(&this_arg_conv);
29669         return tag_ptr(ret_ret, true);
29670 }
29671
29672 void  __attribute__((export_name("TS_UntrustedString_free"))) TS_UntrustedString_free(uint64_t this_obj) {
29673         LDKUntrustedString this_obj_conv;
29674         this_obj_conv.inner = untag_ptr(this_obj);
29675         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29677         UntrustedString_free(this_obj_conv);
29678 }
29679
29680 jstring  __attribute__((export_name("TS_UntrustedString_get_a"))) TS_UntrustedString_get_a(uint64_t this_ptr) {
29681         LDKUntrustedString this_ptr_conv;
29682         this_ptr_conv.inner = untag_ptr(this_ptr);
29683         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29685         this_ptr_conv.is_owned = false;
29686         LDKStr ret_str = UntrustedString_get_a(&this_ptr_conv);
29687         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
29688         Str_free(ret_str);
29689         return ret_conv;
29690 }
29691
29692 void  __attribute__((export_name("TS_UntrustedString_set_a"))) TS_UntrustedString_set_a(uint64_t this_ptr, jstring val) {
29693         LDKUntrustedString this_ptr_conv;
29694         this_ptr_conv.inner = untag_ptr(this_ptr);
29695         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29697         this_ptr_conv.is_owned = false;
29698         LDKStr val_conv = str_ref_to_owned_c(val);
29699         UntrustedString_set_a(&this_ptr_conv, val_conv);
29700 }
29701
29702 uint64_t  __attribute__((export_name("TS_UntrustedString_new"))) TS_UntrustedString_new(jstring a_arg) {
29703         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
29704         LDKUntrustedString ret_var = UntrustedString_new(a_arg_conv);
29705         uint64_t ret_ref = 0;
29706         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29707         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29708         return ret_ref;
29709 }
29710
29711 static inline uint64_t UntrustedString_clone_ptr(LDKUntrustedString *NONNULL_PTR arg) {
29712         LDKUntrustedString ret_var = UntrustedString_clone(arg);
29713         uint64_t ret_ref = 0;
29714         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29715         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29716         return ret_ref;
29717 }
29718 int64_t  __attribute__((export_name("TS_UntrustedString_clone_ptr"))) TS_UntrustedString_clone_ptr(uint64_t arg) {
29719         LDKUntrustedString arg_conv;
29720         arg_conv.inner = untag_ptr(arg);
29721         arg_conv.is_owned = ptr_is_owned(arg);
29722         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29723         arg_conv.is_owned = false;
29724         int64_t ret_conv = UntrustedString_clone_ptr(&arg_conv);
29725         return ret_conv;
29726 }
29727
29728 uint64_t  __attribute__((export_name("TS_UntrustedString_clone"))) TS_UntrustedString_clone(uint64_t orig) {
29729         LDKUntrustedString orig_conv;
29730         orig_conv.inner = untag_ptr(orig);
29731         orig_conv.is_owned = ptr_is_owned(orig);
29732         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29733         orig_conv.is_owned = false;
29734         LDKUntrustedString ret_var = UntrustedString_clone(&orig_conv);
29735         uint64_t ret_ref = 0;
29736         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29737         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29738         return ret_ref;
29739 }
29740
29741 jboolean  __attribute__((export_name("TS_UntrustedString_eq"))) TS_UntrustedString_eq(uint64_t a, uint64_t b) {
29742         LDKUntrustedString a_conv;
29743         a_conv.inner = untag_ptr(a);
29744         a_conv.is_owned = ptr_is_owned(a);
29745         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29746         a_conv.is_owned = false;
29747         LDKUntrustedString b_conv;
29748         b_conv.inner = untag_ptr(b);
29749         b_conv.is_owned = ptr_is_owned(b);
29750         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29751         b_conv.is_owned = false;
29752         jboolean ret_conv = UntrustedString_eq(&a_conv, &b_conv);
29753         return ret_conv;
29754 }
29755
29756 int8_tArray  __attribute__((export_name("TS_UntrustedString_write"))) TS_UntrustedString_write(uint64_t obj) {
29757         LDKUntrustedString obj_conv;
29758         obj_conv.inner = untag_ptr(obj);
29759         obj_conv.is_owned = ptr_is_owned(obj);
29760         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29761         obj_conv.is_owned = false;
29762         LDKCVec_u8Z ret_var = UntrustedString_write(&obj_conv);
29763         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29764         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29765         CVec_u8Z_free(ret_var);
29766         return ret_arr;
29767 }
29768
29769 uint64_t  __attribute__((export_name("TS_UntrustedString_read"))) TS_UntrustedString_read(int8_tArray ser) {
29770         LDKu8slice ser_ref;
29771         ser_ref.datalen = ser->arr_len;
29772         ser_ref.data = ser->elems;
29773         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
29774         *ret_conv = UntrustedString_read(ser_ref);
29775         FREE(ser);
29776         return tag_ptr(ret_conv, true);
29777 }
29778
29779 void  __attribute__((export_name("TS_PrintableString_free"))) TS_PrintableString_free(uint64_t this_obj) {
29780         LDKPrintableString this_obj_conv;
29781         this_obj_conv.inner = untag_ptr(this_obj);
29782         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29784         PrintableString_free(this_obj_conv);
29785 }
29786
29787 jstring  __attribute__((export_name("TS_PrintableString_get_a"))) TS_PrintableString_get_a(uint64_t this_ptr) {
29788         LDKPrintableString this_ptr_conv;
29789         this_ptr_conv.inner = untag_ptr(this_ptr);
29790         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29792         this_ptr_conv.is_owned = false;
29793         LDKStr ret_str = PrintableString_get_a(&this_ptr_conv);
29794         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
29795         Str_free(ret_str);
29796         return ret_conv;
29797 }
29798
29799 void  __attribute__((export_name("TS_PrintableString_set_a"))) TS_PrintableString_set_a(uint64_t this_ptr, jstring val) {
29800         LDKPrintableString this_ptr_conv;
29801         this_ptr_conv.inner = untag_ptr(this_ptr);
29802         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29804         this_ptr_conv.is_owned = false;
29805         LDKStr val_conv = str_ref_to_owned_c(val);
29806         PrintableString_set_a(&this_ptr_conv, val_conv);
29807 }
29808
29809 uint64_t  __attribute__((export_name("TS_PrintableString_new"))) TS_PrintableString_new(jstring a_arg) {
29810         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
29811         LDKPrintableString ret_var = PrintableString_new(a_arg_conv);
29812         uint64_t ret_ref = 0;
29813         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29814         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29815         return ret_ref;
29816 }
29817
29818 void  __attribute__((export_name("TS_FutureCallback_free"))) TS_FutureCallback_free(uint64_t this_ptr) {
29819         if (!ptr_is_owned(this_ptr)) return;
29820         void* this_ptr_ptr = untag_ptr(this_ptr);
29821         CHECK_ACCESS(this_ptr_ptr);
29822         LDKFutureCallback this_ptr_conv = *(LDKFutureCallback*)(this_ptr_ptr);
29823         FREE(untag_ptr(this_ptr));
29824         FutureCallback_free(this_ptr_conv);
29825 }
29826
29827 void  __attribute__((export_name("TS_Future_free"))) TS_Future_free(uint64_t this_obj) {
29828         LDKFuture this_obj_conv;
29829         this_obj_conv.inner = untag_ptr(this_obj);
29830         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29832         Future_free(this_obj_conv);
29833 }
29834
29835 static inline uint64_t Future_clone_ptr(LDKFuture *NONNULL_PTR arg) {
29836         LDKFuture ret_var = Future_clone(arg);
29837         uint64_t ret_ref = 0;
29838         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29839         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29840         return ret_ref;
29841 }
29842 int64_t  __attribute__((export_name("TS_Future_clone_ptr"))) TS_Future_clone_ptr(uint64_t arg) {
29843         LDKFuture arg_conv;
29844         arg_conv.inner = untag_ptr(arg);
29845         arg_conv.is_owned = ptr_is_owned(arg);
29846         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29847         arg_conv.is_owned = false;
29848         int64_t ret_conv = Future_clone_ptr(&arg_conv);
29849         return ret_conv;
29850 }
29851
29852 uint64_t  __attribute__((export_name("TS_Future_clone"))) TS_Future_clone(uint64_t orig) {
29853         LDKFuture orig_conv;
29854         orig_conv.inner = untag_ptr(orig);
29855         orig_conv.is_owned = ptr_is_owned(orig);
29856         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29857         orig_conv.is_owned = false;
29858         LDKFuture ret_var = Future_clone(&orig_conv);
29859         uint64_t ret_ref = 0;
29860         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29861         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29862         return ret_ref;
29863 }
29864
29865 void  __attribute__((export_name("TS_Future_register_callback_fn"))) TS_Future_register_callback_fn(uint64_t this_arg, uint64_t callback) {
29866         LDKFuture this_arg_conv;
29867         this_arg_conv.inner = untag_ptr(this_arg);
29868         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29870         this_arg_conv.is_owned = false;
29871         void* callback_ptr = untag_ptr(callback);
29872         CHECK_ACCESS(callback_ptr);
29873         LDKFutureCallback callback_conv = *(LDKFutureCallback*)(callback_ptr);
29874         if (callback_conv.free == LDKFutureCallback_JCalls_free) {
29875                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29876                 LDKFutureCallback_JCalls_cloned(&callback_conv);
29877         }
29878         Future_register_callback_fn(&this_arg_conv, callback_conv);
29879 }
29880
29881 uint32_t  __attribute__((export_name("TS_Level_clone"))) TS_Level_clone(uint64_t orig) {
29882         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
29883         uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
29884         return ret_conv;
29885 }
29886
29887 uint32_t  __attribute__((export_name("TS_Level_gossip"))) TS_Level_gossip() {
29888         uint32_t ret_conv = LDKLevel_to_js(Level_gossip());
29889         return ret_conv;
29890 }
29891
29892 uint32_t  __attribute__((export_name("TS_Level_trace"))) TS_Level_trace() {
29893         uint32_t ret_conv = LDKLevel_to_js(Level_trace());
29894         return ret_conv;
29895 }
29896
29897 uint32_t  __attribute__((export_name("TS_Level_debug"))) TS_Level_debug() {
29898         uint32_t ret_conv = LDKLevel_to_js(Level_debug());
29899         return ret_conv;
29900 }
29901
29902 uint32_t  __attribute__((export_name("TS_Level_info"))) TS_Level_info() {
29903         uint32_t ret_conv = LDKLevel_to_js(Level_info());
29904         return ret_conv;
29905 }
29906
29907 uint32_t  __attribute__((export_name("TS_Level_warn"))) TS_Level_warn() {
29908         uint32_t ret_conv = LDKLevel_to_js(Level_warn());
29909         return ret_conv;
29910 }
29911
29912 uint32_t  __attribute__((export_name("TS_Level_error"))) TS_Level_error() {
29913         uint32_t ret_conv = LDKLevel_to_js(Level_error());
29914         return ret_conv;
29915 }
29916
29917 jboolean  __attribute__((export_name("TS_Level_eq"))) TS_Level_eq(uint64_t a, uint64_t b) {
29918         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
29919         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
29920         jboolean ret_conv = Level_eq(a_conv, b_conv);
29921         return ret_conv;
29922 }
29923
29924 int64_t  __attribute__((export_name("TS_Level_hash"))) TS_Level_hash(uint64_t o) {
29925         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
29926         int64_t ret_conv = Level_hash(o_conv);
29927         return ret_conv;
29928 }
29929
29930 uint32_t  __attribute__((export_name("TS_Level_max"))) TS_Level_max() {
29931         uint32_t ret_conv = LDKLevel_to_js(Level_max());
29932         return ret_conv;
29933 }
29934
29935 void  __attribute__((export_name("TS_Record_free"))) TS_Record_free(uint64_t this_obj) {
29936         LDKRecord this_obj_conv;
29937         this_obj_conv.inner = untag_ptr(this_obj);
29938         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29940         Record_free(this_obj_conv);
29941 }
29942
29943 uint32_t  __attribute__((export_name("TS_Record_get_level"))) TS_Record_get_level(uint64_t this_ptr) {
29944         LDKRecord this_ptr_conv;
29945         this_ptr_conv.inner = untag_ptr(this_ptr);
29946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29948         this_ptr_conv.is_owned = false;
29949         uint32_t ret_conv = LDKLevel_to_js(Record_get_level(&this_ptr_conv));
29950         return ret_conv;
29951 }
29952
29953 void  __attribute__((export_name("TS_Record_set_level"))) TS_Record_set_level(uint64_t this_ptr, uint32_t val) {
29954         LDKRecord this_ptr_conv;
29955         this_ptr_conv.inner = untag_ptr(this_ptr);
29956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29958         this_ptr_conv.is_owned = false;
29959         LDKLevel val_conv = LDKLevel_from_js(val);
29960         Record_set_level(&this_ptr_conv, val_conv);
29961 }
29962
29963 jstring  __attribute__((export_name("TS_Record_get_args"))) TS_Record_get_args(uint64_t this_ptr) {
29964         LDKRecord this_ptr_conv;
29965         this_ptr_conv.inner = untag_ptr(this_ptr);
29966         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29968         this_ptr_conv.is_owned = false;
29969         LDKStr ret_str = Record_get_args(&this_ptr_conv);
29970         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
29971         Str_free(ret_str);
29972         return ret_conv;
29973 }
29974
29975 void  __attribute__((export_name("TS_Record_set_args"))) TS_Record_set_args(uint64_t this_ptr, jstring val) {
29976         LDKRecord this_ptr_conv;
29977         this_ptr_conv.inner = untag_ptr(this_ptr);
29978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29980         this_ptr_conv.is_owned = false;
29981         LDKStr val_conv = str_ref_to_owned_c(val);
29982         Record_set_args(&this_ptr_conv, val_conv);
29983 }
29984
29985 jstring  __attribute__((export_name("TS_Record_get_module_path"))) TS_Record_get_module_path(uint64_t this_ptr) {
29986         LDKRecord this_ptr_conv;
29987         this_ptr_conv.inner = untag_ptr(this_ptr);
29988         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29990         this_ptr_conv.is_owned = false;
29991         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
29992         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
29993         Str_free(ret_str);
29994         return ret_conv;
29995 }
29996
29997 void  __attribute__((export_name("TS_Record_set_module_path"))) TS_Record_set_module_path(uint64_t this_ptr, jstring val) {
29998         LDKRecord this_ptr_conv;
29999         this_ptr_conv.inner = untag_ptr(this_ptr);
30000         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30002         this_ptr_conv.is_owned = false;
30003         LDKStr val_conv = str_ref_to_owned_c(val);
30004         Record_set_module_path(&this_ptr_conv, val_conv);
30005 }
30006
30007 jstring  __attribute__((export_name("TS_Record_get_file"))) TS_Record_get_file(uint64_t this_ptr) {
30008         LDKRecord this_ptr_conv;
30009         this_ptr_conv.inner = untag_ptr(this_ptr);
30010         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30012         this_ptr_conv.is_owned = false;
30013         LDKStr ret_str = Record_get_file(&this_ptr_conv);
30014         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
30015         Str_free(ret_str);
30016         return ret_conv;
30017 }
30018
30019 void  __attribute__((export_name("TS_Record_set_file"))) TS_Record_set_file(uint64_t this_ptr, jstring val) {
30020         LDKRecord this_ptr_conv;
30021         this_ptr_conv.inner = untag_ptr(this_ptr);
30022         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30024         this_ptr_conv.is_owned = false;
30025         LDKStr val_conv = str_ref_to_owned_c(val);
30026         Record_set_file(&this_ptr_conv, val_conv);
30027 }
30028
30029 int32_t  __attribute__((export_name("TS_Record_get_line"))) TS_Record_get_line(uint64_t this_ptr) {
30030         LDKRecord this_ptr_conv;
30031         this_ptr_conv.inner = untag_ptr(this_ptr);
30032         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30034         this_ptr_conv.is_owned = false;
30035         int32_t ret_conv = Record_get_line(&this_ptr_conv);
30036         return ret_conv;
30037 }
30038
30039 void  __attribute__((export_name("TS_Record_set_line"))) TS_Record_set_line(uint64_t this_ptr, int32_t val) {
30040         LDKRecord this_ptr_conv;
30041         this_ptr_conv.inner = untag_ptr(this_ptr);
30042         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30044         this_ptr_conv.is_owned = false;
30045         Record_set_line(&this_ptr_conv, val);
30046 }
30047
30048 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
30049         LDKRecord ret_var = Record_clone(arg);
30050         uint64_t ret_ref = 0;
30051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30053         return ret_ref;
30054 }
30055 int64_t  __attribute__((export_name("TS_Record_clone_ptr"))) TS_Record_clone_ptr(uint64_t arg) {
30056         LDKRecord arg_conv;
30057         arg_conv.inner = untag_ptr(arg);
30058         arg_conv.is_owned = ptr_is_owned(arg);
30059         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30060         arg_conv.is_owned = false;
30061         int64_t ret_conv = Record_clone_ptr(&arg_conv);
30062         return ret_conv;
30063 }
30064
30065 uint64_t  __attribute__((export_name("TS_Record_clone"))) TS_Record_clone(uint64_t orig) {
30066         LDKRecord orig_conv;
30067         orig_conv.inner = untag_ptr(orig);
30068         orig_conv.is_owned = ptr_is_owned(orig);
30069         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30070         orig_conv.is_owned = false;
30071         LDKRecord ret_var = Record_clone(&orig_conv);
30072         uint64_t ret_ref = 0;
30073         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30074         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30075         return ret_ref;
30076 }
30077
30078 void  __attribute__((export_name("TS_Logger_free"))) TS_Logger_free(uint64_t this_ptr) {
30079         if (!ptr_is_owned(this_ptr)) return;
30080         void* this_ptr_ptr = untag_ptr(this_ptr);
30081         CHECK_ACCESS(this_ptr_ptr);
30082         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
30083         FREE(untag_ptr(this_ptr));
30084         Logger_free(this_ptr_conv);
30085 }
30086
30087 void  __attribute__((export_name("TS_ChannelHandshakeConfig_free"))) TS_ChannelHandshakeConfig_free(uint64_t this_obj) {
30088         LDKChannelHandshakeConfig this_obj_conv;
30089         this_obj_conv.inner = untag_ptr(this_obj);
30090         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30092         ChannelHandshakeConfig_free(this_obj_conv);
30093 }
30094
30095 int32_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_minimum_depth"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint64_t this_ptr) {
30096         LDKChannelHandshakeConfig this_ptr_conv;
30097         this_ptr_conv.inner = untag_ptr(this_ptr);
30098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30100         this_ptr_conv.is_owned = false;
30101         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
30102         return ret_conv;
30103 }
30104
30105 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_minimum_depth"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint64_t this_ptr, int32_t val) {
30106         LDKChannelHandshakeConfig this_ptr_conv;
30107         this_ptr_conv.inner = untag_ptr(this_ptr);
30108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30110         this_ptr_conv.is_owned = false;
30111         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
30112 }
30113
30114 int16_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_to_self_delay"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint64_t this_ptr) {
30115         LDKChannelHandshakeConfig this_ptr_conv;
30116         this_ptr_conv.inner = untag_ptr(this_ptr);
30117         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30119         this_ptr_conv.is_owned = false;
30120         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
30121         return ret_conv;
30122 }
30123
30124 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) {
30125         LDKChannelHandshakeConfig this_ptr_conv;
30126         this_ptr_conv.inner = untag_ptr(this_ptr);
30127         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30129         this_ptr_conv.is_owned = false;
30130         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
30131 }
30132
30133 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint64_t this_ptr) {
30134         LDKChannelHandshakeConfig this_ptr_conv;
30135         this_ptr_conv.inner = untag_ptr(this_ptr);
30136         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30138         this_ptr_conv.is_owned = false;
30139         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
30140         return ret_conv;
30141 }
30142
30143 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) {
30144         LDKChannelHandshakeConfig this_ptr_conv;
30145         this_ptr_conv.inner = untag_ptr(this_ptr);
30146         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30148         this_ptr_conv.is_owned = false;
30149         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
30150 }
30151
30152 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) {
30153         LDKChannelHandshakeConfig this_ptr_conv;
30154         this_ptr_conv.inner = untag_ptr(this_ptr);
30155         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30157         this_ptr_conv.is_owned = false;
30158         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
30159         return ret_conv;
30160 }
30161
30162 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) {
30163         LDKChannelHandshakeConfig this_ptr_conv;
30164         this_ptr_conv.inner = untag_ptr(this_ptr);
30165         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30167         this_ptr_conv.is_owned = false;
30168         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
30169 }
30170
30171 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_get_negotiate_scid_privacy(uint64_t this_ptr) {
30172         LDKChannelHandshakeConfig this_ptr_conv;
30173         this_ptr_conv.inner = untag_ptr(this_ptr);
30174         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30176         this_ptr_conv.is_owned = false;
30177         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
30178         return ret_conv;
30179 }
30180
30181 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_set_negotiate_scid_privacy(uint64_t this_ptr, jboolean val) {
30182         LDKChannelHandshakeConfig this_ptr_conv;
30183         this_ptr_conv.inner = untag_ptr(this_ptr);
30184         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30186         this_ptr_conv.is_owned = false;
30187         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
30188 }
30189
30190 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_announced_channel"))) TS_ChannelHandshakeConfig_get_announced_channel(uint64_t this_ptr) {
30191         LDKChannelHandshakeConfig this_ptr_conv;
30192         this_ptr_conv.inner = untag_ptr(this_ptr);
30193         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30195         this_ptr_conv.is_owned = false;
30196         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
30197         return ret_conv;
30198 }
30199
30200 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_announced_channel"))) TS_ChannelHandshakeConfig_set_announced_channel(uint64_t this_ptr, jboolean val) {
30201         LDKChannelHandshakeConfig this_ptr_conv;
30202         this_ptr_conv.inner = untag_ptr(this_ptr);
30203         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30205         this_ptr_conv.is_owned = false;
30206         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
30207 }
30208
30209 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(uint64_t this_ptr) {
30210         LDKChannelHandshakeConfig this_ptr_conv;
30211         this_ptr_conv.inner = untag_ptr(this_ptr);
30212         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30214         this_ptr_conv.is_owned = false;
30215         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
30216         return ret_conv;
30217 }
30218
30219 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(uint64_t this_ptr, jboolean val) {
30220         LDKChannelHandshakeConfig this_ptr_conv;
30221         this_ptr_conv.inner = untag_ptr(this_ptr);
30222         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30224         this_ptr_conv.is_owned = false;
30225         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
30226 }
30227
30228 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) {
30229         LDKChannelHandshakeConfig this_ptr_conv;
30230         this_ptr_conv.inner = untag_ptr(this_ptr);
30231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30233         this_ptr_conv.is_owned = false;
30234         int32_t ret_conv = ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(&this_ptr_conv);
30235         return ret_conv;
30236 }
30237
30238 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) {
30239         LDKChannelHandshakeConfig this_ptr_conv;
30240         this_ptr_conv.inner = untag_ptr(this_ptr);
30241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30243         this_ptr_conv.is_owned = false;
30244         ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(&this_ptr_conv, val);
30245 }
30246
30247 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) {
30248         LDKChannelHandshakeConfig this_ptr_conv;
30249         this_ptr_conv.inner = untag_ptr(this_ptr);
30250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30252         this_ptr_conv.is_owned = false;
30253         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv);
30254         return ret_conv;
30255 }
30256
30257 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) {
30258         LDKChannelHandshakeConfig this_ptr_conv;
30259         this_ptr_conv.inner = untag_ptr(this_ptr);
30260         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30262         this_ptr_conv.is_owned = false;
30263         ChannelHandshakeConfig_set_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv, val);
30264 }
30265
30266 int16_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_max_accepted_htlcs"))) TS_ChannelHandshakeConfig_get_our_max_accepted_htlcs(uint64_t this_ptr) {
30267         LDKChannelHandshakeConfig this_ptr_conv;
30268         this_ptr_conv.inner = untag_ptr(this_ptr);
30269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30271         this_ptr_conv.is_owned = false;
30272         int16_t ret_conv = ChannelHandshakeConfig_get_our_max_accepted_htlcs(&this_ptr_conv);
30273         return ret_conv;
30274 }
30275
30276 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) {
30277         LDKChannelHandshakeConfig this_ptr_conv;
30278         this_ptr_conv.inner = untag_ptr(this_ptr);
30279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30281         this_ptr_conv.is_owned = false;
30282         ChannelHandshakeConfig_set_our_max_accepted_htlcs(&this_ptr_conv, val);
30283 }
30284
30285 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) {
30286         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);
30287         uint64_t ret_ref = 0;
30288         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30289         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30290         return ret_ref;
30291 }
30292
30293 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
30294         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
30295         uint64_t ret_ref = 0;
30296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30297         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30298         return ret_ref;
30299 }
30300 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone_ptr"))) TS_ChannelHandshakeConfig_clone_ptr(uint64_t arg) {
30301         LDKChannelHandshakeConfig arg_conv;
30302         arg_conv.inner = untag_ptr(arg);
30303         arg_conv.is_owned = ptr_is_owned(arg);
30304         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30305         arg_conv.is_owned = false;
30306         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
30307         return ret_conv;
30308 }
30309
30310 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone"))) TS_ChannelHandshakeConfig_clone(uint64_t orig) {
30311         LDKChannelHandshakeConfig orig_conv;
30312         orig_conv.inner = untag_ptr(orig);
30313         orig_conv.is_owned = ptr_is_owned(orig);
30314         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30315         orig_conv.is_owned = false;
30316         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
30317         uint64_t ret_ref = 0;
30318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30320         return ret_ref;
30321 }
30322
30323 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_default"))) TS_ChannelHandshakeConfig_default() {
30324         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
30325         uint64_t ret_ref = 0;
30326         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30327         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30328         return ret_ref;
30329 }
30330
30331 void  __attribute__((export_name("TS_ChannelHandshakeLimits_free"))) TS_ChannelHandshakeLimits_free(uint64_t this_obj) {
30332         LDKChannelHandshakeLimits this_obj_conv;
30333         this_obj_conv.inner = untag_ptr(this_obj);
30334         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30336         ChannelHandshakeLimits_free(this_obj_conv);
30337 }
30338
30339 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_funding_satoshis"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint64_t this_ptr) {
30340         LDKChannelHandshakeLimits this_ptr_conv;
30341         this_ptr_conv.inner = untag_ptr(this_ptr);
30342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30344         this_ptr_conv.is_owned = false;
30345         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
30346         return ret_conv;
30347 }
30348
30349 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_min_funding_satoshis"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint64_t this_ptr, int64_t val) {
30350         LDKChannelHandshakeLimits this_ptr_conv;
30351         this_ptr_conv.inner = untag_ptr(this_ptr);
30352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30354         this_ptr_conv.is_owned = false;
30355         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
30356 }
30357
30358 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_funding_satoshis"))) TS_ChannelHandshakeLimits_get_max_funding_satoshis(uint64_t this_ptr) {
30359         LDKChannelHandshakeLimits this_ptr_conv;
30360         this_ptr_conv.inner = untag_ptr(this_ptr);
30361         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30363         this_ptr_conv.is_owned = false;
30364         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
30365         return ret_conv;
30366 }
30367
30368 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_funding_satoshis"))) TS_ChannelHandshakeLimits_set_max_funding_satoshis(uint64_t this_ptr, int64_t val) {
30369         LDKChannelHandshakeLimits this_ptr_conv;
30370         this_ptr_conv.inner = untag_ptr(this_ptr);
30371         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30373         this_ptr_conv.is_owned = false;
30374         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
30375 }
30376
30377 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint64_t this_ptr) {
30378         LDKChannelHandshakeLimits this_ptr_conv;
30379         this_ptr_conv.inner = untag_ptr(this_ptr);
30380         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30382         this_ptr_conv.is_owned = false;
30383         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
30384         return ret_conv;
30385 }
30386
30387 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) {
30388         LDKChannelHandshakeLimits this_ptr_conv;
30389         this_ptr_conv.inner = untag_ptr(this_ptr);
30390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30392         this_ptr_conv.is_owned = false;
30393         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
30394 }
30395
30396 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) {
30397         LDKChannelHandshakeLimits this_ptr_conv;
30398         this_ptr_conv.inner = untag_ptr(this_ptr);
30399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30401         this_ptr_conv.is_owned = false;
30402         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
30403         return ret_conv;
30404 }
30405
30406 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) {
30407         LDKChannelHandshakeLimits this_ptr_conv;
30408         this_ptr_conv.inner = untag_ptr(this_ptr);
30409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30411         this_ptr_conv.is_owned = false;
30412         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
30413 }
30414
30415 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint64_t this_ptr) {
30416         LDKChannelHandshakeLimits this_ptr_conv;
30417         this_ptr_conv.inner = untag_ptr(this_ptr);
30418         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30420         this_ptr_conv.is_owned = false;
30421         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
30422         return ret_conv;
30423 }
30424
30425 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) {
30426         LDKChannelHandshakeLimits this_ptr_conv;
30427         this_ptr_conv.inner = untag_ptr(this_ptr);
30428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30430         this_ptr_conv.is_owned = false;
30431         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
30432 }
30433
30434 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint64_t this_ptr) {
30435         LDKChannelHandshakeLimits this_ptr_conv;
30436         this_ptr_conv.inner = untag_ptr(this_ptr);
30437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30439         this_ptr_conv.is_owned = false;
30440         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
30441         return ret_conv;
30442 }
30443
30444 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) {
30445         LDKChannelHandshakeLimits this_ptr_conv;
30446         this_ptr_conv.inner = untag_ptr(this_ptr);
30447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30449         this_ptr_conv.is_owned = false;
30450         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
30451 }
30452
30453 int32_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_minimum_depth"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint64_t this_ptr) {
30454         LDKChannelHandshakeLimits this_ptr_conv;
30455         this_ptr_conv.inner = untag_ptr(this_ptr);
30456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30458         this_ptr_conv.is_owned = false;
30459         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
30460         return ret_conv;
30461 }
30462
30463 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_minimum_depth"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint64_t this_ptr, int32_t val) {
30464         LDKChannelHandshakeLimits this_ptr_conv;
30465         this_ptr_conv.inner = untag_ptr(this_ptr);
30466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30468         this_ptr_conv.is_owned = false;
30469         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
30470 }
30471
30472 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_get_trust_own_funding_0conf(uint64_t this_ptr) {
30473         LDKChannelHandshakeLimits this_ptr_conv;
30474         this_ptr_conv.inner = untag_ptr(this_ptr);
30475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30477         this_ptr_conv.is_owned = false;
30478         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
30479         return ret_conv;
30480 }
30481
30482 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_set_trust_own_funding_0conf(uint64_t this_ptr, jboolean val) {
30483         LDKChannelHandshakeLimits this_ptr_conv;
30484         this_ptr_conv.inner = untag_ptr(this_ptr);
30485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30487         this_ptr_conv.is_owned = false;
30488         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
30489 }
30490
30491 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint64_t this_ptr) {
30492         LDKChannelHandshakeLimits this_ptr_conv;
30493         this_ptr_conv.inner = untag_ptr(this_ptr);
30494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30496         this_ptr_conv.is_owned = false;
30497         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
30498         return ret_conv;
30499 }
30500
30501 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint64_t this_ptr, jboolean val) {
30502         LDKChannelHandshakeLimits this_ptr_conv;
30503         this_ptr_conv.inner = untag_ptr(this_ptr);
30504         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30506         this_ptr_conv.is_owned = false;
30507         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
30508 }
30509
30510 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_their_to_self_delay"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint64_t this_ptr) {
30511         LDKChannelHandshakeLimits this_ptr_conv;
30512         this_ptr_conv.inner = untag_ptr(this_ptr);
30513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30515         this_ptr_conv.is_owned = false;
30516         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
30517         return ret_conv;
30518 }
30519
30520 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) {
30521         LDKChannelHandshakeLimits this_ptr_conv;
30522         this_ptr_conv.inner = untag_ptr(this_ptr);
30523         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30525         this_ptr_conv.is_owned = false;
30526         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
30527 }
30528
30529 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) {
30530         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);
30531         uint64_t ret_ref = 0;
30532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30533         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30534         return ret_ref;
30535 }
30536
30537 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
30538         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
30539         uint64_t ret_ref = 0;
30540         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30541         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30542         return ret_ref;
30543 }
30544 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone_ptr"))) TS_ChannelHandshakeLimits_clone_ptr(uint64_t arg) {
30545         LDKChannelHandshakeLimits arg_conv;
30546         arg_conv.inner = untag_ptr(arg);
30547         arg_conv.is_owned = ptr_is_owned(arg);
30548         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30549         arg_conv.is_owned = false;
30550         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
30551         return ret_conv;
30552 }
30553
30554 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone"))) TS_ChannelHandshakeLimits_clone(uint64_t orig) {
30555         LDKChannelHandshakeLimits orig_conv;
30556         orig_conv.inner = untag_ptr(orig);
30557         orig_conv.is_owned = ptr_is_owned(orig);
30558         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30559         orig_conv.is_owned = false;
30560         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
30561         uint64_t ret_ref = 0;
30562         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30563         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30564         return ret_ref;
30565 }
30566
30567 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_default"))) TS_ChannelHandshakeLimits_default() {
30568         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
30569         uint64_t ret_ref = 0;
30570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30572         return ret_ref;
30573 }
30574
30575 void  __attribute__((export_name("TS_MaxDustHTLCExposure_free"))) TS_MaxDustHTLCExposure_free(uint64_t this_ptr) {
30576         if (!ptr_is_owned(this_ptr)) return;
30577         void* this_ptr_ptr = untag_ptr(this_ptr);
30578         CHECK_ACCESS(this_ptr_ptr);
30579         LDKMaxDustHTLCExposure this_ptr_conv = *(LDKMaxDustHTLCExposure*)(this_ptr_ptr);
30580         FREE(untag_ptr(this_ptr));
30581         MaxDustHTLCExposure_free(this_ptr_conv);
30582 }
30583
30584 static inline uint64_t MaxDustHTLCExposure_clone_ptr(LDKMaxDustHTLCExposure *NONNULL_PTR arg) {
30585         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
30586         *ret_copy = MaxDustHTLCExposure_clone(arg);
30587         uint64_t ret_ref = tag_ptr(ret_copy, true);
30588         return ret_ref;
30589 }
30590 int64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_clone_ptr"))) TS_MaxDustHTLCExposure_clone_ptr(uint64_t arg) {
30591         LDKMaxDustHTLCExposure* arg_conv = (LDKMaxDustHTLCExposure*)untag_ptr(arg);
30592         int64_t ret_conv = MaxDustHTLCExposure_clone_ptr(arg_conv);
30593         return ret_conv;
30594 }
30595
30596 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_clone"))) TS_MaxDustHTLCExposure_clone(uint64_t orig) {
30597         LDKMaxDustHTLCExposure* orig_conv = (LDKMaxDustHTLCExposure*)untag_ptr(orig);
30598         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
30599         *ret_copy = MaxDustHTLCExposure_clone(orig_conv);
30600         uint64_t ret_ref = tag_ptr(ret_copy, true);
30601         return ret_ref;
30602 }
30603
30604 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_fixed_limit_msat"))) TS_MaxDustHTLCExposure_fixed_limit_msat(int64_t a) {
30605         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
30606         *ret_copy = MaxDustHTLCExposure_fixed_limit_msat(a);
30607         uint64_t ret_ref = tag_ptr(ret_copy, true);
30608         return ret_ref;
30609 }
30610
30611 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_fee_rate_multiplier"))) TS_MaxDustHTLCExposure_fee_rate_multiplier(int64_t a) {
30612         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
30613         *ret_copy = MaxDustHTLCExposure_fee_rate_multiplier(a);
30614         uint64_t ret_ref = tag_ptr(ret_copy, true);
30615         return ret_ref;
30616 }
30617
30618 jboolean  __attribute__((export_name("TS_MaxDustHTLCExposure_eq"))) TS_MaxDustHTLCExposure_eq(uint64_t a, uint64_t b) {
30619         LDKMaxDustHTLCExposure* a_conv = (LDKMaxDustHTLCExposure*)untag_ptr(a);
30620         LDKMaxDustHTLCExposure* b_conv = (LDKMaxDustHTLCExposure*)untag_ptr(b);
30621         jboolean ret_conv = MaxDustHTLCExposure_eq(a_conv, b_conv);
30622         return ret_conv;
30623 }
30624
30625 int8_tArray  __attribute__((export_name("TS_MaxDustHTLCExposure_write"))) TS_MaxDustHTLCExposure_write(uint64_t obj) {
30626         LDKMaxDustHTLCExposure* obj_conv = (LDKMaxDustHTLCExposure*)untag_ptr(obj);
30627         LDKCVec_u8Z ret_var = MaxDustHTLCExposure_write(obj_conv);
30628         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
30629         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30630         CVec_u8Z_free(ret_var);
30631         return ret_arr;
30632 }
30633
30634 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_read"))) TS_MaxDustHTLCExposure_read(int8_tArray ser) {
30635         LDKu8slice ser_ref;
30636         ser_ref.datalen = ser->arr_len;
30637         ser_ref.data = ser->elems;
30638         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
30639         *ret_conv = MaxDustHTLCExposure_read(ser_ref);
30640         FREE(ser);
30641         return tag_ptr(ret_conv, true);
30642 }
30643
30644 void  __attribute__((export_name("TS_ChannelConfig_free"))) TS_ChannelConfig_free(uint64_t this_obj) {
30645         LDKChannelConfig this_obj_conv;
30646         this_obj_conv.inner = untag_ptr(this_obj);
30647         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30649         ChannelConfig_free(this_obj_conv);
30650 }
30651
30652 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint64_t this_ptr) {
30653         LDKChannelConfig this_ptr_conv;
30654         this_ptr_conv.inner = untag_ptr(this_ptr);
30655         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30657         this_ptr_conv.is_owned = false;
30658         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
30659         return ret_conv;
30660 }
30661
30662 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) {
30663         LDKChannelConfig this_ptr_conv;
30664         this_ptr_conv.inner = untag_ptr(this_ptr);
30665         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30667         this_ptr_conv.is_owned = false;
30668         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
30669 }
30670
30671 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_base_msat"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint64_t this_ptr) {
30672         LDKChannelConfig this_ptr_conv;
30673         this_ptr_conv.inner = untag_ptr(this_ptr);
30674         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30676         this_ptr_conv.is_owned = false;
30677         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
30678         return ret_conv;
30679 }
30680
30681 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) {
30682         LDKChannelConfig this_ptr_conv;
30683         this_ptr_conv.inner = untag_ptr(this_ptr);
30684         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30686         this_ptr_conv.is_owned = false;
30687         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
30688 }
30689
30690 int16_t  __attribute__((export_name("TS_ChannelConfig_get_cltv_expiry_delta"))) TS_ChannelConfig_get_cltv_expiry_delta(uint64_t this_ptr) {
30691         LDKChannelConfig this_ptr_conv;
30692         this_ptr_conv.inner = untag_ptr(this_ptr);
30693         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30695         this_ptr_conv.is_owned = false;
30696         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
30697         return ret_conv;
30698 }
30699
30700 void  __attribute__((export_name("TS_ChannelConfig_set_cltv_expiry_delta"))) TS_ChannelConfig_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
30701         LDKChannelConfig this_ptr_conv;
30702         this_ptr_conv.inner = untag_ptr(this_ptr);
30703         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30705         this_ptr_conv.is_owned = false;
30706         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
30707 }
30708
30709 uint64_t  __attribute__((export_name("TS_ChannelConfig_get_max_dust_htlc_exposure"))) TS_ChannelConfig_get_max_dust_htlc_exposure(uint64_t this_ptr) {
30710         LDKChannelConfig this_ptr_conv;
30711         this_ptr_conv.inner = untag_ptr(this_ptr);
30712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30714         this_ptr_conv.is_owned = false;
30715         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
30716         *ret_copy = ChannelConfig_get_max_dust_htlc_exposure(&this_ptr_conv);
30717         uint64_t ret_ref = tag_ptr(ret_copy, true);
30718         return ret_ref;
30719 }
30720
30721 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) {
30722         LDKChannelConfig this_ptr_conv;
30723         this_ptr_conv.inner = untag_ptr(this_ptr);
30724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30726         this_ptr_conv.is_owned = false;
30727         void* val_ptr = untag_ptr(val);
30728         CHECK_ACCESS(val_ptr);
30729         LDKMaxDustHTLCExposure val_conv = *(LDKMaxDustHTLCExposure*)(val_ptr);
30730         val_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(val));
30731         ChannelConfig_set_max_dust_htlc_exposure(&this_ptr_conv, val_conv);
30732 }
30733
30734 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) {
30735         LDKChannelConfig this_ptr_conv;
30736         this_ptr_conv.inner = untag_ptr(this_ptr);
30737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30739         this_ptr_conv.is_owned = false;
30740         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
30741         return ret_conv;
30742 }
30743
30744 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) {
30745         LDKChannelConfig this_ptr_conv;
30746         this_ptr_conv.inner = untag_ptr(this_ptr);
30747         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30749         this_ptr_conv.is_owned = false;
30750         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
30751 }
30752
30753 jboolean  __attribute__((export_name("TS_ChannelConfig_get_accept_underpaying_htlcs"))) TS_ChannelConfig_get_accept_underpaying_htlcs(uint64_t this_ptr) {
30754         LDKChannelConfig this_ptr_conv;
30755         this_ptr_conv.inner = untag_ptr(this_ptr);
30756         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30758         this_ptr_conv.is_owned = false;
30759         jboolean ret_conv = ChannelConfig_get_accept_underpaying_htlcs(&this_ptr_conv);
30760         return ret_conv;
30761 }
30762
30763 void  __attribute__((export_name("TS_ChannelConfig_set_accept_underpaying_htlcs"))) TS_ChannelConfig_set_accept_underpaying_htlcs(uint64_t this_ptr, jboolean val) {
30764         LDKChannelConfig this_ptr_conv;
30765         this_ptr_conv.inner = untag_ptr(this_ptr);
30766         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30768         this_ptr_conv.is_owned = false;
30769         ChannelConfig_set_accept_underpaying_htlcs(&this_ptr_conv, val);
30770 }
30771
30772 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) {
30773         void* max_dust_htlc_exposure_arg_ptr = untag_ptr(max_dust_htlc_exposure_arg);
30774         CHECK_ACCESS(max_dust_htlc_exposure_arg_ptr);
30775         LDKMaxDustHTLCExposure max_dust_htlc_exposure_arg_conv = *(LDKMaxDustHTLCExposure*)(max_dust_htlc_exposure_arg_ptr);
30776         max_dust_htlc_exposure_arg_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(max_dust_htlc_exposure_arg));
30777         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);
30778         uint64_t ret_ref = 0;
30779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30781         return ret_ref;
30782 }
30783
30784 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
30785         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
30786         uint64_t ret_ref = 0;
30787         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30788         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30789         return ret_ref;
30790 }
30791 int64_t  __attribute__((export_name("TS_ChannelConfig_clone_ptr"))) TS_ChannelConfig_clone_ptr(uint64_t arg) {
30792         LDKChannelConfig arg_conv;
30793         arg_conv.inner = untag_ptr(arg);
30794         arg_conv.is_owned = ptr_is_owned(arg);
30795         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30796         arg_conv.is_owned = false;
30797         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
30798         return ret_conv;
30799 }
30800
30801 uint64_t  __attribute__((export_name("TS_ChannelConfig_clone"))) TS_ChannelConfig_clone(uint64_t orig) {
30802         LDKChannelConfig orig_conv;
30803         orig_conv.inner = untag_ptr(orig);
30804         orig_conv.is_owned = ptr_is_owned(orig);
30805         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30806         orig_conv.is_owned = false;
30807         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
30808         uint64_t ret_ref = 0;
30809         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30810         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30811         return ret_ref;
30812 }
30813
30814 jboolean  __attribute__((export_name("TS_ChannelConfig_eq"))) TS_ChannelConfig_eq(uint64_t a, uint64_t b) {
30815         LDKChannelConfig a_conv;
30816         a_conv.inner = untag_ptr(a);
30817         a_conv.is_owned = ptr_is_owned(a);
30818         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30819         a_conv.is_owned = false;
30820         LDKChannelConfig b_conv;
30821         b_conv.inner = untag_ptr(b);
30822         b_conv.is_owned = ptr_is_owned(b);
30823         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30824         b_conv.is_owned = false;
30825         jboolean ret_conv = ChannelConfig_eq(&a_conv, &b_conv);
30826         return ret_conv;
30827 }
30828
30829 void  __attribute__((export_name("TS_ChannelConfig_apply"))) TS_ChannelConfig_apply(uint64_t this_arg, uint64_t update) {
30830         LDKChannelConfig this_arg_conv;
30831         this_arg_conv.inner = untag_ptr(this_arg);
30832         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30834         this_arg_conv.is_owned = false;
30835         LDKChannelConfigUpdate update_conv;
30836         update_conv.inner = untag_ptr(update);
30837         update_conv.is_owned = ptr_is_owned(update);
30838         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
30839         update_conv.is_owned = false;
30840         ChannelConfig_apply(&this_arg_conv, &update_conv);
30841 }
30842
30843 uint64_t  __attribute__((export_name("TS_ChannelConfig_default"))) TS_ChannelConfig_default() {
30844         LDKChannelConfig ret_var = ChannelConfig_default();
30845         uint64_t ret_ref = 0;
30846         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30847         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30848         return ret_ref;
30849 }
30850
30851 int8_tArray  __attribute__((export_name("TS_ChannelConfig_write"))) TS_ChannelConfig_write(uint64_t obj) {
30852         LDKChannelConfig obj_conv;
30853         obj_conv.inner = untag_ptr(obj);
30854         obj_conv.is_owned = ptr_is_owned(obj);
30855         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30856         obj_conv.is_owned = false;
30857         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
30858         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
30859         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30860         CVec_u8Z_free(ret_var);
30861         return ret_arr;
30862 }
30863
30864 uint64_t  __attribute__((export_name("TS_ChannelConfig_read"))) TS_ChannelConfig_read(int8_tArray ser) {
30865         LDKu8slice ser_ref;
30866         ser_ref.datalen = ser->arr_len;
30867         ser_ref.data = ser->elems;
30868         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
30869         *ret_conv = ChannelConfig_read(ser_ref);
30870         FREE(ser);
30871         return tag_ptr(ret_conv, true);
30872 }
30873
30874 void  __attribute__((export_name("TS_ChannelConfigUpdate_free"))) TS_ChannelConfigUpdate_free(uint64_t this_obj) {
30875         LDKChannelConfigUpdate this_obj_conv;
30876         this_obj_conv.inner = untag_ptr(this_obj);
30877         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30879         ChannelConfigUpdate_free(this_obj_conv);
30880 }
30881
30882 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(uint64_t this_ptr) {
30883         LDKChannelConfigUpdate this_ptr_conv;
30884         this_ptr_conv.inner = untag_ptr(this_ptr);
30885         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30887         this_ptr_conv.is_owned = false;
30888         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
30889         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
30890         uint64_t ret_ref = tag_ptr(ret_copy, true);
30891         return ret_ref;
30892 }
30893
30894 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) {
30895         LDKChannelConfigUpdate this_ptr_conv;
30896         this_ptr_conv.inner = untag_ptr(this_ptr);
30897         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30899         this_ptr_conv.is_owned = false;
30900         void* val_ptr = untag_ptr(val);
30901         CHECK_ACCESS(val_ptr);
30902         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
30903         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
30904         ChannelConfigUpdate_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val_conv);
30905 }
30906
30907 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_get_forwarding_fee_base_msat"))) TS_ChannelConfigUpdate_get_forwarding_fee_base_msat(uint64_t this_ptr) {
30908         LDKChannelConfigUpdate this_ptr_conv;
30909         this_ptr_conv.inner = untag_ptr(this_ptr);
30910         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30912         this_ptr_conv.is_owned = false;
30913         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
30914         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_base_msat(&this_ptr_conv);
30915         uint64_t ret_ref = tag_ptr(ret_copy, true);
30916         return ret_ref;
30917 }
30918
30919 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) {
30920         LDKChannelConfigUpdate this_ptr_conv;
30921         this_ptr_conv.inner = untag_ptr(this_ptr);
30922         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30924         this_ptr_conv.is_owned = false;
30925         void* val_ptr = untag_ptr(val);
30926         CHECK_ACCESS(val_ptr);
30927         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
30928         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
30929         ChannelConfigUpdate_set_forwarding_fee_base_msat(&this_ptr_conv, val_conv);
30930 }
30931
30932 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_get_cltv_expiry_delta"))) TS_ChannelConfigUpdate_get_cltv_expiry_delta(uint64_t this_ptr) {
30933         LDKChannelConfigUpdate this_ptr_conv;
30934         this_ptr_conv.inner = untag_ptr(this_ptr);
30935         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30937         this_ptr_conv.is_owned = false;
30938         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
30939         *ret_copy = ChannelConfigUpdate_get_cltv_expiry_delta(&this_ptr_conv);
30940         uint64_t ret_ref = tag_ptr(ret_copy, true);
30941         return ret_ref;
30942 }
30943
30944 void  __attribute__((export_name("TS_ChannelConfigUpdate_set_cltv_expiry_delta"))) TS_ChannelConfigUpdate_set_cltv_expiry_delta(uint64_t this_ptr, uint64_t val) {
30945         LDKChannelConfigUpdate this_ptr_conv;
30946         this_ptr_conv.inner = untag_ptr(this_ptr);
30947         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30949         this_ptr_conv.is_owned = false;
30950         void* val_ptr = untag_ptr(val);
30951         CHECK_ACCESS(val_ptr);
30952         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
30953         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
30954         ChannelConfigUpdate_set_cltv_expiry_delta(&this_ptr_conv, val_conv);
30955 }
30956
30957 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) {
30958         LDKChannelConfigUpdate this_ptr_conv;
30959         this_ptr_conv.inner = untag_ptr(this_ptr);
30960         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30962         this_ptr_conv.is_owned = false;
30963         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
30964         *ret_copy = ChannelConfigUpdate_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
30965         uint64_t ret_ref = tag_ptr(ret_copy, true);
30966         return ret_ref;
30967 }
30968
30969 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) {
30970         LDKChannelConfigUpdate this_ptr_conv;
30971         this_ptr_conv.inner = untag_ptr(this_ptr);
30972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30974         this_ptr_conv.is_owned = false;
30975         void* val_ptr = untag_ptr(val);
30976         CHECK_ACCESS(val_ptr);
30977         LDKCOption_MaxDustHTLCExposureZ val_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(val_ptr);
30978         val_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(val));
30979         ChannelConfigUpdate_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val_conv);
30980 }
30981
30982 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) {
30983         LDKChannelConfigUpdate this_ptr_conv;
30984         this_ptr_conv.inner = untag_ptr(this_ptr);
30985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30987         this_ptr_conv.is_owned = false;
30988         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
30989         *ret_copy = ChannelConfigUpdate_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
30990         uint64_t ret_ref = tag_ptr(ret_copy, true);
30991         return ret_ref;
30992 }
30993
30994 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) {
30995         LDKChannelConfigUpdate this_ptr_conv;
30996         this_ptr_conv.inner = untag_ptr(this_ptr);
30997         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30999         this_ptr_conv.is_owned = false;
31000         void* val_ptr = untag_ptr(val);
31001         CHECK_ACCESS(val_ptr);
31002         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
31003         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
31004         ChannelConfigUpdate_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val_conv);
31005 }
31006
31007 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) {
31008         void* forwarding_fee_proportional_millionths_arg_ptr = untag_ptr(forwarding_fee_proportional_millionths_arg);
31009         CHECK_ACCESS(forwarding_fee_proportional_millionths_arg_ptr);
31010         LDKCOption_u32Z forwarding_fee_proportional_millionths_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_proportional_millionths_arg_ptr);
31011         forwarding_fee_proportional_millionths_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_proportional_millionths_arg));
31012         void* forwarding_fee_base_msat_arg_ptr = untag_ptr(forwarding_fee_base_msat_arg);
31013         CHECK_ACCESS(forwarding_fee_base_msat_arg_ptr);
31014         LDKCOption_u32Z forwarding_fee_base_msat_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_base_msat_arg_ptr);
31015         forwarding_fee_base_msat_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_base_msat_arg));
31016         void* cltv_expiry_delta_arg_ptr = untag_ptr(cltv_expiry_delta_arg);
31017         CHECK_ACCESS(cltv_expiry_delta_arg_ptr);
31018         LDKCOption_u16Z cltv_expiry_delta_arg_conv = *(LDKCOption_u16Z*)(cltv_expiry_delta_arg_ptr);
31019         cltv_expiry_delta_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(cltv_expiry_delta_arg));
31020         void* max_dust_htlc_exposure_msat_arg_ptr = untag_ptr(max_dust_htlc_exposure_msat_arg);
31021         CHECK_ACCESS(max_dust_htlc_exposure_msat_arg_ptr);
31022         LDKCOption_MaxDustHTLCExposureZ max_dust_htlc_exposure_msat_arg_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(max_dust_htlc_exposure_msat_arg_ptr);
31023         max_dust_htlc_exposure_msat_arg_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(max_dust_htlc_exposure_msat_arg));
31024         void* force_close_avoidance_max_fee_satoshis_arg_ptr = untag_ptr(force_close_avoidance_max_fee_satoshis_arg);
31025         CHECK_ACCESS(force_close_avoidance_max_fee_satoshis_arg_ptr);
31026         LDKCOption_u64Z force_close_avoidance_max_fee_satoshis_arg_conv = *(LDKCOption_u64Z*)(force_close_avoidance_max_fee_satoshis_arg_ptr);
31027         force_close_avoidance_max_fee_satoshis_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(force_close_avoidance_max_fee_satoshis_arg));
31028         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);
31029         uint64_t ret_ref = 0;
31030         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31031         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31032         return ret_ref;
31033 }
31034
31035 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_default"))) TS_ChannelConfigUpdate_default() {
31036         LDKChannelConfigUpdate ret_var = ChannelConfigUpdate_default();
31037         uint64_t ret_ref = 0;
31038         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31039         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31040         return ret_ref;
31041 }
31042
31043 void  __attribute__((export_name("TS_UserConfig_free"))) TS_UserConfig_free(uint64_t this_obj) {
31044         LDKUserConfig this_obj_conv;
31045         this_obj_conv.inner = untag_ptr(this_obj);
31046         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31048         UserConfig_free(this_obj_conv);
31049 }
31050
31051 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_config"))) TS_UserConfig_get_channel_handshake_config(uint64_t this_ptr) {
31052         LDKUserConfig this_ptr_conv;
31053         this_ptr_conv.inner = untag_ptr(this_ptr);
31054         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31056         this_ptr_conv.is_owned = false;
31057         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
31058         uint64_t ret_ref = 0;
31059         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31060         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31061         return ret_ref;
31062 }
31063
31064 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_config"))) TS_UserConfig_set_channel_handshake_config(uint64_t this_ptr, uint64_t val) {
31065         LDKUserConfig this_ptr_conv;
31066         this_ptr_conv.inner = untag_ptr(this_ptr);
31067         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31069         this_ptr_conv.is_owned = false;
31070         LDKChannelHandshakeConfig val_conv;
31071         val_conv.inner = untag_ptr(val);
31072         val_conv.is_owned = ptr_is_owned(val);
31073         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31074         val_conv = ChannelHandshakeConfig_clone(&val_conv);
31075         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
31076 }
31077
31078 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_limits"))) TS_UserConfig_get_channel_handshake_limits(uint64_t this_ptr) {
31079         LDKUserConfig this_ptr_conv;
31080         this_ptr_conv.inner = untag_ptr(this_ptr);
31081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31083         this_ptr_conv.is_owned = false;
31084         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
31085         uint64_t ret_ref = 0;
31086         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31087         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31088         return ret_ref;
31089 }
31090
31091 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_limits"))) TS_UserConfig_set_channel_handshake_limits(uint64_t this_ptr, uint64_t val) {
31092         LDKUserConfig this_ptr_conv;
31093         this_ptr_conv.inner = untag_ptr(this_ptr);
31094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31096         this_ptr_conv.is_owned = false;
31097         LDKChannelHandshakeLimits val_conv;
31098         val_conv.inner = untag_ptr(val);
31099         val_conv.is_owned = ptr_is_owned(val);
31100         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31101         val_conv = ChannelHandshakeLimits_clone(&val_conv);
31102         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
31103 }
31104
31105 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_config"))) TS_UserConfig_get_channel_config(uint64_t this_ptr) {
31106         LDKUserConfig this_ptr_conv;
31107         this_ptr_conv.inner = untag_ptr(this_ptr);
31108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31110         this_ptr_conv.is_owned = false;
31111         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
31112         uint64_t ret_ref = 0;
31113         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31114         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31115         return ret_ref;
31116 }
31117
31118 void  __attribute__((export_name("TS_UserConfig_set_channel_config"))) TS_UserConfig_set_channel_config(uint64_t this_ptr, uint64_t val) {
31119         LDKUserConfig this_ptr_conv;
31120         this_ptr_conv.inner = untag_ptr(this_ptr);
31121         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31123         this_ptr_conv.is_owned = false;
31124         LDKChannelConfig val_conv;
31125         val_conv.inner = untag_ptr(val);
31126         val_conv.is_owned = ptr_is_owned(val);
31127         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31128         val_conv = ChannelConfig_clone(&val_conv);
31129         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
31130 }
31131
31132 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_forwards_to_priv_channels"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint64_t this_ptr) {
31133         LDKUserConfig this_ptr_conv;
31134         this_ptr_conv.inner = untag_ptr(this_ptr);
31135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31137         this_ptr_conv.is_owned = false;
31138         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
31139         return ret_conv;
31140 }
31141
31142 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) {
31143         LDKUserConfig this_ptr_conv;
31144         this_ptr_conv.inner = untag_ptr(this_ptr);
31145         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31147         this_ptr_conv.is_owned = false;
31148         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
31149 }
31150
31151 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_inbound_channels"))) TS_UserConfig_get_accept_inbound_channels(uint64_t this_ptr) {
31152         LDKUserConfig this_ptr_conv;
31153         this_ptr_conv.inner = untag_ptr(this_ptr);
31154         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31156         this_ptr_conv.is_owned = false;
31157         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
31158         return ret_conv;
31159 }
31160
31161 void  __attribute__((export_name("TS_UserConfig_set_accept_inbound_channels"))) TS_UserConfig_set_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
31162         LDKUserConfig this_ptr_conv;
31163         this_ptr_conv.inner = untag_ptr(this_ptr);
31164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31166         this_ptr_conv.is_owned = false;
31167         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
31168 }
31169
31170 jboolean  __attribute__((export_name("TS_UserConfig_get_manually_accept_inbound_channels"))) TS_UserConfig_get_manually_accept_inbound_channels(uint64_t this_ptr) {
31171         LDKUserConfig this_ptr_conv;
31172         this_ptr_conv.inner = untag_ptr(this_ptr);
31173         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31175         this_ptr_conv.is_owned = false;
31176         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
31177         return ret_conv;
31178 }
31179
31180 void  __attribute__((export_name("TS_UserConfig_set_manually_accept_inbound_channels"))) TS_UserConfig_set_manually_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
31181         LDKUserConfig this_ptr_conv;
31182         this_ptr_conv.inner = untag_ptr(this_ptr);
31183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31185         this_ptr_conv.is_owned = false;
31186         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
31187 }
31188
31189 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_intercept_htlcs"))) TS_UserConfig_get_accept_intercept_htlcs(uint64_t this_ptr) {
31190         LDKUserConfig this_ptr_conv;
31191         this_ptr_conv.inner = untag_ptr(this_ptr);
31192         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31194         this_ptr_conv.is_owned = false;
31195         jboolean ret_conv = UserConfig_get_accept_intercept_htlcs(&this_ptr_conv);
31196         return ret_conv;
31197 }
31198
31199 void  __attribute__((export_name("TS_UserConfig_set_accept_intercept_htlcs"))) TS_UserConfig_set_accept_intercept_htlcs(uint64_t this_ptr, jboolean val) {
31200         LDKUserConfig this_ptr_conv;
31201         this_ptr_conv.inner = untag_ptr(this_ptr);
31202         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31204         this_ptr_conv.is_owned = false;
31205         UserConfig_set_accept_intercept_htlcs(&this_ptr_conv, val);
31206 }
31207
31208 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_mpp_keysend"))) TS_UserConfig_get_accept_mpp_keysend(uint64_t this_ptr) {
31209         LDKUserConfig this_ptr_conv;
31210         this_ptr_conv.inner = untag_ptr(this_ptr);
31211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31213         this_ptr_conv.is_owned = false;
31214         jboolean ret_conv = UserConfig_get_accept_mpp_keysend(&this_ptr_conv);
31215         return ret_conv;
31216 }
31217
31218 void  __attribute__((export_name("TS_UserConfig_set_accept_mpp_keysend"))) TS_UserConfig_set_accept_mpp_keysend(uint64_t this_ptr, jboolean val) {
31219         LDKUserConfig this_ptr_conv;
31220         this_ptr_conv.inner = untag_ptr(this_ptr);
31221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31223         this_ptr_conv.is_owned = false;
31224         UserConfig_set_accept_mpp_keysend(&this_ptr_conv, val);
31225 }
31226
31227 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) {
31228         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
31229         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
31230         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
31231         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
31232         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
31233         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
31234         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
31235         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
31236         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
31237         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
31238         LDKChannelConfig channel_config_arg_conv;
31239         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
31240         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
31241         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
31242         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
31243         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);
31244         uint64_t ret_ref = 0;
31245         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31246         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31247         return ret_ref;
31248 }
31249
31250 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
31251         LDKUserConfig ret_var = UserConfig_clone(arg);
31252         uint64_t ret_ref = 0;
31253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31255         return ret_ref;
31256 }
31257 int64_t  __attribute__((export_name("TS_UserConfig_clone_ptr"))) TS_UserConfig_clone_ptr(uint64_t arg) {
31258         LDKUserConfig arg_conv;
31259         arg_conv.inner = untag_ptr(arg);
31260         arg_conv.is_owned = ptr_is_owned(arg);
31261         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31262         arg_conv.is_owned = false;
31263         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
31264         return ret_conv;
31265 }
31266
31267 uint64_t  __attribute__((export_name("TS_UserConfig_clone"))) TS_UserConfig_clone(uint64_t orig) {
31268         LDKUserConfig orig_conv;
31269         orig_conv.inner = untag_ptr(orig);
31270         orig_conv.is_owned = ptr_is_owned(orig);
31271         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31272         orig_conv.is_owned = false;
31273         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
31274         uint64_t ret_ref = 0;
31275         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31276         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31277         return ret_ref;
31278 }
31279
31280 uint64_t  __attribute__((export_name("TS_UserConfig_default"))) TS_UserConfig_default() {
31281         LDKUserConfig ret_var = UserConfig_default();
31282         uint64_t ret_ref = 0;
31283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31284         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31285         return ret_ref;
31286 }
31287
31288 void  __attribute__((export_name("TS_BestBlock_free"))) TS_BestBlock_free(uint64_t this_obj) {
31289         LDKBestBlock this_obj_conv;
31290         this_obj_conv.inner = untag_ptr(this_obj);
31291         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31293         BestBlock_free(this_obj_conv);
31294 }
31295
31296 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
31297         LDKBestBlock ret_var = BestBlock_clone(arg);
31298         uint64_t ret_ref = 0;
31299         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31300         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31301         return ret_ref;
31302 }
31303 int64_t  __attribute__((export_name("TS_BestBlock_clone_ptr"))) TS_BestBlock_clone_ptr(uint64_t arg) {
31304         LDKBestBlock arg_conv;
31305         arg_conv.inner = untag_ptr(arg);
31306         arg_conv.is_owned = ptr_is_owned(arg);
31307         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31308         arg_conv.is_owned = false;
31309         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
31310         return ret_conv;
31311 }
31312
31313 uint64_t  __attribute__((export_name("TS_BestBlock_clone"))) TS_BestBlock_clone(uint64_t orig) {
31314         LDKBestBlock orig_conv;
31315         orig_conv.inner = untag_ptr(orig);
31316         orig_conv.is_owned = ptr_is_owned(orig);
31317         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31318         orig_conv.is_owned = false;
31319         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
31320         uint64_t ret_ref = 0;
31321         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31322         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31323         return ret_ref;
31324 }
31325
31326 jboolean  __attribute__((export_name("TS_BestBlock_eq"))) TS_BestBlock_eq(uint64_t a, uint64_t b) {
31327         LDKBestBlock a_conv;
31328         a_conv.inner = untag_ptr(a);
31329         a_conv.is_owned = ptr_is_owned(a);
31330         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31331         a_conv.is_owned = false;
31332         LDKBestBlock b_conv;
31333         b_conv.inner = untag_ptr(b);
31334         b_conv.is_owned = ptr_is_owned(b);
31335         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31336         b_conv.is_owned = false;
31337         jboolean ret_conv = BestBlock_eq(&a_conv, &b_conv);
31338         return ret_conv;
31339 }
31340
31341 uint64_t  __attribute__((export_name("TS_BestBlock_from_network"))) TS_BestBlock_from_network(uint32_t network) {
31342         LDKNetwork network_conv = LDKNetwork_from_js(network);
31343         LDKBestBlock ret_var = BestBlock_from_network(network_conv);
31344         uint64_t ret_ref = 0;
31345         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31346         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31347         return ret_ref;
31348 }
31349
31350 uint64_t  __attribute__((export_name("TS_BestBlock_new"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
31351         LDKThirtyTwoBytes block_hash_ref;
31352         CHECK(block_hash->arr_len == 32);
31353         memcpy(block_hash_ref.data, block_hash->elems, 32); FREE(block_hash);
31354         LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
31355         uint64_t ret_ref = 0;
31356         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31357         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31358         return ret_ref;
31359 }
31360
31361 int8_tArray  __attribute__((export_name("TS_BestBlock_block_hash"))) TS_BestBlock_block_hash(uint64_t this_arg) {
31362         LDKBestBlock this_arg_conv;
31363         this_arg_conv.inner = untag_ptr(this_arg);
31364         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31366         this_arg_conv.is_owned = false;
31367         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31368         memcpy(ret_arr->elems, BestBlock_block_hash(&this_arg_conv).data, 32);
31369         return ret_arr;
31370 }
31371
31372 int32_t  __attribute__((export_name("TS_BestBlock_height"))) TS_BestBlock_height(uint64_t this_arg) {
31373         LDKBestBlock this_arg_conv;
31374         this_arg_conv.inner = untag_ptr(this_arg);
31375         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31377         this_arg_conv.is_owned = false;
31378         int32_t ret_conv = BestBlock_height(&this_arg_conv);
31379         return ret_conv;
31380 }
31381
31382 void  __attribute__((export_name("TS_Listen_free"))) TS_Listen_free(uint64_t this_ptr) {
31383         if (!ptr_is_owned(this_ptr)) return;
31384         void* this_ptr_ptr = untag_ptr(this_ptr);
31385         CHECK_ACCESS(this_ptr_ptr);
31386         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
31387         FREE(untag_ptr(this_ptr));
31388         Listen_free(this_ptr_conv);
31389 }
31390
31391 void  __attribute__((export_name("TS_Confirm_free"))) TS_Confirm_free(uint64_t this_ptr) {
31392         if (!ptr_is_owned(this_ptr)) return;
31393         void* this_ptr_ptr = untag_ptr(this_ptr);
31394         CHECK_ACCESS(this_ptr_ptr);
31395         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
31396         FREE(untag_ptr(this_ptr));
31397         Confirm_free(this_ptr_conv);
31398 }
31399
31400 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_clone"))) TS_ChannelMonitorUpdateStatus_clone(uint64_t orig) {
31401         LDKChannelMonitorUpdateStatus* orig_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(orig);
31402         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_clone(orig_conv));
31403         return ret_conv;
31404 }
31405
31406 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_completed"))) TS_ChannelMonitorUpdateStatus_completed() {
31407         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_completed());
31408         return ret_conv;
31409 }
31410
31411 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_in_progress"))) TS_ChannelMonitorUpdateStatus_in_progress() {
31412         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_in_progress());
31413         return ret_conv;
31414 }
31415
31416 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_unrecoverable_error"))) TS_ChannelMonitorUpdateStatus_unrecoverable_error() {
31417         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_unrecoverable_error());
31418         return ret_conv;
31419 }
31420
31421 jboolean  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_eq"))) TS_ChannelMonitorUpdateStatus_eq(uint64_t a, uint64_t b) {
31422         LDKChannelMonitorUpdateStatus* a_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(a);
31423         LDKChannelMonitorUpdateStatus* b_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(b);
31424         jboolean ret_conv = ChannelMonitorUpdateStatus_eq(a_conv, b_conv);
31425         return ret_conv;
31426 }
31427
31428 void  __attribute__((export_name("TS_Watch_free"))) TS_Watch_free(uint64_t this_ptr) {
31429         if (!ptr_is_owned(this_ptr)) return;
31430         void* this_ptr_ptr = untag_ptr(this_ptr);
31431         CHECK_ACCESS(this_ptr_ptr);
31432         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
31433         FREE(untag_ptr(this_ptr));
31434         Watch_free(this_ptr_conv);
31435 }
31436
31437 void  __attribute__((export_name("TS_Filter_free"))) TS_Filter_free(uint64_t this_ptr) {
31438         if (!ptr_is_owned(this_ptr)) return;
31439         void* this_ptr_ptr = untag_ptr(this_ptr);
31440         CHECK_ACCESS(this_ptr_ptr);
31441         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
31442         FREE(untag_ptr(this_ptr));
31443         Filter_free(this_ptr_conv);
31444 }
31445
31446 void  __attribute__((export_name("TS_WatchedOutput_free"))) TS_WatchedOutput_free(uint64_t this_obj) {
31447         LDKWatchedOutput this_obj_conv;
31448         this_obj_conv.inner = untag_ptr(this_obj);
31449         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31451         WatchedOutput_free(this_obj_conv);
31452 }
31453
31454 uint64_t  __attribute__((export_name("TS_WatchedOutput_get_block_hash"))) TS_WatchedOutput_get_block_hash(uint64_t this_ptr) {
31455         LDKWatchedOutput this_ptr_conv;
31456         this_ptr_conv.inner = untag_ptr(this_ptr);
31457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31459         this_ptr_conv.is_owned = false;
31460         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
31461         *ret_copy = WatchedOutput_get_block_hash(&this_ptr_conv);
31462         uint64_t ret_ref = tag_ptr(ret_copy, true);
31463         return ret_ref;
31464 }
31465
31466 void  __attribute__((export_name("TS_WatchedOutput_set_block_hash"))) TS_WatchedOutput_set_block_hash(uint64_t this_ptr, uint64_t val) {
31467         LDKWatchedOutput this_ptr_conv;
31468         this_ptr_conv.inner = untag_ptr(this_ptr);
31469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31471         this_ptr_conv.is_owned = false;
31472         void* val_ptr = untag_ptr(val);
31473         CHECK_ACCESS(val_ptr);
31474         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
31475         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
31476         WatchedOutput_set_block_hash(&this_ptr_conv, val_conv);
31477 }
31478
31479 uint64_t  __attribute__((export_name("TS_WatchedOutput_get_outpoint"))) TS_WatchedOutput_get_outpoint(uint64_t this_ptr) {
31480         LDKWatchedOutput this_ptr_conv;
31481         this_ptr_conv.inner = untag_ptr(this_ptr);
31482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31484         this_ptr_conv.is_owned = false;
31485         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
31486         uint64_t ret_ref = 0;
31487         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31488         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31489         return ret_ref;
31490 }
31491
31492 void  __attribute__((export_name("TS_WatchedOutput_set_outpoint"))) TS_WatchedOutput_set_outpoint(uint64_t this_ptr, uint64_t val) {
31493         LDKWatchedOutput this_ptr_conv;
31494         this_ptr_conv.inner = untag_ptr(this_ptr);
31495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31497         this_ptr_conv.is_owned = false;
31498         LDKOutPoint val_conv;
31499         val_conv.inner = untag_ptr(val);
31500         val_conv.is_owned = ptr_is_owned(val);
31501         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31502         val_conv = OutPoint_clone(&val_conv);
31503         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
31504 }
31505
31506 int8_tArray  __attribute__((export_name("TS_WatchedOutput_get_script_pubkey"))) TS_WatchedOutput_get_script_pubkey(uint64_t this_ptr) {
31507         LDKWatchedOutput this_ptr_conv;
31508         this_ptr_conv.inner = untag_ptr(this_ptr);
31509         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31511         this_ptr_conv.is_owned = false;
31512         LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
31513         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31514         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31515         return ret_arr;
31516 }
31517
31518 void  __attribute__((export_name("TS_WatchedOutput_set_script_pubkey"))) TS_WatchedOutput_set_script_pubkey(uint64_t this_ptr, int8_tArray val) {
31519         LDKWatchedOutput this_ptr_conv;
31520         this_ptr_conv.inner = untag_ptr(this_ptr);
31521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31523         this_ptr_conv.is_owned = false;
31524         LDKCVec_u8Z val_ref;
31525         val_ref.datalen = val->arr_len;
31526         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
31527         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
31528         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
31529 }
31530
31531 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) {
31532         void* block_hash_arg_ptr = untag_ptr(block_hash_arg);
31533         CHECK_ACCESS(block_hash_arg_ptr);
31534         LDKCOption_ThirtyTwoBytesZ block_hash_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(block_hash_arg_ptr);
31535         block_hash_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(block_hash_arg));
31536         LDKOutPoint outpoint_arg_conv;
31537         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
31538         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
31539         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
31540         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
31541         LDKCVec_u8Z script_pubkey_arg_ref;
31542         script_pubkey_arg_ref.datalen = script_pubkey_arg->arr_len;
31543         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
31544         memcpy(script_pubkey_arg_ref.data, script_pubkey_arg->elems, script_pubkey_arg_ref.datalen); FREE(script_pubkey_arg);
31545         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_conv, outpoint_arg_conv, script_pubkey_arg_ref);
31546         uint64_t ret_ref = 0;
31547         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31548         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31549         return ret_ref;
31550 }
31551
31552 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
31553         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
31554         uint64_t ret_ref = 0;
31555         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31556         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31557         return ret_ref;
31558 }
31559 int64_t  __attribute__((export_name("TS_WatchedOutput_clone_ptr"))) TS_WatchedOutput_clone_ptr(uint64_t arg) {
31560         LDKWatchedOutput arg_conv;
31561         arg_conv.inner = untag_ptr(arg);
31562         arg_conv.is_owned = ptr_is_owned(arg);
31563         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31564         arg_conv.is_owned = false;
31565         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
31566         return ret_conv;
31567 }
31568
31569 uint64_t  __attribute__((export_name("TS_WatchedOutput_clone"))) TS_WatchedOutput_clone(uint64_t orig) {
31570         LDKWatchedOutput orig_conv;
31571         orig_conv.inner = untag_ptr(orig);
31572         orig_conv.is_owned = ptr_is_owned(orig);
31573         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31574         orig_conv.is_owned = false;
31575         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
31576         uint64_t ret_ref = 0;
31577         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31578         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31579         return ret_ref;
31580 }
31581
31582 jboolean  __attribute__((export_name("TS_WatchedOutput_eq"))) TS_WatchedOutput_eq(uint64_t a, uint64_t b) {
31583         LDKWatchedOutput a_conv;
31584         a_conv.inner = untag_ptr(a);
31585         a_conv.is_owned = ptr_is_owned(a);
31586         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31587         a_conv.is_owned = false;
31588         LDKWatchedOutput b_conv;
31589         b_conv.inner = untag_ptr(b);
31590         b_conv.is_owned = ptr_is_owned(b);
31591         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31592         b_conv.is_owned = false;
31593         jboolean ret_conv = WatchedOutput_eq(&a_conv, &b_conv);
31594         return ret_conv;
31595 }
31596
31597 int64_t  __attribute__((export_name("TS_WatchedOutput_hash"))) TS_WatchedOutput_hash(uint64_t o) {
31598         LDKWatchedOutput o_conv;
31599         o_conv.inner = untag_ptr(o);
31600         o_conv.is_owned = ptr_is_owned(o);
31601         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31602         o_conv.is_owned = false;
31603         int64_t ret_conv = WatchedOutput_hash(&o_conv);
31604         return ret_conv;
31605 }
31606
31607 void  __attribute__((export_name("TS_BroadcasterInterface_free"))) TS_BroadcasterInterface_free(uint64_t this_ptr) {
31608         if (!ptr_is_owned(this_ptr)) return;
31609         void* this_ptr_ptr = untag_ptr(this_ptr);
31610         CHECK_ACCESS(this_ptr_ptr);
31611         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
31612         FREE(untag_ptr(this_ptr));
31613         BroadcasterInterface_free(this_ptr_conv);
31614 }
31615
31616 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_clone"))) TS_ConfirmationTarget_clone(uint64_t orig) {
31617         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
31618         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
31619         return ret_conv;
31620 }
31621
31622 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_mempool_minimum"))) TS_ConfirmationTarget_mempool_minimum() {
31623         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_mempool_minimum());
31624         return ret_conv;
31625 }
31626
31627 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_background"))) TS_ConfirmationTarget_background() {
31628         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
31629         return ret_conv;
31630 }
31631
31632 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_normal"))) TS_ConfirmationTarget_normal() {
31633         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
31634         return ret_conv;
31635 }
31636
31637 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_high_priority"))) TS_ConfirmationTarget_high_priority() {
31638         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
31639         return ret_conv;
31640 }
31641
31642 int64_t  __attribute__((export_name("TS_ConfirmationTarget_hash"))) TS_ConfirmationTarget_hash(uint64_t o) {
31643         LDKConfirmationTarget* o_conv = (LDKConfirmationTarget*)untag_ptr(o);
31644         int64_t ret_conv = ConfirmationTarget_hash(o_conv);
31645         return ret_conv;
31646 }
31647
31648 jboolean  __attribute__((export_name("TS_ConfirmationTarget_eq"))) TS_ConfirmationTarget_eq(uint64_t a, uint64_t b) {
31649         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
31650         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
31651         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
31652         return ret_conv;
31653 }
31654
31655 void  __attribute__((export_name("TS_FeeEstimator_free"))) TS_FeeEstimator_free(uint64_t this_ptr) {
31656         if (!ptr_is_owned(this_ptr)) return;
31657         void* this_ptr_ptr = untag_ptr(this_ptr);
31658         CHECK_ACCESS(this_ptr_ptr);
31659         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
31660         FREE(untag_ptr(this_ptr));
31661         FeeEstimator_free(this_ptr_conv);
31662 }
31663
31664 void  __attribute__((export_name("TS_MonitorUpdateId_free"))) TS_MonitorUpdateId_free(uint64_t this_obj) {
31665         LDKMonitorUpdateId this_obj_conv;
31666         this_obj_conv.inner = untag_ptr(this_obj);
31667         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31669         MonitorUpdateId_free(this_obj_conv);
31670 }
31671
31672 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
31673         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
31674         uint64_t ret_ref = 0;
31675         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31676         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31677         return ret_ref;
31678 }
31679 int64_t  __attribute__((export_name("TS_MonitorUpdateId_clone_ptr"))) TS_MonitorUpdateId_clone_ptr(uint64_t arg) {
31680         LDKMonitorUpdateId arg_conv;
31681         arg_conv.inner = untag_ptr(arg);
31682         arg_conv.is_owned = ptr_is_owned(arg);
31683         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31684         arg_conv.is_owned = false;
31685         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
31686         return ret_conv;
31687 }
31688
31689 uint64_t  __attribute__((export_name("TS_MonitorUpdateId_clone"))) TS_MonitorUpdateId_clone(uint64_t orig) {
31690         LDKMonitorUpdateId orig_conv;
31691         orig_conv.inner = untag_ptr(orig);
31692         orig_conv.is_owned = ptr_is_owned(orig);
31693         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31694         orig_conv.is_owned = false;
31695         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
31696         uint64_t ret_ref = 0;
31697         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31698         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31699         return ret_ref;
31700 }
31701
31702 int64_t  __attribute__((export_name("TS_MonitorUpdateId_hash"))) TS_MonitorUpdateId_hash(uint64_t o) {
31703         LDKMonitorUpdateId o_conv;
31704         o_conv.inner = untag_ptr(o);
31705         o_conv.is_owned = ptr_is_owned(o);
31706         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31707         o_conv.is_owned = false;
31708         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
31709         return ret_conv;
31710 }
31711
31712 jboolean  __attribute__((export_name("TS_MonitorUpdateId_eq"))) TS_MonitorUpdateId_eq(uint64_t a, uint64_t b) {
31713         LDKMonitorUpdateId a_conv;
31714         a_conv.inner = untag_ptr(a);
31715         a_conv.is_owned = ptr_is_owned(a);
31716         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31717         a_conv.is_owned = false;
31718         LDKMonitorUpdateId b_conv;
31719         b_conv.inner = untag_ptr(b);
31720         b_conv.is_owned = ptr_is_owned(b);
31721         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31722         b_conv.is_owned = false;
31723         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
31724         return ret_conv;
31725 }
31726
31727 void  __attribute__((export_name("TS_Persist_free"))) TS_Persist_free(uint64_t this_ptr) {
31728         if (!ptr_is_owned(this_ptr)) return;
31729         void* this_ptr_ptr = untag_ptr(this_ptr);
31730         CHECK_ACCESS(this_ptr_ptr);
31731         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
31732         FREE(untag_ptr(this_ptr));
31733         Persist_free(this_ptr_conv);
31734 }
31735
31736 void  __attribute__((export_name("TS_LockedChannelMonitor_free"))) TS_LockedChannelMonitor_free(uint64_t this_obj) {
31737         LDKLockedChannelMonitor this_obj_conv;
31738         this_obj_conv.inner = untag_ptr(this_obj);
31739         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31741         LockedChannelMonitor_free(this_obj_conv);
31742 }
31743
31744 void  __attribute__((export_name("TS_ChainMonitor_free"))) TS_ChainMonitor_free(uint64_t this_obj) {
31745         LDKChainMonitor this_obj_conv;
31746         this_obj_conv.inner = untag_ptr(this_obj);
31747         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31749         ChainMonitor_free(this_obj_conv);
31750 }
31751
31752 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) {
31753         void* chain_source_ptr = untag_ptr(chain_source);
31754         CHECK_ACCESS(chain_source_ptr);
31755         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
31756         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
31757         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
31758                 // Manually implement clone for Java trait instances
31759                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
31760                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31761                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
31762                 }
31763         }
31764         void* broadcaster_ptr = untag_ptr(broadcaster);
31765         CHECK_ACCESS(broadcaster_ptr);
31766         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
31767         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
31768                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31769                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
31770         }
31771         void* logger_ptr = untag_ptr(logger);
31772         CHECK_ACCESS(logger_ptr);
31773         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
31774         if (logger_conv.free == LDKLogger_JCalls_free) {
31775                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31776                 LDKLogger_JCalls_cloned(&logger_conv);
31777         }
31778         void* feeest_ptr = untag_ptr(feeest);
31779         CHECK_ACCESS(feeest_ptr);
31780         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
31781         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
31782                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31783                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
31784         }
31785         void* persister_ptr = untag_ptr(persister);
31786         CHECK_ACCESS(persister_ptr);
31787         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
31788         if (persister_conv.free == LDKPersist_JCalls_free) {
31789                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31790                 LDKPersist_JCalls_cloned(&persister_conv);
31791         }
31792         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
31793         uint64_t ret_ref = 0;
31794         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31795         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31796         return ret_ref;
31797 }
31798
31799 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_get_claimable_balances"))) TS_ChainMonitor_get_claimable_balances(uint64_t this_arg, uint64_tArray ignored_channels) {
31800         LDKChainMonitor this_arg_conv;
31801         this_arg_conv.inner = untag_ptr(this_arg);
31802         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31804         this_arg_conv.is_owned = false;
31805         LDKCVec_ChannelDetailsZ ignored_channels_constr;
31806         ignored_channels_constr.datalen = ignored_channels->arr_len;
31807         if (ignored_channels_constr.datalen > 0)
31808                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
31809         else
31810                 ignored_channels_constr.data = NULL;
31811         uint64_t* ignored_channels_vals = ignored_channels->elems;
31812         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
31813                 uint64_t ignored_channels_conv_16 = ignored_channels_vals[q];
31814                 LDKChannelDetails ignored_channels_conv_16_conv;
31815                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
31816                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
31817                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
31818                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
31819                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
31820         }
31821         FREE(ignored_channels);
31822         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
31823         uint64_tArray ret_arr = NULL;
31824         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
31825         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
31826         for (size_t j = 0; j < ret_var.datalen; j++) {
31827                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
31828                 *ret_conv_9_copy = ret_var.data[j];
31829                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
31830                 ret_arr_ptr[j] = ret_conv_9_ref;
31831         }
31832         
31833         FREE(ret_var.data);
31834         return ret_arr;
31835 }
31836
31837 uint64_t  __attribute__((export_name("TS_ChainMonitor_get_monitor"))) TS_ChainMonitor_get_monitor(uint64_t this_arg, uint64_t funding_txo) {
31838         LDKChainMonitor this_arg_conv;
31839         this_arg_conv.inner = untag_ptr(this_arg);
31840         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31842         this_arg_conv.is_owned = false;
31843         LDKOutPoint funding_txo_conv;
31844         funding_txo_conv.inner = untag_ptr(funding_txo);
31845         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
31846         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
31847         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
31848         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
31849         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
31850         return tag_ptr(ret_conv, true);
31851 }
31852
31853 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_monitors"))) TS_ChainMonitor_list_monitors(uint64_t this_arg) {
31854         LDKChainMonitor this_arg_conv;
31855         this_arg_conv.inner = untag_ptr(this_arg);
31856         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31858         this_arg_conv.is_owned = false;
31859         LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
31860         uint64_tArray ret_arr = NULL;
31861         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
31862         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
31863         for (size_t k = 0; k < ret_var.datalen; k++) {
31864                 LDKOutPoint ret_conv_10_var = ret_var.data[k];
31865                 uint64_t ret_conv_10_ref = 0;
31866                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
31867                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
31868                 ret_arr_ptr[k] = ret_conv_10_ref;
31869         }
31870         
31871         FREE(ret_var.data);
31872         return ret_arr;
31873 }
31874
31875 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_pending_monitor_updates"))) TS_ChainMonitor_list_pending_monitor_updates(uint64_t this_arg) {
31876         LDKChainMonitor this_arg_conv;
31877         this_arg_conv.inner = untag_ptr(this_arg);
31878         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31880         this_arg_conv.is_owned = false;
31881         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret_var = ChainMonitor_list_pending_monitor_updates(&this_arg_conv);
31882         uint64_tArray ret_arr = NULL;
31883         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
31884         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
31885         for (size_t p = 0; p < ret_var.datalen; p++) {
31886                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv_41_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
31887                 *ret_conv_41_conv = ret_var.data[p];
31888                 ret_arr_ptr[p] = tag_ptr(ret_conv_41_conv, true);
31889         }
31890         
31891         FREE(ret_var.data);
31892         return ret_arr;
31893 }
31894
31895 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) {
31896         LDKChainMonitor this_arg_conv;
31897         this_arg_conv.inner = untag_ptr(this_arg);
31898         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31900         this_arg_conv.is_owned = false;
31901         LDKOutPoint funding_txo_conv;
31902         funding_txo_conv.inner = untag_ptr(funding_txo);
31903         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
31904         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
31905         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
31906         LDKMonitorUpdateId completed_update_id_conv;
31907         completed_update_id_conv.inner = untag_ptr(completed_update_id);
31908         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
31909         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
31910         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
31911         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
31912         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
31913         return tag_ptr(ret_conv, true);
31914 }
31915
31916 uint64_t  __attribute__((export_name("TS_ChainMonitor_get_update_future"))) TS_ChainMonitor_get_update_future(uint64_t this_arg) {
31917         LDKChainMonitor this_arg_conv;
31918         this_arg_conv.inner = untag_ptr(this_arg);
31919         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31921         this_arg_conv.is_owned = false;
31922         LDKFuture ret_var = ChainMonitor_get_update_future(&this_arg_conv);
31923         uint64_t ret_ref = 0;
31924         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31925         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31926         return ret_ref;
31927 }
31928
31929 void  __attribute__((export_name("TS_ChainMonitor_rebroadcast_pending_claims"))) TS_ChainMonitor_rebroadcast_pending_claims(uint64_t this_arg) {
31930         LDKChainMonitor this_arg_conv;
31931         this_arg_conv.inner = untag_ptr(this_arg);
31932         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31934         this_arg_conv.is_owned = false;
31935         ChainMonitor_rebroadcast_pending_claims(&this_arg_conv);
31936 }
31937
31938 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Listen"))) TS_ChainMonitor_as_Listen(uint64_t this_arg) {
31939         LDKChainMonitor this_arg_conv;
31940         this_arg_conv.inner = untag_ptr(this_arg);
31941         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31943         this_arg_conv.is_owned = false;
31944         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
31945         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
31946         return tag_ptr(ret_ret, true);
31947 }
31948
31949 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Confirm"))) TS_ChainMonitor_as_Confirm(uint64_t this_arg) {
31950         LDKChainMonitor this_arg_conv;
31951         this_arg_conv.inner = untag_ptr(this_arg);
31952         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31954         this_arg_conv.is_owned = false;
31955         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
31956         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
31957         return tag_ptr(ret_ret, true);
31958 }
31959
31960 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Watch"))) TS_ChainMonitor_as_Watch(uint64_t this_arg) {
31961         LDKChainMonitor this_arg_conv;
31962         this_arg_conv.inner = untag_ptr(this_arg);
31963         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31965         this_arg_conv.is_owned = false;
31966         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
31967         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
31968         return tag_ptr(ret_ret, true);
31969 }
31970
31971 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_EventsProvider"))) TS_ChainMonitor_as_EventsProvider(uint64_t this_arg) {
31972         LDKChainMonitor this_arg_conv;
31973         this_arg_conv.inner = untag_ptr(this_arg);
31974         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31976         this_arg_conv.is_owned = false;
31977         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
31978         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
31979         return tag_ptr(ret_ret, true);
31980 }
31981
31982 void  __attribute__((export_name("TS_ChannelMonitorUpdate_free"))) TS_ChannelMonitorUpdate_free(uint64_t this_obj) {
31983         LDKChannelMonitorUpdate this_obj_conv;
31984         this_obj_conv.inner = untag_ptr(this_obj);
31985         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31987         ChannelMonitorUpdate_free(this_obj_conv);
31988 }
31989
31990 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_get_update_id"))) TS_ChannelMonitorUpdate_get_update_id(uint64_t this_ptr) {
31991         LDKChannelMonitorUpdate this_ptr_conv;
31992         this_ptr_conv.inner = untag_ptr(this_ptr);
31993         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31995         this_ptr_conv.is_owned = false;
31996         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
31997         return ret_conv;
31998 }
31999
32000 void  __attribute__((export_name("TS_ChannelMonitorUpdate_set_update_id"))) TS_ChannelMonitorUpdate_set_update_id(uint64_t this_ptr, int64_t val) {
32001         LDKChannelMonitorUpdate this_ptr_conv;
32002         this_ptr_conv.inner = untag_ptr(this_ptr);
32003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32005         this_ptr_conv.is_owned = false;
32006         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
32007 }
32008
32009 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
32010         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
32011         uint64_t ret_ref = 0;
32012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32014         return ret_ref;
32015 }
32016 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone_ptr"))) TS_ChannelMonitorUpdate_clone_ptr(uint64_t arg) {
32017         LDKChannelMonitorUpdate arg_conv;
32018         arg_conv.inner = untag_ptr(arg);
32019         arg_conv.is_owned = ptr_is_owned(arg);
32020         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32021         arg_conv.is_owned = false;
32022         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
32023         return ret_conv;
32024 }
32025
32026 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone"))) TS_ChannelMonitorUpdate_clone(uint64_t orig) {
32027         LDKChannelMonitorUpdate orig_conv;
32028         orig_conv.inner = untag_ptr(orig);
32029         orig_conv.is_owned = ptr_is_owned(orig);
32030         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32031         orig_conv.is_owned = false;
32032         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
32033         uint64_t ret_ref = 0;
32034         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32035         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32036         return ret_ref;
32037 }
32038
32039 jboolean  __attribute__((export_name("TS_ChannelMonitorUpdate_eq"))) TS_ChannelMonitorUpdate_eq(uint64_t a, uint64_t b) {
32040         LDKChannelMonitorUpdate a_conv;
32041         a_conv.inner = untag_ptr(a);
32042         a_conv.is_owned = ptr_is_owned(a);
32043         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32044         a_conv.is_owned = false;
32045         LDKChannelMonitorUpdate b_conv;
32046         b_conv.inner = untag_ptr(b);
32047         b_conv.is_owned = ptr_is_owned(b);
32048         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32049         b_conv.is_owned = false;
32050         jboolean ret_conv = ChannelMonitorUpdate_eq(&a_conv, &b_conv);
32051         return ret_conv;
32052 }
32053
32054 int8_tArray  __attribute__((export_name("TS_ChannelMonitorUpdate_write"))) TS_ChannelMonitorUpdate_write(uint64_t obj) {
32055         LDKChannelMonitorUpdate obj_conv;
32056         obj_conv.inner = untag_ptr(obj);
32057         obj_conv.is_owned = ptr_is_owned(obj);
32058         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32059         obj_conv.is_owned = false;
32060         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
32061         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32062         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32063         CVec_u8Z_free(ret_var);
32064         return ret_arr;
32065 }
32066
32067 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_read"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
32068         LDKu8slice ser_ref;
32069         ser_ref.datalen = ser->arr_len;
32070         ser_ref.data = ser->elems;
32071         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
32072         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
32073         FREE(ser);
32074         return tag_ptr(ret_conv, true);
32075 }
32076
32077 void  __attribute__((export_name("TS_MonitorEvent_free"))) TS_MonitorEvent_free(uint64_t this_ptr) {
32078         if (!ptr_is_owned(this_ptr)) return;
32079         void* this_ptr_ptr = untag_ptr(this_ptr);
32080         CHECK_ACCESS(this_ptr_ptr);
32081         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
32082         FREE(untag_ptr(this_ptr));
32083         MonitorEvent_free(this_ptr_conv);
32084 }
32085
32086 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
32087         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
32088         *ret_copy = MonitorEvent_clone(arg);
32089         uint64_t ret_ref = tag_ptr(ret_copy, true);
32090         return ret_ref;
32091 }
32092 int64_t  __attribute__((export_name("TS_MonitorEvent_clone_ptr"))) TS_MonitorEvent_clone_ptr(uint64_t arg) {
32093         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
32094         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
32095         return ret_conv;
32096 }
32097
32098 uint64_t  __attribute__((export_name("TS_MonitorEvent_clone"))) TS_MonitorEvent_clone(uint64_t orig) {
32099         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
32100         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
32101         *ret_copy = MonitorEvent_clone(orig_conv);
32102         uint64_t ret_ref = tag_ptr(ret_copy, true);
32103         return ret_ref;
32104 }
32105
32106 uint64_t  __attribute__((export_name("TS_MonitorEvent_htlcevent"))) TS_MonitorEvent_htlcevent(uint64_t a) {
32107         LDKHTLCUpdate a_conv;
32108         a_conv.inner = untag_ptr(a);
32109         a_conv.is_owned = ptr_is_owned(a);
32110         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32111         a_conv = HTLCUpdate_clone(&a_conv);
32112         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
32113         *ret_copy = MonitorEvent_htlcevent(a_conv);
32114         uint64_t ret_ref = tag_ptr(ret_copy, true);
32115         return ret_ref;
32116 }
32117
32118 uint64_t  __attribute__((export_name("TS_MonitorEvent_holder_force_closed"))) TS_MonitorEvent_holder_force_closed(uint64_t a) {
32119         LDKOutPoint a_conv;
32120         a_conv.inner = untag_ptr(a);
32121         a_conv.is_owned = ptr_is_owned(a);
32122         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32123         a_conv = OutPoint_clone(&a_conv);
32124         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
32125         *ret_copy = MonitorEvent_holder_force_closed(a_conv);
32126         uint64_t ret_ref = tag_ptr(ret_copy, true);
32127         return ret_ref;
32128 }
32129
32130 uint64_t  __attribute__((export_name("TS_MonitorEvent_completed"))) TS_MonitorEvent_completed(uint64_t funding_txo, int64_t monitor_update_id) {
32131         LDKOutPoint funding_txo_conv;
32132         funding_txo_conv.inner = untag_ptr(funding_txo);
32133         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
32134         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
32135         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
32136         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
32137         *ret_copy = MonitorEvent_completed(funding_txo_conv, monitor_update_id);
32138         uint64_t ret_ref = tag_ptr(ret_copy, true);
32139         return ret_ref;
32140 }
32141
32142 jboolean  __attribute__((export_name("TS_MonitorEvent_eq"))) TS_MonitorEvent_eq(uint64_t a, uint64_t b) {
32143         LDKMonitorEvent* a_conv = (LDKMonitorEvent*)untag_ptr(a);
32144         LDKMonitorEvent* b_conv = (LDKMonitorEvent*)untag_ptr(b);
32145         jboolean ret_conv = MonitorEvent_eq(a_conv, b_conv);
32146         return ret_conv;
32147 }
32148
32149 int8_tArray  __attribute__((export_name("TS_MonitorEvent_write"))) TS_MonitorEvent_write(uint64_t obj) {
32150         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
32151         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
32152         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32153         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32154         CVec_u8Z_free(ret_var);
32155         return ret_arr;
32156 }
32157
32158 uint64_t  __attribute__((export_name("TS_MonitorEvent_read"))) TS_MonitorEvent_read(int8_tArray ser) {
32159         LDKu8slice ser_ref;
32160         ser_ref.datalen = ser->arr_len;
32161         ser_ref.data = ser->elems;
32162         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
32163         *ret_conv = MonitorEvent_read(ser_ref);
32164         FREE(ser);
32165         return tag_ptr(ret_conv, true);
32166 }
32167
32168 void  __attribute__((export_name("TS_HTLCUpdate_free"))) TS_HTLCUpdate_free(uint64_t this_obj) {
32169         LDKHTLCUpdate this_obj_conv;
32170         this_obj_conv.inner = untag_ptr(this_obj);
32171         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32173         HTLCUpdate_free(this_obj_conv);
32174 }
32175
32176 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
32177         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
32178         uint64_t ret_ref = 0;
32179         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32180         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32181         return ret_ref;
32182 }
32183 int64_t  __attribute__((export_name("TS_HTLCUpdate_clone_ptr"))) TS_HTLCUpdate_clone_ptr(uint64_t arg) {
32184         LDKHTLCUpdate arg_conv;
32185         arg_conv.inner = untag_ptr(arg);
32186         arg_conv.is_owned = ptr_is_owned(arg);
32187         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32188         arg_conv.is_owned = false;
32189         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
32190         return ret_conv;
32191 }
32192
32193 uint64_t  __attribute__((export_name("TS_HTLCUpdate_clone"))) TS_HTLCUpdate_clone(uint64_t orig) {
32194         LDKHTLCUpdate orig_conv;
32195         orig_conv.inner = untag_ptr(orig);
32196         orig_conv.is_owned = ptr_is_owned(orig);
32197         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32198         orig_conv.is_owned = false;
32199         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
32200         uint64_t ret_ref = 0;
32201         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32202         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32203         return ret_ref;
32204 }
32205
32206 jboolean  __attribute__((export_name("TS_HTLCUpdate_eq"))) TS_HTLCUpdate_eq(uint64_t a, uint64_t b) {
32207         LDKHTLCUpdate a_conv;
32208         a_conv.inner = untag_ptr(a);
32209         a_conv.is_owned = ptr_is_owned(a);
32210         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32211         a_conv.is_owned = false;
32212         LDKHTLCUpdate b_conv;
32213         b_conv.inner = untag_ptr(b);
32214         b_conv.is_owned = ptr_is_owned(b);
32215         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32216         b_conv.is_owned = false;
32217         jboolean ret_conv = HTLCUpdate_eq(&a_conv, &b_conv);
32218         return ret_conv;
32219 }
32220
32221 int8_tArray  __attribute__((export_name("TS_HTLCUpdate_write"))) TS_HTLCUpdate_write(uint64_t obj) {
32222         LDKHTLCUpdate obj_conv;
32223         obj_conv.inner = untag_ptr(obj);
32224         obj_conv.is_owned = ptr_is_owned(obj);
32225         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32226         obj_conv.is_owned = false;
32227         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
32228         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32229         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32230         CVec_u8Z_free(ret_var);
32231         return ret_arr;
32232 }
32233
32234 uint64_t  __attribute__((export_name("TS_HTLCUpdate_read"))) TS_HTLCUpdate_read(int8_tArray ser) {
32235         LDKu8slice ser_ref;
32236         ser_ref.datalen = ser->arr_len;
32237         ser_ref.data = ser->elems;
32238         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
32239         *ret_conv = HTLCUpdate_read(ser_ref);
32240         FREE(ser);
32241         return tag_ptr(ret_conv, true);
32242 }
32243
32244 void  __attribute__((export_name("TS_Balance_free"))) TS_Balance_free(uint64_t this_ptr) {
32245         if (!ptr_is_owned(this_ptr)) return;
32246         void* this_ptr_ptr = untag_ptr(this_ptr);
32247         CHECK_ACCESS(this_ptr_ptr);
32248         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
32249         FREE(untag_ptr(this_ptr));
32250         Balance_free(this_ptr_conv);
32251 }
32252
32253 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
32254         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
32255         *ret_copy = Balance_clone(arg);
32256         uint64_t ret_ref = tag_ptr(ret_copy, true);
32257         return ret_ref;
32258 }
32259 int64_t  __attribute__((export_name("TS_Balance_clone_ptr"))) TS_Balance_clone_ptr(uint64_t arg) {
32260         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
32261         int64_t ret_conv = Balance_clone_ptr(arg_conv);
32262         return ret_conv;
32263 }
32264
32265 uint64_t  __attribute__((export_name("TS_Balance_clone"))) TS_Balance_clone(uint64_t orig) {
32266         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
32267         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
32268         *ret_copy = Balance_clone(orig_conv);
32269         uint64_t ret_ref = tag_ptr(ret_copy, true);
32270         return ret_ref;
32271 }
32272
32273 uint64_t  __attribute__((export_name("TS_Balance_claimable_on_channel_close"))) TS_Balance_claimable_on_channel_close(int64_t amount_satoshis) {
32274         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
32275         *ret_copy = Balance_claimable_on_channel_close(amount_satoshis);
32276         uint64_t ret_ref = tag_ptr(ret_copy, true);
32277         return ret_ref;
32278 }
32279
32280 uint64_t  __attribute__((export_name("TS_Balance_claimable_awaiting_confirmations"))) TS_Balance_claimable_awaiting_confirmations(int64_t amount_satoshis, int32_t confirmation_height) {
32281         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
32282         *ret_copy = Balance_claimable_awaiting_confirmations(amount_satoshis, confirmation_height);
32283         uint64_t ret_ref = tag_ptr(ret_copy, true);
32284         return ret_ref;
32285 }
32286
32287 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) {
32288         LDKThirtyTwoBytes payment_hash_ref;
32289         CHECK(payment_hash->arr_len == 32);
32290         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
32291         LDKThirtyTwoBytes payment_preimage_ref;
32292         CHECK(payment_preimage->arr_len == 32);
32293         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
32294         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
32295         *ret_copy = Balance_contentious_claimable(amount_satoshis, timeout_height, payment_hash_ref, payment_preimage_ref);
32296         uint64_t ret_ref = tag_ptr(ret_copy, true);
32297         return ret_ref;
32298 }
32299
32300 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) {
32301         LDKThirtyTwoBytes payment_hash_ref;
32302         CHECK(payment_hash->arr_len == 32);
32303         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
32304         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
32305         *ret_copy = Balance_maybe_timeout_claimable_htlc(amount_satoshis, claimable_height, payment_hash_ref);
32306         uint64_t ret_ref = tag_ptr(ret_copy, true);
32307         return ret_ref;
32308 }
32309
32310 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) {
32311         LDKThirtyTwoBytes payment_hash_ref;
32312         CHECK(payment_hash->arr_len == 32);
32313         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
32314         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
32315         *ret_copy = Balance_maybe_preimage_claimable_htlc(amount_satoshis, expiry_height, payment_hash_ref);
32316         uint64_t ret_ref = tag_ptr(ret_copy, true);
32317         return ret_ref;
32318 }
32319
32320 uint64_t  __attribute__((export_name("TS_Balance_counterparty_revoked_output_claimable"))) TS_Balance_counterparty_revoked_output_claimable(int64_t amount_satoshis) {
32321         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
32322         *ret_copy = Balance_counterparty_revoked_output_claimable(amount_satoshis);
32323         uint64_t ret_ref = tag_ptr(ret_copy, true);
32324         return ret_ref;
32325 }
32326
32327 jboolean  __attribute__((export_name("TS_Balance_eq"))) TS_Balance_eq(uint64_t a, uint64_t b) {
32328         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
32329         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
32330         jboolean ret_conv = Balance_eq(a_conv, b_conv);
32331         return ret_conv;
32332 }
32333
32334 int64_t  __attribute__((export_name("TS_Balance_claimable_amount_satoshis"))) TS_Balance_claimable_amount_satoshis(uint64_t this_arg) {
32335         LDKBalance* this_arg_conv = (LDKBalance*)untag_ptr(this_arg);
32336         int64_t ret_conv = Balance_claimable_amount_satoshis(this_arg_conv);
32337         return ret_conv;
32338 }
32339
32340 void  __attribute__((export_name("TS_ChannelMonitor_free"))) TS_ChannelMonitor_free(uint64_t this_obj) {
32341         LDKChannelMonitor this_obj_conv;
32342         this_obj_conv.inner = untag_ptr(this_obj);
32343         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32345         ChannelMonitor_free(this_obj_conv);
32346 }
32347
32348 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
32349         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
32350         uint64_t ret_ref = 0;
32351         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32352         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32353         return ret_ref;
32354 }
32355 int64_t  __attribute__((export_name("TS_ChannelMonitor_clone_ptr"))) TS_ChannelMonitor_clone_ptr(uint64_t arg) {
32356         LDKChannelMonitor arg_conv;
32357         arg_conv.inner = untag_ptr(arg);
32358         arg_conv.is_owned = ptr_is_owned(arg);
32359         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32360         arg_conv.is_owned = false;
32361         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
32362         return ret_conv;
32363 }
32364
32365 uint64_t  __attribute__((export_name("TS_ChannelMonitor_clone"))) TS_ChannelMonitor_clone(uint64_t orig) {
32366         LDKChannelMonitor orig_conv;
32367         orig_conv.inner = untag_ptr(orig);
32368         orig_conv.is_owned = ptr_is_owned(orig);
32369         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32370         orig_conv.is_owned = false;
32371         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
32372         uint64_t ret_ref = 0;
32373         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32374         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32375         return ret_ref;
32376 }
32377
32378 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_write"))) TS_ChannelMonitor_write(uint64_t obj) {
32379         LDKChannelMonitor obj_conv;
32380         obj_conv.inner = untag_ptr(obj);
32381         obj_conv.is_owned = ptr_is_owned(obj);
32382         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32383         obj_conv.is_owned = false;
32384         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
32385         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32386         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32387         CVec_u8Z_free(ret_var);
32388         return ret_arr;
32389 }
32390
32391 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) {
32392         LDKChannelMonitor this_arg_conv;
32393         this_arg_conv.inner = untag_ptr(this_arg);
32394         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32396         this_arg_conv.is_owned = false;
32397         LDKChannelMonitorUpdate updates_conv;
32398         updates_conv.inner = untag_ptr(updates);
32399         updates_conv.is_owned = ptr_is_owned(updates);
32400         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
32401         updates_conv.is_owned = false;
32402         void* broadcaster_ptr = untag_ptr(broadcaster);
32403         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
32404         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
32405         void* fee_estimator_ptr = untag_ptr(fee_estimator);
32406         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
32407         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
32408         void* logger_ptr = untag_ptr(logger);
32409         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
32410         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
32411         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
32412         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
32413         return tag_ptr(ret_conv, true);
32414 }
32415
32416 int64_t  __attribute__((export_name("TS_ChannelMonitor_get_latest_update_id"))) TS_ChannelMonitor_get_latest_update_id(uint64_t this_arg) {
32417         LDKChannelMonitor this_arg_conv;
32418         this_arg_conv.inner = untag_ptr(this_arg);
32419         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32421         this_arg_conv.is_owned = false;
32422         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
32423         return ret_conv;
32424 }
32425
32426 uint64_t  __attribute__((export_name("TS_ChannelMonitor_get_funding_txo"))) TS_ChannelMonitor_get_funding_txo(uint64_t this_arg) {
32427         LDKChannelMonitor this_arg_conv;
32428         this_arg_conv.inner = untag_ptr(this_arg);
32429         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32431         this_arg_conv.is_owned = false;
32432         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
32433         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
32434         return tag_ptr(ret_conv, true);
32435 }
32436
32437 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_outputs_to_watch"))) TS_ChannelMonitor_get_outputs_to_watch(uint64_t this_arg) {
32438         LDKChannelMonitor this_arg_conv;
32439         this_arg_conv.inner = untag_ptr(this_arg);
32440         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32442         this_arg_conv.is_owned = false;
32443         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
32444         uint64_tArray ret_arr = NULL;
32445         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32446         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32447         for (size_t a = 0; a < ret_var.datalen; a++) {
32448                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv_52_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
32449                 *ret_conv_52_conv = ret_var.data[a];
32450                 ret_arr_ptr[a] = tag_ptr(ret_conv_52_conv, true);
32451         }
32452         
32453         FREE(ret_var.data);
32454         return ret_arr;
32455 }
32456
32457 void  __attribute__((export_name("TS_ChannelMonitor_load_outputs_to_watch"))) TS_ChannelMonitor_load_outputs_to_watch(uint64_t this_arg, uint64_t filter) {
32458         LDKChannelMonitor this_arg_conv;
32459         this_arg_conv.inner = untag_ptr(this_arg);
32460         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32462         this_arg_conv.is_owned = false;
32463         void* filter_ptr = untag_ptr(filter);
32464         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
32465         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
32466         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
32467 }
32468
32469 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) {
32470         LDKChannelMonitor this_arg_conv;
32471         this_arg_conv.inner = untag_ptr(this_arg);
32472         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32474         this_arg_conv.is_owned = false;
32475         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
32476         uint64_tArray ret_arr = NULL;
32477         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32478         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32479         for (size_t o = 0; o < ret_var.datalen; o++) {
32480                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
32481                 *ret_conv_14_copy = ret_var.data[o];
32482                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
32483                 ret_arr_ptr[o] = ret_conv_14_ref;
32484         }
32485         
32486         FREE(ret_var.data);
32487         return ret_arr;
32488 }
32489
32490 void  __attribute__((export_name("TS_ChannelMonitor_process_pending_events"))) TS_ChannelMonitor_process_pending_events(uint64_t this_arg, uint64_t handler) {
32491         LDKChannelMonitor this_arg_conv;
32492         this_arg_conv.inner = untag_ptr(this_arg);
32493         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32495         this_arg_conv.is_owned = false;
32496         void* handler_ptr = untag_ptr(handler);
32497         if (ptr_is_owned(handler)) { CHECK_ACCESS(handler_ptr); }
32498         LDKEventHandler* handler_conv = (LDKEventHandler*)handler_ptr;
32499         ChannelMonitor_process_pending_events(&this_arg_conv, handler_conv);
32500 }
32501
32502 uint64_t  __attribute__((export_name("TS_ChannelMonitor_initial_counterparty_commitment_tx"))) TS_ChannelMonitor_initial_counterparty_commitment_tx(uint64_t this_arg) {
32503         LDKChannelMonitor this_arg_conv;
32504         this_arg_conv.inner = untag_ptr(this_arg);
32505         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32507         this_arg_conv.is_owned = false;
32508         LDKCommitmentTransaction ret_var = ChannelMonitor_initial_counterparty_commitment_tx(&this_arg_conv);
32509         uint64_t ret_ref = 0;
32510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32512         return ret_ref;
32513 }
32514
32515 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) {
32516         LDKChannelMonitor this_arg_conv;
32517         this_arg_conv.inner = untag_ptr(this_arg);
32518         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32520         this_arg_conv.is_owned = false;
32521         LDKChannelMonitorUpdate update_conv;
32522         update_conv.inner = untag_ptr(update);
32523         update_conv.is_owned = ptr_is_owned(update);
32524         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
32525         update_conv.is_owned = false;
32526         LDKCVec_CommitmentTransactionZ ret_var = ChannelMonitor_counterparty_commitment_txs_from_update(&this_arg_conv, &update_conv);
32527         uint64_tArray ret_arr = NULL;
32528         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32529         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32530         for (size_t x = 0; x < ret_var.datalen; x++) {
32531                 LDKCommitmentTransaction ret_conv_23_var = ret_var.data[x];
32532                 uint64_t ret_conv_23_ref = 0;
32533                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_23_var);
32534                 ret_conv_23_ref = tag_ptr(ret_conv_23_var.inner, ret_conv_23_var.is_owned);
32535                 ret_arr_ptr[x] = ret_conv_23_ref;
32536         }
32537         
32538         FREE(ret_var.data);
32539         return ret_arr;
32540 }
32541
32542 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) {
32543         LDKChannelMonitor this_arg_conv;
32544         this_arg_conv.inner = untag_ptr(this_arg);
32545         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32547         this_arg_conv.is_owned = false;
32548         LDKTransaction justice_tx_ref;
32549         justice_tx_ref.datalen = justice_tx->arr_len;
32550         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
32551         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
32552         justice_tx_ref.data_is_owned = true;
32553         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
32554         *ret_conv = ChannelMonitor_sign_to_local_justice_tx(&this_arg_conv, justice_tx_ref, input_idx, value, commitment_number);
32555         return tag_ptr(ret_conv, true);
32556 }
32557
32558 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_get_counterparty_node_id"))) TS_ChannelMonitor_get_counterparty_node_id(uint64_t this_arg) {
32559         LDKChannelMonitor this_arg_conv;
32560         this_arg_conv.inner = untag_ptr(this_arg);
32561         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32563         this_arg_conv.is_owned = false;
32564         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32565         memcpy(ret_arr->elems, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form, 33);
32566         return ret_arr;
32567 }
32568
32569 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) {
32570         LDKChannelMonitor this_arg_conv;
32571         this_arg_conv.inner = untag_ptr(this_arg);
32572         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32574         this_arg_conv.is_owned = false;
32575         void* logger_ptr = untag_ptr(logger);
32576         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
32577         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
32578         LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
32579         ptrArray ret_arr = NULL;
32580         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
32581         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
32582         for (size_t m = 0; m < ret_var.datalen; m++) {
32583                 LDKTransaction ret_conv_12_var = ret_var.data[m];
32584                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
32585                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
32586                 Transaction_free(ret_conv_12_var);
32587                 ret_arr_ptr[m] = ret_conv_12_arr;
32588         }
32589         
32590         FREE(ret_var.data);
32591         return ret_arr;
32592 }
32593
32594 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) {
32595         LDKChannelMonitor this_arg_conv;
32596         this_arg_conv.inner = untag_ptr(this_arg);
32597         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32599         this_arg_conv.is_owned = false;
32600         uint8_t header_arr[80];
32601         CHECK(header->arr_len == 80);
32602         memcpy(header_arr, header->elems, 80); FREE(header);
32603         uint8_t (*header_ref)[80] = &header_arr;
32604         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
32605         txdata_constr.datalen = txdata->arr_len;
32606         if (txdata_constr.datalen > 0)
32607                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
32608         else
32609                 txdata_constr.data = NULL;
32610         uint64_t* txdata_vals = txdata->elems;
32611         for (size_t c = 0; c < txdata_constr.datalen; c++) {
32612                 uint64_t txdata_conv_28 = txdata_vals[c];
32613                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
32614                 CHECK_ACCESS(txdata_conv_28_ptr);
32615                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
32616                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
32617                 txdata_constr.data[c] = txdata_conv_28_conv;
32618         }
32619         FREE(txdata);
32620         void* broadcaster_ptr = untag_ptr(broadcaster);
32621         CHECK_ACCESS(broadcaster_ptr);
32622         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
32623         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
32624                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32625                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
32626         }
32627         void* fee_estimator_ptr = untag_ptr(fee_estimator);
32628         CHECK_ACCESS(fee_estimator_ptr);
32629         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
32630         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
32631                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32632                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
32633         }
32634         void* logger_ptr = untag_ptr(logger);
32635         CHECK_ACCESS(logger_ptr);
32636         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
32637         if (logger_conv.free == LDKLogger_JCalls_free) {
32638                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32639                 LDKLogger_JCalls_cloned(&logger_conv);
32640         }
32641         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);
32642         uint64_tArray ret_arr = NULL;
32643         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32644         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32645         for (size_t x = 0; x < ret_var.datalen; x++) {
32646                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
32647                 *ret_conv_49_conv = ret_var.data[x];
32648                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
32649         }
32650         
32651         FREE(ret_var.data);
32652         return ret_arr;
32653 }
32654
32655 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) {
32656         LDKChannelMonitor this_arg_conv;
32657         this_arg_conv.inner = untag_ptr(this_arg);
32658         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32660         this_arg_conv.is_owned = false;
32661         uint8_t header_arr[80];
32662         CHECK(header->arr_len == 80);
32663         memcpy(header_arr, header->elems, 80); FREE(header);
32664         uint8_t (*header_ref)[80] = &header_arr;
32665         void* broadcaster_ptr = untag_ptr(broadcaster);
32666         CHECK_ACCESS(broadcaster_ptr);
32667         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
32668         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
32669                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32670                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
32671         }
32672         void* fee_estimator_ptr = untag_ptr(fee_estimator);
32673         CHECK_ACCESS(fee_estimator_ptr);
32674         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
32675         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
32676                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32677                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
32678         }
32679         void* logger_ptr = untag_ptr(logger);
32680         CHECK_ACCESS(logger_ptr);
32681         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
32682         if (logger_conv.free == LDKLogger_JCalls_free) {
32683                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32684                 LDKLogger_JCalls_cloned(&logger_conv);
32685         }
32686         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
32687 }
32688
32689 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) {
32690         LDKChannelMonitor this_arg_conv;
32691         this_arg_conv.inner = untag_ptr(this_arg);
32692         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32694         this_arg_conv.is_owned = false;
32695         uint8_t header_arr[80];
32696         CHECK(header->arr_len == 80);
32697         memcpy(header_arr, header->elems, 80); FREE(header);
32698         uint8_t (*header_ref)[80] = &header_arr;
32699         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
32700         txdata_constr.datalen = txdata->arr_len;
32701         if (txdata_constr.datalen > 0)
32702                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
32703         else
32704                 txdata_constr.data = NULL;
32705         uint64_t* txdata_vals = txdata->elems;
32706         for (size_t c = 0; c < txdata_constr.datalen; c++) {
32707                 uint64_t txdata_conv_28 = txdata_vals[c];
32708                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
32709                 CHECK_ACCESS(txdata_conv_28_ptr);
32710                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
32711                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
32712                 txdata_constr.data[c] = txdata_conv_28_conv;
32713         }
32714         FREE(txdata);
32715         void* broadcaster_ptr = untag_ptr(broadcaster);
32716         CHECK_ACCESS(broadcaster_ptr);
32717         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
32718         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
32719                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32720                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
32721         }
32722         void* fee_estimator_ptr = untag_ptr(fee_estimator);
32723         CHECK_ACCESS(fee_estimator_ptr);
32724         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
32725         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
32726                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32727                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
32728         }
32729         void* logger_ptr = untag_ptr(logger);
32730         CHECK_ACCESS(logger_ptr);
32731         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
32732         if (logger_conv.free == LDKLogger_JCalls_free) {
32733                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32734                 LDKLogger_JCalls_cloned(&logger_conv);
32735         }
32736         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);
32737         uint64_tArray ret_arr = NULL;
32738         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32739         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32740         for (size_t x = 0; x < ret_var.datalen; x++) {
32741                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
32742                 *ret_conv_49_conv = ret_var.data[x];
32743                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
32744         }
32745         
32746         FREE(ret_var.data);
32747         return ret_arr;
32748 }
32749
32750 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) {
32751         LDKChannelMonitor this_arg_conv;
32752         this_arg_conv.inner = untag_ptr(this_arg);
32753         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32755         this_arg_conv.is_owned = false;
32756         uint8_t txid_arr[32];
32757         CHECK(txid->arr_len == 32);
32758         memcpy(txid_arr, txid->elems, 32); FREE(txid);
32759         uint8_t (*txid_ref)[32] = &txid_arr;
32760         void* broadcaster_ptr = untag_ptr(broadcaster);
32761         CHECK_ACCESS(broadcaster_ptr);
32762         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
32763         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
32764                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32765                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
32766         }
32767         void* fee_estimator_ptr = untag_ptr(fee_estimator);
32768         CHECK_ACCESS(fee_estimator_ptr);
32769         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
32770         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
32771                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32772                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
32773         }
32774         void* logger_ptr = untag_ptr(logger);
32775         CHECK_ACCESS(logger_ptr);
32776         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
32777         if (logger_conv.free == LDKLogger_JCalls_free) {
32778                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32779                 LDKLogger_JCalls_cloned(&logger_conv);
32780         }
32781         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
32782 }
32783
32784 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) {
32785         LDKChannelMonitor this_arg_conv;
32786         this_arg_conv.inner = untag_ptr(this_arg);
32787         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32789         this_arg_conv.is_owned = false;
32790         uint8_t header_arr[80];
32791         CHECK(header->arr_len == 80);
32792         memcpy(header_arr, header->elems, 80); FREE(header);
32793         uint8_t (*header_ref)[80] = &header_arr;
32794         void* broadcaster_ptr = untag_ptr(broadcaster);
32795         CHECK_ACCESS(broadcaster_ptr);
32796         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
32797         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
32798                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32799                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
32800         }
32801         void* fee_estimator_ptr = untag_ptr(fee_estimator);
32802         CHECK_ACCESS(fee_estimator_ptr);
32803         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
32804         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
32805                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32806                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
32807         }
32808         void* logger_ptr = untag_ptr(logger);
32809         CHECK_ACCESS(logger_ptr);
32810         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
32811         if (logger_conv.free == LDKLogger_JCalls_free) {
32812                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32813                 LDKLogger_JCalls_cloned(&logger_conv);
32814         }
32815         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
32816         uint64_tArray ret_arr = NULL;
32817         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32818         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32819         for (size_t x = 0; x < ret_var.datalen; x++) {
32820                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
32821                 *ret_conv_49_conv = ret_var.data[x];
32822                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
32823         }
32824         
32825         FREE(ret_var.data);
32826         return ret_arr;
32827 }
32828
32829 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_relevant_txids"))) TS_ChannelMonitor_get_relevant_txids(uint64_t this_arg) {
32830         LDKChannelMonitor this_arg_conv;
32831         this_arg_conv.inner = untag_ptr(this_arg);
32832         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32834         this_arg_conv.is_owned = false;
32835         LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
32836         uint64_tArray ret_arr = NULL;
32837         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32838         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32839         for (size_t x = 0; x < ret_var.datalen; x++) {
32840                 LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ");
32841                 *ret_conv_49_conv = ret_var.data[x];
32842                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
32843         }
32844         
32845         FREE(ret_var.data);
32846         return ret_arr;
32847 }
32848
32849 uint64_t  __attribute__((export_name("TS_ChannelMonitor_current_best_block"))) TS_ChannelMonitor_current_best_block(uint64_t this_arg) {
32850         LDKChannelMonitor this_arg_conv;
32851         this_arg_conv.inner = untag_ptr(this_arg);
32852         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32854         this_arg_conv.is_owned = false;
32855         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
32856         uint64_t ret_ref = 0;
32857         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32858         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32859         return ret_ref;
32860 }
32861
32862 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) {
32863         LDKChannelMonitor this_arg_conv;
32864         this_arg_conv.inner = untag_ptr(this_arg);
32865         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32867         this_arg_conv.is_owned = false;
32868         void* broadcaster_ptr = untag_ptr(broadcaster);
32869         CHECK_ACCESS(broadcaster_ptr);
32870         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
32871         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
32872                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32873                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
32874         }
32875         void* fee_estimator_ptr = untag_ptr(fee_estimator);
32876         CHECK_ACCESS(fee_estimator_ptr);
32877         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
32878         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
32879                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32880                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
32881         }
32882         void* logger_ptr = untag_ptr(logger);
32883         CHECK_ACCESS(logger_ptr);
32884         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
32885         if (logger_conv.free == LDKLogger_JCalls_free) {
32886                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32887                 LDKLogger_JCalls_cloned(&logger_conv);
32888         }
32889         ChannelMonitor_rebroadcast_pending_claims(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
32890 }
32891
32892 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) {
32893         LDKChannelMonitor this_arg_conv;
32894         this_arg_conv.inner = untag_ptr(this_arg);
32895         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32897         this_arg_conv.is_owned = false;
32898         LDKTransaction tx_ref;
32899         tx_ref.datalen = tx->arr_len;
32900         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
32901         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
32902         tx_ref.data_is_owned = true;
32903         LDKCVec_SpendableOutputDescriptorZ ret_var = ChannelMonitor_get_spendable_outputs(&this_arg_conv, tx_ref, confirmation_height);
32904         uint64_tArray ret_arr = NULL;
32905         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32906         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32907         for (size_t b = 0; b < ret_var.datalen; b++) {
32908                 LDKSpendableOutputDescriptor *ret_conv_27_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
32909                 *ret_conv_27_copy = ret_var.data[b];
32910                 uint64_t ret_conv_27_ref = tag_ptr(ret_conv_27_copy, true);
32911                 ret_arr_ptr[b] = ret_conv_27_ref;
32912         }
32913         
32914         FREE(ret_var.data);
32915         return ret_arr;
32916 }
32917
32918 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_claimable_balances"))) TS_ChannelMonitor_get_claimable_balances(uint64_t this_arg) {
32919         LDKChannelMonitor this_arg_conv;
32920         this_arg_conv.inner = untag_ptr(this_arg);
32921         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32923         this_arg_conv.is_owned = false;
32924         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
32925         uint64_tArray ret_arr = NULL;
32926         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32927         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32928         for (size_t j = 0; j < ret_var.datalen; j++) {
32929                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
32930                 *ret_conv_9_copy = ret_var.data[j];
32931                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
32932                 ret_arr_ptr[j] = ret_conv_9_ref;
32933         }
32934         
32935         FREE(ret_var.data);
32936         return ret_arr;
32937 }
32938
32939 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_read"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(int8_tArray ser, uint64_t arg_a, uint64_t arg_b) {
32940         LDKu8slice ser_ref;
32941         ser_ref.datalen = ser->arr_len;
32942         ser_ref.data = ser->elems;
32943         void* arg_a_ptr = untag_ptr(arg_a);
32944         if (ptr_is_owned(arg_a)) { CHECK_ACCESS(arg_a_ptr); }
32945         LDKEntropySource* arg_a_conv = (LDKEntropySource*)arg_a_ptr;
32946         void* arg_b_ptr = untag_ptr(arg_b);
32947         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
32948         LDKSignerProvider* arg_b_conv = (LDKSignerProvider*)arg_b_ptr;
32949         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
32950         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(ser_ref, arg_a_conv, arg_b_conv);
32951         FREE(ser);
32952         return tag_ptr(ret_conv, true);
32953 }
32954
32955 void  __attribute__((export_name("TS_OutPoint_free"))) TS_OutPoint_free(uint64_t this_obj) {
32956         LDKOutPoint this_obj_conv;
32957         this_obj_conv.inner = untag_ptr(this_obj);
32958         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32960         OutPoint_free(this_obj_conv);
32961 }
32962
32963 int8_tArray  __attribute__((export_name("TS_OutPoint_get_txid"))) TS_OutPoint_get_txid(uint64_t this_ptr) {
32964         LDKOutPoint this_ptr_conv;
32965         this_ptr_conv.inner = untag_ptr(this_ptr);
32966         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32968         this_ptr_conv.is_owned = false;
32969         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32970         memcpy(ret_arr->elems, *OutPoint_get_txid(&this_ptr_conv), 32);
32971         return ret_arr;
32972 }
32973
32974 void  __attribute__((export_name("TS_OutPoint_set_txid"))) TS_OutPoint_set_txid(uint64_t this_ptr, int8_tArray val) {
32975         LDKOutPoint this_ptr_conv;
32976         this_ptr_conv.inner = untag_ptr(this_ptr);
32977         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32979         this_ptr_conv.is_owned = false;
32980         LDKThirtyTwoBytes val_ref;
32981         CHECK(val->arr_len == 32);
32982         memcpy(val_ref.data, val->elems, 32); FREE(val);
32983         OutPoint_set_txid(&this_ptr_conv, val_ref);
32984 }
32985
32986 int16_t  __attribute__((export_name("TS_OutPoint_get_index"))) TS_OutPoint_get_index(uint64_t this_ptr) {
32987         LDKOutPoint this_ptr_conv;
32988         this_ptr_conv.inner = untag_ptr(this_ptr);
32989         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32991         this_ptr_conv.is_owned = false;
32992         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
32993         return ret_conv;
32994 }
32995
32996 void  __attribute__((export_name("TS_OutPoint_set_index"))) TS_OutPoint_set_index(uint64_t this_ptr, int16_t val) {
32997         LDKOutPoint this_ptr_conv;
32998         this_ptr_conv.inner = untag_ptr(this_ptr);
32999         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33001         this_ptr_conv.is_owned = false;
33002         OutPoint_set_index(&this_ptr_conv, val);
33003 }
33004
33005 uint64_t  __attribute__((export_name("TS_OutPoint_new"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
33006         LDKThirtyTwoBytes txid_arg_ref;
33007         CHECK(txid_arg->arr_len == 32);
33008         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
33009         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
33010         uint64_t ret_ref = 0;
33011         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33012         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33013         return ret_ref;
33014 }
33015
33016 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
33017         LDKOutPoint ret_var = OutPoint_clone(arg);
33018         uint64_t ret_ref = 0;
33019         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33020         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33021         return ret_ref;
33022 }
33023 int64_t  __attribute__((export_name("TS_OutPoint_clone_ptr"))) TS_OutPoint_clone_ptr(uint64_t arg) {
33024         LDKOutPoint arg_conv;
33025         arg_conv.inner = untag_ptr(arg);
33026         arg_conv.is_owned = ptr_is_owned(arg);
33027         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33028         arg_conv.is_owned = false;
33029         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
33030         return ret_conv;
33031 }
33032
33033 uint64_t  __attribute__((export_name("TS_OutPoint_clone"))) TS_OutPoint_clone(uint64_t orig) {
33034         LDKOutPoint orig_conv;
33035         orig_conv.inner = untag_ptr(orig);
33036         orig_conv.is_owned = ptr_is_owned(orig);
33037         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33038         orig_conv.is_owned = false;
33039         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
33040         uint64_t ret_ref = 0;
33041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33043         return ret_ref;
33044 }
33045
33046 jboolean  __attribute__((export_name("TS_OutPoint_eq"))) TS_OutPoint_eq(uint64_t a, uint64_t b) {
33047         LDKOutPoint a_conv;
33048         a_conv.inner = untag_ptr(a);
33049         a_conv.is_owned = ptr_is_owned(a);
33050         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33051         a_conv.is_owned = false;
33052         LDKOutPoint b_conv;
33053         b_conv.inner = untag_ptr(b);
33054         b_conv.is_owned = ptr_is_owned(b);
33055         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33056         b_conv.is_owned = false;
33057         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
33058         return ret_conv;
33059 }
33060
33061 int64_t  __attribute__((export_name("TS_OutPoint_hash"))) TS_OutPoint_hash(uint64_t o) {
33062         LDKOutPoint o_conv;
33063         o_conv.inner = untag_ptr(o);
33064         o_conv.is_owned = ptr_is_owned(o);
33065         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33066         o_conv.is_owned = false;
33067         int64_t ret_conv = OutPoint_hash(&o_conv);
33068         return ret_conv;
33069 }
33070
33071 int8_tArray  __attribute__((export_name("TS_OutPoint_to_channel_id"))) TS_OutPoint_to_channel_id(uint64_t this_arg) {
33072         LDKOutPoint this_arg_conv;
33073         this_arg_conv.inner = untag_ptr(this_arg);
33074         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33076         this_arg_conv.is_owned = false;
33077         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33078         memcpy(ret_arr->elems, OutPoint_to_channel_id(&this_arg_conv).data, 32);
33079         return ret_arr;
33080 }
33081
33082 int8_tArray  __attribute__((export_name("TS_OutPoint_write"))) TS_OutPoint_write(uint64_t obj) {
33083         LDKOutPoint obj_conv;
33084         obj_conv.inner = untag_ptr(obj);
33085         obj_conv.is_owned = ptr_is_owned(obj);
33086         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33087         obj_conv.is_owned = false;
33088         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
33089         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33090         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33091         CVec_u8Z_free(ret_var);
33092         return ret_arr;
33093 }
33094
33095 uint64_t  __attribute__((export_name("TS_OutPoint_read"))) TS_OutPoint_read(int8_tArray ser) {
33096         LDKu8slice ser_ref;
33097         ser_ref.datalen = ser->arr_len;
33098         ser_ref.data = ser->elems;
33099         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
33100         *ret_conv = OutPoint_read(ser_ref);
33101         FREE(ser);
33102         return tag_ptr(ret_conv, true);
33103 }
33104
33105 void  __attribute__((export_name("TS_FailureCode_free"))) TS_FailureCode_free(uint64_t this_ptr) {
33106         if (!ptr_is_owned(this_ptr)) return;
33107         void* this_ptr_ptr = untag_ptr(this_ptr);
33108         CHECK_ACCESS(this_ptr_ptr);
33109         LDKFailureCode this_ptr_conv = *(LDKFailureCode*)(this_ptr_ptr);
33110         FREE(untag_ptr(this_ptr));
33111         FailureCode_free(this_ptr_conv);
33112 }
33113
33114 static inline uint64_t FailureCode_clone_ptr(LDKFailureCode *NONNULL_PTR arg) {
33115         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
33116         *ret_copy = FailureCode_clone(arg);
33117         uint64_t ret_ref = tag_ptr(ret_copy, true);
33118         return ret_ref;
33119 }
33120 int64_t  __attribute__((export_name("TS_FailureCode_clone_ptr"))) TS_FailureCode_clone_ptr(uint64_t arg) {
33121         LDKFailureCode* arg_conv = (LDKFailureCode*)untag_ptr(arg);
33122         int64_t ret_conv = FailureCode_clone_ptr(arg_conv);
33123         return ret_conv;
33124 }
33125
33126 uint64_t  __attribute__((export_name("TS_FailureCode_clone"))) TS_FailureCode_clone(uint64_t orig) {
33127         LDKFailureCode* orig_conv = (LDKFailureCode*)untag_ptr(orig);
33128         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
33129         *ret_copy = FailureCode_clone(orig_conv);
33130         uint64_t ret_ref = tag_ptr(ret_copy, true);
33131         return ret_ref;
33132 }
33133
33134 uint64_t  __attribute__((export_name("TS_FailureCode_temporary_node_failure"))) TS_FailureCode_temporary_node_failure() {
33135         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
33136         *ret_copy = FailureCode_temporary_node_failure();
33137         uint64_t ret_ref = tag_ptr(ret_copy, true);
33138         return ret_ref;
33139 }
33140
33141 uint64_t  __attribute__((export_name("TS_FailureCode_required_node_feature_missing"))) TS_FailureCode_required_node_feature_missing() {
33142         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
33143         *ret_copy = FailureCode_required_node_feature_missing();
33144         uint64_t ret_ref = tag_ptr(ret_copy, true);
33145         return ret_ref;
33146 }
33147
33148 uint64_t  __attribute__((export_name("TS_FailureCode_incorrect_or_unknown_payment_details"))) TS_FailureCode_incorrect_or_unknown_payment_details() {
33149         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
33150         *ret_copy = FailureCode_incorrect_or_unknown_payment_details();
33151         uint64_t ret_ref = tag_ptr(ret_copy, true);
33152         return ret_ref;
33153 }
33154
33155 uint64_t  __attribute__((export_name("TS_FailureCode_invalid_onion_payload"))) TS_FailureCode_invalid_onion_payload(uint64_t a) {
33156         void* a_ptr = untag_ptr(a);
33157         CHECK_ACCESS(a_ptr);
33158         LDKCOption_C2Tuple_u64u16ZZ a_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(a_ptr);
33159         a_conv = COption_C2Tuple_u64u16ZZ_clone((LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(a));
33160         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
33161         *ret_copy = FailureCode_invalid_onion_payload(a_conv);
33162         uint64_t ret_ref = tag_ptr(ret_copy, true);
33163         return ret_ref;
33164 }
33165
33166 void  __attribute__((export_name("TS_ChannelManager_free"))) TS_ChannelManager_free(uint64_t this_obj) {
33167         LDKChannelManager this_obj_conv;
33168         this_obj_conv.inner = untag_ptr(this_obj);
33169         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33171         ChannelManager_free(this_obj_conv);
33172 }
33173
33174 void  __attribute__((export_name("TS_ChainParameters_free"))) TS_ChainParameters_free(uint64_t this_obj) {
33175         LDKChainParameters this_obj_conv;
33176         this_obj_conv.inner = untag_ptr(this_obj);
33177         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33179         ChainParameters_free(this_obj_conv);
33180 }
33181
33182 uint32_t  __attribute__((export_name("TS_ChainParameters_get_network"))) TS_ChainParameters_get_network(uint64_t this_ptr) {
33183         LDKChainParameters this_ptr_conv;
33184         this_ptr_conv.inner = untag_ptr(this_ptr);
33185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33187         this_ptr_conv.is_owned = false;
33188         uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
33189         return ret_conv;
33190 }
33191
33192 void  __attribute__((export_name("TS_ChainParameters_set_network"))) TS_ChainParameters_set_network(uint64_t this_ptr, uint32_t val) {
33193         LDKChainParameters this_ptr_conv;
33194         this_ptr_conv.inner = untag_ptr(this_ptr);
33195         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33197         this_ptr_conv.is_owned = false;
33198         LDKNetwork val_conv = LDKNetwork_from_js(val);
33199         ChainParameters_set_network(&this_ptr_conv, val_conv);
33200 }
33201
33202 uint64_t  __attribute__((export_name("TS_ChainParameters_get_best_block"))) TS_ChainParameters_get_best_block(uint64_t this_ptr) {
33203         LDKChainParameters this_ptr_conv;
33204         this_ptr_conv.inner = untag_ptr(this_ptr);
33205         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33207         this_ptr_conv.is_owned = false;
33208         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
33209         uint64_t ret_ref = 0;
33210         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33211         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33212         return ret_ref;
33213 }
33214
33215 void  __attribute__((export_name("TS_ChainParameters_set_best_block"))) TS_ChainParameters_set_best_block(uint64_t this_ptr, uint64_t val) {
33216         LDKChainParameters this_ptr_conv;
33217         this_ptr_conv.inner = untag_ptr(this_ptr);
33218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33220         this_ptr_conv.is_owned = false;
33221         LDKBestBlock val_conv;
33222         val_conv.inner = untag_ptr(val);
33223         val_conv.is_owned = ptr_is_owned(val);
33224         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33225         val_conv = BestBlock_clone(&val_conv);
33226         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
33227 }
33228
33229 uint64_t  __attribute__((export_name("TS_ChainParameters_new"))) TS_ChainParameters_new(uint32_t network_arg, uint64_t best_block_arg) {
33230         LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
33231         LDKBestBlock best_block_arg_conv;
33232         best_block_arg_conv.inner = untag_ptr(best_block_arg);
33233         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
33234         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
33235         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
33236         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
33237         uint64_t ret_ref = 0;
33238         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33239         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33240         return ret_ref;
33241 }
33242
33243 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
33244         LDKChainParameters ret_var = ChainParameters_clone(arg);
33245         uint64_t ret_ref = 0;
33246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33248         return ret_ref;
33249 }
33250 int64_t  __attribute__((export_name("TS_ChainParameters_clone_ptr"))) TS_ChainParameters_clone_ptr(uint64_t arg) {
33251         LDKChainParameters arg_conv;
33252         arg_conv.inner = untag_ptr(arg);
33253         arg_conv.is_owned = ptr_is_owned(arg);
33254         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33255         arg_conv.is_owned = false;
33256         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
33257         return ret_conv;
33258 }
33259
33260 uint64_t  __attribute__((export_name("TS_ChainParameters_clone"))) TS_ChainParameters_clone(uint64_t orig) {
33261         LDKChainParameters orig_conv;
33262         orig_conv.inner = untag_ptr(orig);
33263         orig_conv.is_owned = ptr_is_owned(orig);
33264         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33265         orig_conv.is_owned = false;
33266         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
33267         uint64_t ret_ref = 0;
33268         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33269         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33270         return ret_ref;
33271 }
33272
33273 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_free"))) TS_CounterpartyForwardingInfo_free(uint64_t this_obj) {
33274         LDKCounterpartyForwardingInfo this_obj_conv;
33275         this_obj_conv.inner = untag_ptr(this_obj);
33276         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33278         CounterpartyForwardingInfo_free(this_obj_conv);
33279 }
33280
33281 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_base_msat"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint64_t this_ptr) {
33282         LDKCounterpartyForwardingInfo this_ptr_conv;
33283         this_ptr_conv.inner = untag_ptr(this_ptr);
33284         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33286         this_ptr_conv.is_owned = false;
33287         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
33288         return ret_conv;
33289 }
33290
33291 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_base_msat"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
33292         LDKCounterpartyForwardingInfo this_ptr_conv;
33293         this_ptr_conv.inner = untag_ptr(this_ptr);
33294         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33296         this_ptr_conv.is_owned = false;
33297         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
33298 }
33299
33300 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint64_t this_ptr) {
33301         LDKCounterpartyForwardingInfo this_ptr_conv;
33302         this_ptr_conv.inner = untag_ptr(this_ptr);
33303         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33305         this_ptr_conv.is_owned = false;
33306         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
33307         return ret_conv;
33308 }
33309
33310 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
33311         LDKCounterpartyForwardingInfo this_ptr_conv;
33312         this_ptr_conv.inner = untag_ptr(this_ptr);
33313         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33315         this_ptr_conv.is_owned = false;
33316         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
33317 }
33318
33319 int16_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
33320         LDKCounterpartyForwardingInfo this_ptr_conv;
33321         this_ptr_conv.inner = untag_ptr(this_ptr);
33322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33324         this_ptr_conv.is_owned = false;
33325         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
33326         return ret_conv;
33327 }
33328
33329 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
33330         LDKCounterpartyForwardingInfo this_ptr_conv;
33331         this_ptr_conv.inner = untag_ptr(this_ptr);
33332         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33334         this_ptr_conv.is_owned = false;
33335         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
33336 }
33337
33338 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) {
33339         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
33340         uint64_t ret_ref = 0;
33341         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33342         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33343         return ret_ref;
33344 }
33345
33346 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
33347         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
33348         uint64_t ret_ref = 0;
33349         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33350         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33351         return ret_ref;
33352 }
33353 int64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone_ptr"))) TS_CounterpartyForwardingInfo_clone_ptr(uint64_t arg) {
33354         LDKCounterpartyForwardingInfo arg_conv;
33355         arg_conv.inner = untag_ptr(arg);
33356         arg_conv.is_owned = ptr_is_owned(arg);
33357         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33358         arg_conv.is_owned = false;
33359         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
33360         return ret_conv;
33361 }
33362
33363 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone"))) TS_CounterpartyForwardingInfo_clone(uint64_t orig) {
33364         LDKCounterpartyForwardingInfo orig_conv;
33365         orig_conv.inner = untag_ptr(orig);
33366         orig_conv.is_owned = ptr_is_owned(orig);
33367         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33368         orig_conv.is_owned = false;
33369         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
33370         uint64_t ret_ref = 0;
33371         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33372         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33373         return ret_ref;
33374 }
33375
33376 void  __attribute__((export_name("TS_ChannelCounterparty_free"))) TS_ChannelCounterparty_free(uint64_t this_obj) {
33377         LDKChannelCounterparty this_obj_conv;
33378         this_obj_conv.inner = untag_ptr(this_obj);
33379         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33381         ChannelCounterparty_free(this_obj_conv);
33382 }
33383
33384 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_get_node_id"))) TS_ChannelCounterparty_get_node_id(uint64_t this_ptr) {
33385         LDKChannelCounterparty this_ptr_conv;
33386         this_ptr_conv.inner = untag_ptr(this_ptr);
33387         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33389         this_ptr_conv.is_owned = false;
33390         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33391         memcpy(ret_arr->elems, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
33392         return ret_arr;
33393 }
33394
33395 void  __attribute__((export_name("TS_ChannelCounterparty_set_node_id"))) TS_ChannelCounterparty_set_node_id(uint64_t this_ptr, int8_tArray val) {
33396         LDKChannelCounterparty this_ptr_conv;
33397         this_ptr_conv.inner = untag_ptr(this_ptr);
33398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33400         this_ptr_conv.is_owned = false;
33401         LDKPublicKey val_ref;
33402         CHECK(val->arr_len == 33);
33403         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33404         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
33405 }
33406
33407 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_features"))) TS_ChannelCounterparty_get_features(uint64_t this_ptr) {
33408         LDKChannelCounterparty this_ptr_conv;
33409         this_ptr_conv.inner = untag_ptr(this_ptr);
33410         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33412         this_ptr_conv.is_owned = false;
33413         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
33414         uint64_t ret_ref = 0;
33415         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33416         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33417         return ret_ref;
33418 }
33419
33420 void  __attribute__((export_name("TS_ChannelCounterparty_set_features"))) TS_ChannelCounterparty_set_features(uint64_t this_ptr, uint64_t val) {
33421         LDKChannelCounterparty this_ptr_conv;
33422         this_ptr_conv.inner = untag_ptr(this_ptr);
33423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33425         this_ptr_conv.is_owned = false;
33426         LDKInitFeatures val_conv;
33427         val_conv.inner = untag_ptr(val);
33428         val_conv.is_owned = ptr_is_owned(val);
33429         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33430         val_conv = InitFeatures_clone(&val_conv);
33431         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
33432 }
33433
33434 int64_t  __attribute__((export_name("TS_ChannelCounterparty_get_unspendable_punishment_reserve"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint64_t this_ptr) {
33435         LDKChannelCounterparty this_ptr_conv;
33436         this_ptr_conv.inner = untag_ptr(this_ptr);
33437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33439         this_ptr_conv.is_owned = false;
33440         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
33441         return ret_conv;
33442 }
33443
33444 void  __attribute__((export_name("TS_ChannelCounterparty_set_unspendable_punishment_reserve"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint64_t this_ptr, int64_t val) {
33445         LDKChannelCounterparty this_ptr_conv;
33446         this_ptr_conv.inner = untag_ptr(this_ptr);
33447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33449         this_ptr_conv.is_owned = false;
33450         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
33451 }
33452
33453 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_forwarding_info"))) TS_ChannelCounterparty_get_forwarding_info(uint64_t this_ptr) {
33454         LDKChannelCounterparty this_ptr_conv;
33455         this_ptr_conv.inner = untag_ptr(this_ptr);
33456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33458         this_ptr_conv.is_owned = false;
33459         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
33460         uint64_t ret_ref = 0;
33461         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33462         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33463         return ret_ref;
33464 }
33465
33466 void  __attribute__((export_name("TS_ChannelCounterparty_set_forwarding_info"))) TS_ChannelCounterparty_set_forwarding_info(uint64_t this_ptr, uint64_t val) {
33467         LDKChannelCounterparty this_ptr_conv;
33468         this_ptr_conv.inner = untag_ptr(this_ptr);
33469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33471         this_ptr_conv.is_owned = false;
33472         LDKCounterpartyForwardingInfo val_conv;
33473         val_conv.inner = untag_ptr(val);
33474         val_conv.is_owned = ptr_is_owned(val);
33475         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33476         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
33477         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
33478 }
33479
33480 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_minimum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_minimum_msat(uint64_t this_ptr) {
33481         LDKChannelCounterparty this_ptr_conv;
33482         this_ptr_conv.inner = untag_ptr(this_ptr);
33483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33485         this_ptr_conv.is_owned = false;
33486         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
33487         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
33488         uint64_t ret_ref = tag_ptr(ret_copy, true);
33489         return ret_ref;
33490 }
33491
33492 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) {
33493         LDKChannelCounterparty this_ptr_conv;
33494         this_ptr_conv.inner = untag_ptr(this_ptr);
33495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33497         this_ptr_conv.is_owned = false;
33498         void* val_ptr = untag_ptr(val);
33499         CHECK_ACCESS(val_ptr);
33500         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
33501         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
33502         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
33503 }
33504
33505 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_maximum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_maximum_msat(uint64_t this_ptr) {
33506         LDKChannelCounterparty this_ptr_conv;
33507         this_ptr_conv.inner = untag_ptr(this_ptr);
33508         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33510         this_ptr_conv.is_owned = false;
33511         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
33512         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
33513         uint64_t ret_ref = tag_ptr(ret_copy, true);
33514         return ret_ref;
33515 }
33516
33517 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) {
33518         LDKChannelCounterparty this_ptr_conv;
33519         this_ptr_conv.inner = untag_ptr(this_ptr);
33520         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33522         this_ptr_conv.is_owned = false;
33523         void* val_ptr = untag_ptr(val);
33524         CHECK_ACCESS(val_ptr);
33525         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
33526         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
33527         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
33528 }
33529
33530 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) {
33531         LDKPublicKey node_id_arg_ref;
33532         CHECK(node_id_arg->arr_len == 33);
33533         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
33534         LDKInitFeatures features_arg_conv;
33535         features_arg_conv.inner = untag_ptr(features_arg);
33536         features_arg_conv.is_owned = ptr_is_owned(features_arg);
33537         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
33538         features_arg_conv = InitFeatures_clone(&features_arg_conv);
33539         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
33540         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
33541         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
33542         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
33543         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
33544         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
33545         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
33546         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
33547         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
33548         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
33549         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
33550         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
33551         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
33552         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);
33553         uint64_t ret_ref = 0;
33554         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33555         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33556         return ret_ref;
33557 }
33558
33559 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
33560         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
33561         uint64_t ret_ref = 0;
33562         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33563         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33564         return ret_ref;
33565 }
33566 int64_t  __attribute__((export_name("TS_ChannelCounterparty_clone_ptr"))) TS_ChannelCounterparty_clone_ptr(uint64_t arg) {
33567         LDKChannelCounterparty arg_conv;
33568         arg_conv.inner = untag_ptr(arg);
33569         arg_conv.is_owned = ptr_is_owned(arg);
33570         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33571         arg_conv.is_owned = false;
33572         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
33573         return ret_conv;
33574 }
33575
33576 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_clone"))) TS_ChannelCounterparty_clone(uint64_t orig) {
33577         LDKChannelCounterparty orig_conv;
33578         orig_conv.inner = untag_ptr(orig);
33579         orig_conv.is_owned = ptr_is_owned(orig);
33580         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33581         orig_conv.is_owned = false;
33582         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
33583         uint64_t ret_ref = 0;
33584         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33585         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33586         return ret_ref;
33587 }
33588
33589 void  __attribute__((export_name("TS_ChannelDetails_free"))) TS_ChannelDetails_free(uint64_t this_obj) {
33590         LDKChannelDetails this_obj_conv;
33591         this_obj_conv.inner = untag_ptr(this_obj);
33592         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33594         ChannelDetails_free(this_obj_conv);
33595 }
33596
33597 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_channel_id"))) TS_ChannelDetails_get_channel_id(uint64_t this_ptr) {
33598         LDKChannelDetails this_ptr_conv;
33599         this_ptr_conv.inner = untag_ptr(this_ptr);
33600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33602         this_ptr_conv.is_owned = false;
33603         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33604         memcpy(ret_arr->elems, *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
33605         return ret_arr;
33606 }
33607
33608 void  __attribute__((export_name("TS_ChannelDetails_set_channel_id"))) TS_ChannelDetails_set_channel_id(uint64_t this_ptr, int8_tArray val) {
33609         LDKChannelDetails this_ptr_conv;
33610         this_ptr_conv.inner = untag_ptr(this_ptr);
33611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33613         this_ptr_conv.is_owned = false;
33614         LDKThirtyTwoBytes val_ref;
33615         CHECK(val->arr_len == 32);
33616         memcpy(val_ref.data, val->elems, 32); FREE(val);
33617         ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
33618 }
33619
33620 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_counterparty"))) TS_ChannelDetails_get_counterparty(uint64_t this_ptr) {
33621         LDKChannelDetails this_ptr_conv;
33622         this_ptr_conv.inner = untag_ptr(this_ptr);
33623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33625         this_ptr_conv.is_owned = false;
33626         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
33627         uint64_t ret_ref = 0;
33628         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33629         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33630         return ret_ref;
33631 }
33632
33633 void  __attribute__((export_name("TS_ChannelDetails_set_counterparty"))) TS_ChannelDetails_set_counterparty(uint64_t this_ptr, uint64_t val) {
33634         LDKChannelDetails this_ptr_conv;
33635         this_ptr_conv.inner = untag_ptr(this_ptr);
33636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33638         this_ptr_conv.is_owned = false;
33639         LDKChannelCounterparty val_conv;
33640         val_conv.inner = untag_ptr(val);
33641         val_conv.is_owned = ptr_is_owned(val);
33642         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33643         val_conv = ChannelCounterparty_clone(&val_conv);
33644         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
33645 }
33646
33647 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_funding_txo"))) TS_ChannelDetails_get_funding_txo(uint64_t this_ptr) {
33648         LDKChannelDetails this_ptr_conv;
33649         this_ptr_conv.inner = untag_ptr(this_ptr);
33650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33652         this_ptr_conv.is_owned = false;
33653         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
33654         uint64_t ret_ref = 0;
33655         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33656         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33657         return ret_ref;
33658 }
33659
33660 void  __attribute__((export_name("TS_ChannelDetails_set_funding_txo"))) TS_ChannelDetails_set_funding_txo(uint64_t this_ptr, uint64_t val) {
33661         LDKChannelDetails this_ptr_conv;
33662         this_ptr_conv.inner = untag_ptr(this_ptr);
33663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33665         this_ptr_conv.is_owned = false;
33666         LDKOutPoint val_conv;
33667         val_conv.inner = untag_ptr(val);
33668         val_conv.is_owned = ptr_is_owned(val);
33669         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33670         val_conv = OutPoint_clone(&val_conv);
33671         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
33672 }
33673
33674 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_type"))) TS_ChannelDetails_get_channel_type(uint64_t this_ptr) {
33675         LDKChannelDetails this_ptr_conv;
33676         this_ptr_conv.inner = untag_ptr(this_ptr);
33677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33679         this_ptr_conv.is_owned = false;
33680         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
33681         uint64_t ret_ref = 0;
33682         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33683         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33684         return ret_ref;
33685 }
33686
33687 void  __attribute__((export_name("TS_ChannelDetails_set_channel_type"))) TS_ChannelDetails_set_channel_type(uint64_t this_ptr, uint64_t val) {
33688         LDKChannelDetails this_ptr_conv;
33689         this_ptr_conv.inner = untag_ptr(this_ptr);
33690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33692         this_ptr_conv.is_owned = false;
33693         LDKChannelTypeFeatures val_conv;
33694         val_conv.inner = untag_ptr(val);
33695         val_conv.is_owned = ptr_is_owned(val);
33696         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33697         val_conv = ChannelTypeFeatures_clone(&val_conv);
33698         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
33699 }
33700
33701 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_short_channel_id"))) TS_ChannelDetails_get_short_channel_id(uint64_t this_ptr) {
33702         LDKChannelDetails this_ptr_conv;
33703         this_ptr_conv.inner = untag_ptr(this_ptr);
33704         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33706         this_ptr_conv.is_owned = false;
33707         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
33708         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
33709         uint64_t ret_ref = tag_ptr(ret_copy, true);
33710         return ret_ref;
33711 }
33712
33713 void  __attribute__((export_name("TS_ChannelDetails_set_short_channel_id"))) TS_ChannelDetails_set_short_channel_id(uint64_t this_ptr, uint64_t val) {
33714         LDKChannelDetails this_ptr_conv;
33715         this_ptr_conv.inner = untag_ptr(this_ptr);
33716         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33718         this_ptr_conv.is_owned = false;
33719         void* val_ptr = untag_ptr(val);
33720         CHECK_ACCESS(val_ptr);
33721         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
33722         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
33723         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
33724 }
33725
33726 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_scid_alias"))) TS_ChannelDetails_get_outbound_scid_alias(uint64_t this_ptr) {
33727         LDKChannelDetails this_ptr_conv;
33728         this_ptr_conv.inner = untag_ptr(this_ptr);
33729         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33731         this_ptr_conv.is_owned = false;
33732         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
33733         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
33734         uint64_t ret_ref = tag_ptr(ret_copy, true);
33735         return ret_ref;
33736 }
33737
33738 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_scid_alias"))) TS_ChannelDetails_set_outbound_scid_alias(uint64_t this_ptr, uint64_t val) {
33739         LDKChannelDetails this_ptr_conv;
33740         this_ptr_conv.inner = untag_ptr(this_ptr);
33741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33743         this_ptr_conv.is_owned = false;
33744         void* val_ptr = untag_ptr(val);
33745         CHECK_ACCESS(val_ptr);
33746         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
33747         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
33748         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
33749 }
33750
33751 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_scid_alias"))) TS_ChannelDetails_get_inbound_scid_alias(uint64_t this_ptr) {
33752         LDKChannelDetails this_ptr_conv;
33753         this_ptr_conv.inner = untag_ptr(this_ptr);
33754         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33756         this_ptr_conv.is_owned = false;
33757         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
33758         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
33759         uint64_t ret_ref = tag_ptr(ret_copy, true);
33760         return ret_ref;
33761 }
33762
33763 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_scid_alias"))) TS_ChannelDetails_set_inbound_scid_alias(uint64_t this_ptr, uint64_t val) {
33764         LDKChannelDetails this_ptr_conv;
33765         this_ptr_conv.inner = untag_ptr(this_ptr);
33766         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33768         this_ptr_conv.is_owned = false;
33769         void* val_ptr = untag_ptr(val);
33770         CHECK_ACCESS(val_ptr);
33771         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
33772         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
33773         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
33774 }
33775
33776 int64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_value_satoshis"))) TS_ChannelDetails_get_channel_value_satoshis(uint64_t this_ptr) {
33777         LDKChannelDetails this_ptr_conv;
33778         this_ptr_conv.inner = untag_ptr(this_ptr);
33779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33781         this_ptr_conv.is_owned = false;
33782         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
33783         return ret_conv;
33784 }
33785
33786 void  __attribute__((export_name("TS_ChannelDetails_set_channel_value_satoshis"))) TS_ChannelDetails_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
33787         LDKChannelDetails this_ptr_conv;
33788         this_ptr_conv.inner = untag_ptr(this_ptr);
33789         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33791         this_ptr_conv.is_owned = false;
33792         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
33793 }
33794
33795 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_unspendable_punishment_reserve"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint64_t this_ptr) {
33796         LDKChannelDetails this_ptr_conv;
33797         this_ptr_conv.inner = untag_ptr(this_ptr);
33798         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33800         this_ptr_conv.is_owned = false;
33801         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
33802         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
33803         uint64_t ret_ref = tag_ptr(ret_copy, true);
33804         return ret_ref;
33805 }
33806
33807 void  __attribute__((export_name("TS_ChannelDetails_set_unspendable_punishment_reserve"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint64_t this_ptr, uint64_t val) {
33808         LDKChannelDetails this_ptr_conv;
33809         this_ptr_conv.inner = untag_ptr(this_ptr);
33810         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33812         this_ptr_conv.is_owned = false;
33813         void* val_ptr = untag_ptr(val);
33814         CHECK_ACCESS(val_ptr);
33815         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
33816         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
33817         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
33818 }
33819
33820 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_user_channel_id"))) TS_ChannelDetails_get_user_channel_id(uint64_t this_ptr) {
33821         LDKChannelDetails this_ptr_conv;
33822         this_ptr_conv.inner = untag_ptr(this_ptr);
33823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33825         this_ptr_conv.is_owned = false;
33826         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
33827         memcpy(ret_arr->elems, ChannelDetails_get_user_channel_id(&this_ptr_conv).le_bytes, 16);
33828         return ret_arr;
33829 }
33830
33831 void  __attribute__((export_name("TS_ChannelDetails_set_user_channel_id"))) TS_ChannelDetails_set_user_channel_id(uint64_t this_ptr, int8_tArray val) {
33832         LDKChannelDetails this_ptr_conv;
33833         this_ptr_conv.inner = untag_ptr(this_ptr);
33834         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33836         this_ptr_conv.is_owned = false;
33837         LDKU128 val_ref;
33838         CHECK(val->arr_len == 16);
33839         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
33840         ChannelDetails_set_user_channel_id(&this_ptr_conv, val_ref);
33841 }
33842
33843 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) {
33844         LDKChannelDetails this_ptr_conv;
33845         this_ptr_conv.inner = untag_ptr(this_ptr);
33846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33848         this_ptr_conv.is_owned = false;
33849         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
33850         *ret_copy = ChannelDetails_get_feerate_sat_per_1000_weight(&this_ptr_conv);
33851         uint64_t ret_ref = tag_ptr(ret_copy, true);
33852         return ret_ref;
33853 }
33854
33855 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) {
33856         LDKChannelDetails this_ptr_conv;
33857         this_ptr_conv.inner = untag_ptr(this_ptr);
33858         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33860         this_ptr_conv.is_owned = false;
33861         void* val_ptr = untag_ptr(val);
33862         CHECK_ACCESS(val_ptr);
33863         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
33864         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
33865         ChannelDetails_set_feerate_sat_per_1000_weight(&this_ptr_conv, val_conv);
33866 }
33867
33868 int64_t  __attribute__((export_name("TS_ChannelDetails_get_balance_msat"))) TS_ChannelDetails_get_balance_msat(uint64_t this_ptr) {
33869         LDKChannelDetails this_ptr_conv;
33870         this_ptr_conv.inner = untag_ptr(this_ptr);
33871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33873         this_ptr_conv.is_owned = false;
33874         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
33875         return ret_conv;
33876 }
33877
33878 void  __attribute__((export_name("TS_ChannelDetails_set_balance_msat"))) TS_ChannelDetails_set_balance_msat(uint64_t this_ptr, int64_t val) {
33879         LDKChannelDetails this_ptr_conv;
33880         this_ptr_conv.inner = untag_ptr(this_ptr);
33881         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33883         this_ptr_conv.is_owned = false;
33884         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
33885 }
33886
33887 int64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_capacity_msat"))) TS_ChannelDetails_get_outbound_capacity_msat(uint64_t this_ptr) {
33888         LDKChannelDetails this_ptr_conv;
33889         this_ptr_conv.inner = untag_ptr(this_ptr);
33890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33892         this_ptr_conv.is_owned = false;
33893         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
33894         return ret_conv;
33895 }
33896
33897 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_capacity_msat"))) TS_ChannelDetails_set_outbound_capacity_msat(uint64_t this_ptr, int64_t val) {
33898         LDKChannelDetails this_ptr_conv;
33899         this_ptr_conv.inner = untag_ptr(this_ptr);
33900         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33902         this_ptr_conv.is_owned = false;
33903         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
33904 }
33905
33906 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) {
33907         LDKChannelDetails this_ptr_conv;
33908         this_ptr_conv.inner = untag_ptr(this_ptr);
33909         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33911         this_ptr_conv.is_owned = false;
33912         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
33913         return ret_conv;
33914 }
33915
33916 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) {
33917         LDKChannelDetails this_ptr_conv;
33918         this_ptr_conv.inner = untag_ptr(this_ptr);
33919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33921         this_ptr_conv.is_owned = false;
33922         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
33923 }
33924
33925 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) {
33926         LDKChannelDetails this_ptr_conv;
33927         this_ptr_conv.inner = untag_ptr(this_ptr);
33928         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33930         this_ptr_conv.is_owned = false;
33931         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_minimum_msat(&this_ptr_conv);
33932         return ret_conv;
33933 }
33934
33935 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) {
33936         LDKChannelDetails this_ptr_conv;
33937         this_ptr_conv.inner = untag_ptr(this_ptr);
33938         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33940         this_ptr_conv.is_owned = false;
33941         ChannelDetails_set_next_outbound_htlc_minimum_msat(&this_ptr_conv, val);
33942 }
33943
33944 int64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_capacity_msat"))) TS_ChannelDetails_get_inbound_capacity_msat(uint64_t this_ptr) {
33945         LDKChannelDetails this_ptr_conv;
33946         this_ptr_conv.inner = untag_ptr(this_ptr);
33947         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33949         this_ptr_conv.is_owned = false;
33950         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
33951         return ret_conv;
33952 }
33953
33954 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_capacity_msat"))) TS_ChannelDetails_set_inbound_capacity_msat(uint64_t this_ptr, int64_t val) {
33955         LDKChannelDetails this_ptr_conv;
33956         this_ptr_conv.inner = untag_ptr(this_ptr);
33957         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33959         this_ptr_conv.is_owned = false;
33960         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
33961 }
33962
33963 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations_required"))) TS_ChannelDetails_get_confirmations_required(uint64_t this_ptr) {
33964         LDKChannelDetails this_ptr_conv;
33965         this_ptr_conv.inner = untag_ptr(this_ptr);
33966         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33968         this_ptr_conv.is_owned = false;
33969         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
33970         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
33971         uint64_t ret_ref = tag_ptr(ret_copy, true);
33972         return ret_ref;
33973 }
33974
33975 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations_required"))) TS_ChannelDetails_set_confirmations_required(uint64_t this_ptr, uint64_t val) {
33976         LDKChannelDetails this_ptr_conv;
33977         this_ptr_conv.inner = untag_ptr(this_ptr);
33978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33980         this_ptr_conv.is_owned = false;
33981         void* val_ptr = untag_ptr(val);
33982         CHECK_ACCESS(val_ptr);
33983         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
33984         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
33985         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
33986 }
33987
33988 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations"))) TS_ChannelDetails_get_confirmations(uint64_t this_ptr) {
33989         LDKChannelDetails this_ptr_conv;
33990         this_ptr_conv.inner = untag_ptr(this_ptr);
33991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33993         this_ptr_conv.is_owned = false;
33994         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
33995         *ret_copy = ChannelDetails_get_confirmations(&this_ptr_conv);
33996         uint64_t ret_ref = tag_ptr(ret_copy, true);
33997         return ret_ref;
33998 }
33999
34000 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations"))) TS_ChannelDetails_set_confirmations(uint64_t this_ptr, uint64_t val) {
34001         LDKChannelDetails this_ptr_conv;
34002         this_ptr_conv.inner = untag_ptr(this_ptr);
34003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34005         this_ptr_conv.is_owned = false;
34006         void* val_ptr = untag_ptr(val);
34007         CHECK_ACCESS(val_ptr);
34008         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
34009         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
34010         ChannelDetails_set_confirmations(&this_ptr_conv, val_conv);
34011 }
34012
34013 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_force_close_spend_delay"))) TS_ChannelDetails_get_force_close_spend_delay(uint64_t this_ptr) {
34014         LDKChannelDetails this_ptr_conv;
34015         this_ptr_conv.inner = untag_ptr(this_ptr);
34016         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34018         this_ptr_conv.is_owned = false;
34019         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
34020         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
34021         uint64_t ret_ref = tag_ptr(ret_copy, true);
34022         return ret_ref;
34023 }
34024
34025 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) {
34026         LDKChannelDetails this_ptr_conv;
34027         this_ptr_conv.inner = untag_ptr(this_ptr);
34028         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34030         this_ptr_conv.is_owned = false;
34031         void* val_ptr = untag_ptr(val);
34032         CHECK_ACCESS(val_ptr);
34033         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
34034         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
34035         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
34036 }
34037
34038 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_outbound"))) TS_ChannelDetails_get_is_outbound(uint64_t this_ptr) {
34039         LDKChannelDetails this_ptr_conv;
34040         this_ptr_conv.inner = untag_ptr(this_ptr);
34041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34043         this_ptr_conv.is_owned = false;
34044         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
34045         return ret_conv;
34046 }
34047
34048 void  __attribute__((export_name("TS_ChannelDetails_set_is_outbound"))) TS_ChannelDetails_set_is_outbound(uint64_t this_ptr, jboolean val) {
34049         LDKChannelDetails this_ptr_conv;
34050         this_ptr_conv.inner = untag_ptr(this_ptr);
34051         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34053         this_ptr_conv.is_owned = false;
34054         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
34055 }
34056
34057 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_channel_ready"))) TS_ChannelDetails_get_is_channel_ready(uint64_t this_ptr) {
34058         LDKChannelDetails this_ptr_conv;
34059         this_ptr_conv.inner = untag_ptr(this_ptr);
34060         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34062         this_ptr_conv.is_owned = false;
34063         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
34064         return ret_conv;
34065 }
34066
34067 void  __attribute__((export_name("TS_ChannelDetails_set_is_channel_ready"))) TS_ChannelDetails_set_is_channel_ready(uint64_t this_ptr, jboolean val) {
34068         LDKChannelDetails this_ptr_conv;
34069         this_ptr_conv.inner = untag_ptr(this_ptr);
34070         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34072         this_ptr_conv.is_owned = false;
34073         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
34074 }
34075
34076 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_shutdown_state"))) TS_ChannelDetails_get_channel_shutdown_state(uint64_t this_ptr) {
34077         LDKChannelDetails this_ptr_conv;
34078         this_ptr_conv.inner = untag_ptr(this_ptr);
34079         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34081         this_ptr_conv.is_owned = false;
34082         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
34083         *ret_copy = ChannelDetails_get_channel_shutdown_state(&this_ptr_conv);
34084         uint64_t ret_ref = tag_ptr(ret_copy, true);
34085         return ret_ref;
34086 }
34087
34088 void  __attribute__((export_name("TS_ChannelDetails_set_channel_shutdown_state"))) TS_ChannelDetails_set_channel_shutdown_state(uint64_t this_ptr, uint64_t val) {
34089         LDKChannelDetails this_ptr_conv;
34090         this_ptr_conv.inner = untag_ptr(this_ptr);
34091         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34093         this_ptr_conv.is_owned = false;
34094         void* val_ptr = untag_ptr(val);
34095         CHECK_ACCESS(val_ptr);
34096         LDKCOption_ChannelShutdownStateZ val_conv = *(LDKCOption_ChannelShutdownStateZ*)(val_ptr);
34097         val_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(val));
34098         ChannelDetails_set_channel_shutdown_state(&this_ptr_conv, val_conv);
34099 }
34100
34101 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_usable"))) TS_ChannelDetails_get_is_usable(uint64_t this_ptr) {
34102         LDKChannelDetails this_ptr_conv;
34103         this_ptr_conv.inner = untag_ptr(this_ptr);
34104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34106         this_ptr_conv.is_owned = false;
34107         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
34108         return ret_conv;
34109 }
34110
34111 void  __attribute__((export_name("TS_ChannelDetails_set_is_usable"))) TS_ChannelDetails_set_is_usable(uint64_t this_ptr, jboolean val) {
34112         LDKChannelDetails this_ptr_conv;
34113         this_ptr_conv.inner = untag_ptr(this_ptr);
34114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34116         this_ptr_conv.is_owned = false;
34117         ChannelDetails_set_is_usable(&this_ptr_conv, val);
34118 }
34119
34120 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_public"))) TS_ChannelDetails_get_is_public(uint64_t this_ptr) {
34121         LDKChannelDetails this_ptr_conv;
34122         this_ptr_conv.inner = untag_ptr(this_ptr);
34123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34125         this_ptr_conv.is_owned = false;
34126         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
34127         return ret_conv;
34128 }
34129
34130 void  __attribute__((export_name("TS_ChannelDetails_set_is_public"))) TS_ChannelDetails_set_is_public(uint64_t this_ptr, jboolean val) {
34131         LDKChannelDetails this_ptr_conv;
34132         this_ptr_conv.inner = untag_ptr(this_ptr);
34133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34135         this_ptr_conv.is_owned = false;
34136         ChannelDetails_set_is_public(&this_ptr_conv, val);
34137 }
34138
34139 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_minimum_msat"))) TS_ChannelDetails_get_inbound_htlc_minimum_msat(uint64_t this_ptr) {
34140         LDKChannelDetails this_ptr_conv;
34141         this_ptr_conv.inner = untag_ptr(this_ptr);
34142         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34144         this_ptr_conv.is_owned = false;
34145         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34146         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
34147         uint64_t ret_ref = tag_ptr(ret_copy, true);
34148         return ret_ref;
34149 }
34150
34151 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) {
34152         LDKChannelDetails this_ptr_conv;
34153         this_ptr_conv.inner = untag_ptr(this_ptr);
34154         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34156         this_ptr_conv.is_owned = false;
34157         void* val_ptr = untag_ptr(val);
34158         CHECK_ACCESS(val_ptr);
34159         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
34160         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
34161         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
34162 }
34163
34164 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_maximum_msat"))) TS_ChannelDetails_get_inbound_htlc_maximum_msat(uint64_t this_ptr) {
34165         LDKChannelDetails this_ptr_conv;
34166         this_ptr_conv.inner = untag_ptr(this_ptr);
34167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34169         this_ptr_conv.is_owned = false;
34170         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34171         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
34172         uint64_t ret_ref = tag_ptr(ret_copy, true);
34173         return ret_ref;
34174 }
34175
34176 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) {
34177         LDKChannelDetails this_ptr_conv;
34178         this_ptr_conv.inner = untag_ptr(this_ptr);
34179         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34181         this_ptr_conv.is_owned = false;
34182         void* val_ptr = untag_ptr(val);
34183         CHECK_ACCESS(val_ptr);
34184         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
34185         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
34186         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
34187 }
34188
34189 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_config"))) TS_ChannelDetails_get_config(uint64_t this_ptr) {
34190         LDKChannelDetails this_ptr_conv;
34191         this_ptr_conv.inner = untag_ptr(this_ptr);
34192         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34194         this_ptr_conv.is_owned = false;
34195         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
34196         uint64_t ret_ref = 0;
34197         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34198         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34199         return ret_ref;
34200 }
34201
34202 void  __attribute__((export_name("TS_ChannelDetails_set_config"))) TS_ChannelDetails_set_config(uint64_t this_ptr, uint64_t val) {
34203         LDKChannelDetails this_ptr_conv;
34204         this_ptr_conv.inner = untag_ptr(this_ptr);
34205         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34207         this_ptr_conv.is_owned = false;
34208         LDKChannelConfig val_conv;
34209         val_conv.inner = untag_ptr(val);
34210         val_conv.is_owned = ptr_is_owned(val);
34211         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34212         val_conv = ChannelConfig_clone(&val_conv);
34213         ChannelDetails_set_config(&this_ptr_conv, val_conv);
34214 }
34215
34216 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) {
34217         LDKThirtyTwoBytes channel_id_arg_ref;
34218         CHECK(channel_id_arg->arr_len == 32);
34219         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
34220         LDKChannelCounterparty counterparty_arg_conv;
34221         counterparty_arg_conv.inner = untag_ptr(counterparty_arg);
34222         counterparty_arg_conv.is_owned = ptr_is_owned(counterparty_arg);
34223         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
34224         counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
34225         LDKOutPoint funding_txo_arg_conv;
34226         funding_txo_arg_conv.inner = untag_ptr(funding_txo_arg);
34227         funding_txo_arg_conv.is_owned = ptr_is_owned(funding_txo_arg);
34228         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
34229         funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
34230         LDKChannelTypeFeatures channel_type_arg_conv;
34231         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
34232         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
34233         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
34234         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
34235         void* short_channel_id_arg_ptr = untag_ptr(short_channel_id_arg);
34236         CHECK_ACCESS(short_channel_id_arg_ptr);
34237         LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
34238         short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_arg));
34239         void* outbound_scid_alias_arg_ptr = untag_ptr(outbound_scid_alias_arg);
34240         CHECK_ACCESS(outbound_scid_alias_arg_ptr);
34241         LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
34242         outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_scid_alias_arg));
34243         void* inbound_scid_alias_arg_ptr = untag_ptr(inbound_scid_alias_arg);
34244         CHECK_ACCESS(inbound_scid_alias_arg_ptr);
34245         LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
34246         inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_scid_alias_arg));
34247         void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg);
34248         CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
34249         LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
34250         LDKU128 user_channel_id_arg_ref;
34251         CHECK(user_channel_id_arg->arr_len == 16);
34252         memcpy(user_channel_id_arg_ref.le_bytes, user_channel_id_arg->elems, 16); FREE(user_channel_id_arg);
34253         void* feerate_sat_per_1000_weight_arg_ptr = untag_ptr(feerate_sat_per_1000_weight_arg);
34254         CHECK_ACCESS(feerate_sat_per_1000_weight_arg_ptr);
34255         LDKCOption_u32Z feerate_sat_per_1000_weight_arg_conv = *(LDKCOption_u32Z*)(feerate_sat_per_1000_weight_arg_ptr);
34256         feerate_sat_per_1000_weight_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(feerate_sat_per_1000_weight_arg));
34257         void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg);
34258         CHECK_ACCESS(confirmations_required_arg_ptr);
34259         LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
34260         confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg));
34261         void* confirmations_arg_ptr = untag_ptr(confirmations_arg);
34262         CHECK_ACCESS(confirmations_arg_ptr);
34263         LDKCOption_u32Z confirmations_arg_conv = *(LDKCOption_u32Z*)(confirmations_arg_ptr);
34264         confirmations_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_arg));
34265         void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg);
34266         CHECK_ACCESS(force_close_spend_delay_arg_ptr);
34267         LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
34268         force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(force_close_spend_delay_arg));
34269         void* channel_shutdown_state_arg_ptr = untag_ptr(channel_shutdown_state_arg);
34270         CHECK_ACCESS(channel_shutdown_state_arg_ptr);
34271         LDKCOption_ChannelShutdownStateZ channel_shutdown_state_arg_conv = *(LDKCOption_ChannelShutdownStateZ*)(channel_shutdown_state_arg_ptr);
34272         channel_shutdown_state_arg_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(channel_shutdown_state_arg));
34273         void* inbound_htlc_minimum_msat_arg_ptr = untag_ptr(inbound_htlc_minimum_msat_arg);
34274         CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
34275         LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
34276         inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_minimum_msat_arg));
34277         void* inbound_htlc_maximum_msat_arg_ptr = untag_ptr(inbound_htlc_maximum_msat_arg);
34278         CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
34279         LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
34280         inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_maximum_msat_arg));
34281         LDKChannelConfig config_arg_conv;
34282         config_arg_conv.inner = untag_ptr(config_arg);
34283         config_arg_conv.is_owned = ptr_is_owned(config_arg);
34284         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
34285         config_arg_conv = ChannelConfig_clone(&config_arg_conv);
34286         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);
34287         uint64_t ret_ref = 0;
34288         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34289         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34290         return ret_ref;
34291 }
34292
34293 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
34294         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
34295         uint64_t ret_ref = 0;
34296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34297         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34298         return ret_ref;
34299 }
34300 int64_t  __attribute__((export_name("TS_ChannelDetails_clone_ptr"))) TS_ChannelDetails_clone_ptr(uint64_t arg) {
34301         LDKChannelDetails arg_conv;
34302         arg_conv.inner = untag_ptr(arg);
34303         arg_conv.is_owned = ptr_is_owned(arg);
34304         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34305         arg_conv.is_owned = false;
34306         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
34307         return ret_conv;
34308 }
34309
34310 uint64_t  __attribute__((export_name("TS_ChannelDetails_clone"))) TS_ChannelDetails_clone(uint64_t orig) {
34311         LDKChannelDetails orig_conv;
34312         orig_conv.inner = untag_ptr(orig);
34313         orig_conv.is_owned = ptr_is_owned(orig);
34314         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34315         orig_conv.is_owned = false;
34316         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
34317         uint64_t ret_ref = 0;
34318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34320         return ret_ref;
34321 }
34322
34323 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_payment_scid"))) TS_ChannelDetails_get_inbound_payment_scid(uint64_t this_arg) {
34324         LDKChannelDetails this_arg_conv;
34325         this_arg_conv.inner = untag_ptr(this_arg);
34326         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34328         this_arg_conv.is_owned = false;
34329         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34330         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
34331         uint64_t ret_ref = tag_ptr(ret_copy, true);
34332         return ret_ref;
34333 }
34334
34335 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_payment_scid"))) TS_ChannelDetails_get_outbound_payment_scid(uint64_t this_arg) {
34336         LDKChannelDetails this_arg_conv;
34337         this_arg_conv.inner = untag_ptr(this_arg);
34338         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34340         this_arg_conv.is_owned = false;
34341         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34342         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
34343         uint64_t ret_ref = tag_ptr(ret_copy, true);
34344         return ret_ref;
34345 }
34346
34347 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_clone"))) TS_ChannelShutdownState_clone(uint64_t orig) {
34348         LDKChannelShutdownState* orig_conv = (LDKChannelShutdownState*)untag_ptr(orig);
34349         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_clone(orig_conv));
34350         return ret_conv;
34351 }
34352
34353 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_not_shutting_down"))) TS_ChannelShutdownState_not_shutting_down() {
34354         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_not_shutting_down());
34355         return ret_conv;
34356 }
34357
34358 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_shutdown_initiated"))) TS_ChannelShutdownState_shutdown_initiated() {
34359         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_shutdown_initiated());
34360         return ret_conv;
34361 }
34362
34363 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_resolving_htlcs"))) TS_ChannelShutdownState_resolving_htlcs() {
34364         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_resolving_htlcs());
34365         return ret_conv;
34366 }
34367
34368 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_negotiating_closing_fee"))) TS_ChannelShutdownState_negotiating_closing_fee() {
34369         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_negotiating_closing_fee());
34370         return ret_conv;
34371 }
34372
34373 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_shutdown_complete"))) TS_ChannelShutdownState_shutdown_complete() {
34374         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_shutdown_complete());
34375         return ret_conv;
34376 }
34377
34378 jboolean  __attribute__((export_name("TS_ChannelShutdownState_eq"))) TS_ChannelShutdownState_eq(uint64_t a, uint64_t b) {
34379         LDKChannelShutdownState* a_conv = (LDKChannelShutdownState*)untag_ptr(a);
34380         LDKChannelShutdownState* b_conv = (LDKChannelShutdownState*)untag_ptr(b);
34381         jboolean ret_conv = ChannelShutdownState_eq(a_conv, b_conv);
34382         return ret_conv;
34383 }
34384
34385 void  __attribute__((export_name("TS_RecentPaymentDetails_free"))) TS_RecentPaymentDetails_free(uint64_t this_ptr) {
34386         if (!ptr_is_owned(this_ptr)) return;
34387         void* this_ptr_ptr = untag_ptr(this_ptr);
34388         CHECK_ACCESS(this_ptr_ptr);
34389         LDKRecentPaymentDetails this_ptr_conv = *(LDKRecentPaymentDetails*)(this_ptr_ptr);
34390         FREE(untag_ptr(this_ptr));
34391         RecentPaymentDetails_free(this_ptr_conv);
34392 }
34393
34394 static inline uint64_t RecentPaymentDetails_clone_ptr(LDKRecentPaymentDetails *NONNULL_PTR arg) {
34395         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
34396         *ret_copy = RecentPaymentDetails_clone(arg);
34397         uint64_t ret_ref = tag_ptr(ret_copy, true);
34398         return ret_ref;
34399 }
34400 int64_t  __attribute__((export_name("TS_RecentPaymentDetails_clone_ptr"))) TS_RecentPaymentDetails_clone_ptr(uint64_t arg) {
34401         LDKRecentPaymentDetails* arg_conv = (LDKRecentPaymentDetails*)untag_ptr(arg);
34402         int64_t ret_conv = RecentPaymentDetails_clone_ptr(arg_conv);
34403         return ret_conv;
34404 }
34405
34406 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_clone"))) TS_RecentPaymentDetails_clone(uint64_t orig) {
34407         LDKRecentPaymentDetails* orig_conv = (LDKRecentPaymentDetails*)untag_ptr(orig);
34408         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
34409         *ret_copy = RecentPaymentDetails_clone(orig_conv);
34410         uint64_t ret_ref = tag_ptr(ret_copy, true);
34411         return ret_ref;
34412 }
34413
34414 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_awaiting_invoice"))) TS_RecentPaymentDetails_awaiting_invoice(int8_tArray payment_id) {
34415         LDKThirtyTwoBytes payment_id_ref;
34416         CHECK(payment_id->arr_len == 32);
34417         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
34418         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
34419         *ret_copy = RecentPaymentDetails_awaiting_invoice(payment_id_ref);
34420         uint64_t ret_ref = tag_ptr(ret_copy, true);
34421         return ret_ref;
34422 }
34423
34424 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_pending"))) TS_RecentPaymentDetails_pending(int8_tArray payment_id, int8_tArray payment_hash, int64_t total_msat) {
34425         LDKThirtyTwoBytes payment_id_ref;
34426         CHECK(payment_id->arr_len == 32);
34427         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
34428         LDKThirtyTwoBytes payment_hash_ref;
34429         CHECK(payment_hash->arr_len == 32);
34430         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
34431         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
34432         *ret_copy = RecentPaymentDetails_pending(payment_id_ref, payment_hash_ref, total_msat);
34433         uint64_t ret_ref = tag_ptr(ret_copy, true);
34434         return ret_ref;
34435 }
34436
34437 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_fulfilled"))) TS_RecentPaymentDetails_fulfilled(int8_tArray payment_id, uint64_t payment_hash) {
34438         LDKThirtyTwoBytes payment_id_ref;
34439         CHECK(payment_id->arr_len == 32);
34440         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
34441         void* payment_hash_ptr = untag_ptr(payment_hash);
34442         CHECK_ACCESS(payment_hash_ptr);
34443         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
34444         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
34445         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
34446         *ret_copy = RecentPaymentDetails_fulfilled(payment_id_ref, payment_hash_conv);
34447         uint64_t ret_ref = tag_ptr(ret_copy, true);
34448         return ret_ref;
34449 }
34450
34451 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_abandoned"))) TS_RecentPaymentDetails_abandoned(int8_tArray payment_id, int8_tArray payment_hash) {
34452         LDKThirtyTwoBytes payment_id_ref;
34453         CHECK(payment_id->arr_len == 32);
34454         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
34455         LDKThirtyTwoBytes payment_hash_ref;
34456         CHECK(payment_hash->arr_len == 32);
34457         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
34458         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
34459         *ret_copy = RecentPaymentDetails_abandoned(payment_id_ref, payment_hash_ref);
34460         uint64_t ret_ref = tag_ptr(ret_copy, true);
34461         return ret_ref;
34462 }
34463
34464 void  __attribute__((export_name("TS_PhantomRouteHints_free"))) TS_PhantomRouteHints_free(uint64_t this_obj) {
34465         LDKPhantomRouteHints this_obj_conv;
34466         this_obj_conv.inner = untag_ptr(this_obj);
34467         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34469         PhantomRouteHints_free(this_obj_conv);
34470 }
34471
34472 uint64_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_channels"))) TS_PhantomRouteHints_get_channels(uint64_t this_ptr) {
34473         LDKPhantomRouteHints this_ptr_conv;
34474         this_ptr_conv.inner = untag_ptr(this_ptr);
34475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34477         this_ptr_conv.is_owned = false;
34478         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
34479         uint64_tArray ret_arr = NULL;
34480         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
34481         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
34482         for (size_t q = 0; q < ret_var.datalen; q++) {
34483                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
34484                 uint64_t ret_conv_16_ref = 0;
34485                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
34486                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
34487                 ret_arr_ptr[q] = ret_conv_16_ref;
34488         }
34489         
34490         FREE(ret_var.data);
34491         return ret_arr;
34492 }
34493
34494 void  __attribute__((export_name("TS_PhantomRouteHints_set_channels"))) TS_PhantomRouteHints_set_channels(uint64_t this_ptr, uint64_tArray val) {
34495         LDKPhantomRouteHints this_ptr_conv;
34496         this_ptr_conv.inner = untag_ptr(this_ptr);
34497         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34499         this_ptr_conv.is_owned = false;
34500         LDKCVec_ChannelDetailsZ val_constr;
34501         val_constr.datalen = val->arr_len;
34502         if (val_constr.datalen > 0)
34503                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
34504         else
34505                 val_constr.data = NULL;
34506         uint64_t* val_vals = val->elems;
34507         for (size_t q = 0; q < val_constr.datalen; q++) {
34508                 uint64_t val_conv_16 = val_vals[q];
34509                 LDKChannelDetails val_conv_16_conv;
34510                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
34511                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
34512                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
34513                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
34514                 val_constr.data[q] = val_conv_16_conv;
34515         }
34516         FREE(val);
34517         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
34518 }
34519
34520 int64_t  __attribute__((export_name("TS_PhantomRouteHints_get_phantom_scid"))) TS_PhantomRouteHints_get_phantom_scid(uint64_t this_ptr) {
34521         LDKPhantomRouteHints this_ptr_conv;
34522         this_ptr_conv.inner = untag_ptr(this_ptr);
34523         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34525         this_ptr_conv.is_owned = false;
34526         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
34527         return ret_conv;
34528 }
34529
34530 void  __attribute__((export_name("TS_PhantomRouteHints_set_phantom_scid"))) TS_PhantomRouteHints_set_phantom_scid(uint64_t this_ptr, int64_t val) {
34531         LDKPhantomRouteHints this_ptr_conv;
34532         this_ptr_conv.inner = untag_ptr(this_ptr);
34533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34535         this_ptr_conv.is_owned = false;
34536         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
34537 }
34538
34539 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_real_node_pubkey"))) TS_PhantomRouteHints_get_real_node_pubkey(uint64_t this_ptr) {
34540         LDKPhantomRouteHints this_ptr_conv;
34541         this_ptr_conv.inner = untag_ptr(this_ptr);
34542         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34544         this_ptr_conv.is_owned = false;
34545         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
34546         memcpy(ret_arr->elems, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form, 33);
34547         return ret_arr;
34548 }
34549
34550 void  __attribute__((export_name("TS_PhantomRouteHints_set_real_node_pubkey"))) TS_PhantomRouteHints_set_real_node_pubkey(uint64_t this_ptr, int8_tArray val) {
34551         LDKPhantomRouteHints this_ptr_conv;
34552         this_ptr_conv.inner = untag_ptr(this_ptr);
34553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34555         this_ptr_conv.is_owned = false;
34556         LDKPublicKey val_ref;
34557         CHECK(val->arr_len == 33);
34558         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
34559         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
34560 }
34561
34562 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) {
34563         LDKCVec_ChannelDetailsZ channels_arg_constr;
34564         channels_arg_constr.datalen = channels_arg->arr_len;
34565         if (channels_arg_constr.datalen > 0)
34566                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
34567         else
34568                 channels_arg_constr.data = NULL;
34569         uint64_t* channels_arg_vals = channels_arg->elems;
34570         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
34571                 uint64_t channels_arg_conv_16 = channels_arg_vals[q];
34572                 LDKChannelDetails channels_arg_conv_16_conv;
34573                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
34574                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
34575                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
34576                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
34577                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
34578         }
34579         FREE(channels_arg);
34580         LDKPublicKey real_node_pubkey_arg_ref;
34581         CHECK(real_node_pubkey_arg->arr_len == 33);
34582         memcpy(real_node_pubkey_arg_ref.compressed_form, real_node_pubkey_arg->elems, 33); FREE(real_node_pubkey_arg);
34583         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
34584         uint64_t ret_ref = 0;
34585         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34586         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34587         return ret_ref;
34588 }
34589
34590 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
34591         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
34592         uint64_t ret_ref = 0;
34593         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34594         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34595         return ret_ref;
34596 }
34597 int64_t  __attribute__((export_name("TS_PhantomRouteHints_clone_ptr"))) TS_PhantomRouteHints_clone_ptr(uint64_t arg) {
34598         LDKPhantomRouteHints arg_conv;
34599         arg_conv.inner = untag_ptr(arg);
34600         arg_conv.is_owned = ptr_is_owned(arg);
34601         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34602         arg_conv.is_owned = false;
34603         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
34604         return ret_conv;
34605 }
34606
34607 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_clone"))) TS_PhantomRouteHints_clone(uint64_t orig) {
34608         LDKPhantomRouteHints orig_conv;
34609         orig_conv.inner = untag_ptr(orig);
34610         orig_conv.is_owned = ptr_is_owned(orig);
34611         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34612         orig_conv.is_owned = false;
34613         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
34614         uint64_t ret_ref = 0;
34615         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34616         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34617         return ret_ref;
34618 }
34619
34620 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) {
34621         void* fee_est_ptr = untag_ptr(fee_est);
34622         CHECK_ACCESS(fee_est_ptr);
34623         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
34624         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
34625                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34626                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
34627         }
34628         void* chain_monitor_ptr = untag_ptr(chain_monitor);
34629         CHECK_ACCESS(chain_monitor_ptr);
34630         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
34631         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
34632                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34633                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
34634         }
34635         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
34636         CHECK_ACCESS(tx_broadcaster_ptr);
34637         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
34638         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
34639                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34640                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
34641         }
34642         void* router_ptr = untag_ptr(router);
34643         CHECK_ACCESS(router_ptr);
34644         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
34645         if (router_conv.free == LDKRouter_JCalls_free) {
34646                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34647                 LDKRouter_JCalls_cloned(&router_conv);
34648         }
34649         void* logger_ptr = untag_ptr(logger);
34650         CHECK_ACCESS(logger_ptr);
34651         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
34652         if (logger_conv.free == LDKLogger_JCalls_free) {
34653                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34654                 LDKLogger_JCalls_cloned(&logger_conv);
34655         }
34656         void* entropy_source_ptr = untag_ptr(entropy_source);
34657         CHECK_ACCESS(entropy_source_ptr);
34658         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
34659         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
34660                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34661                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
34662         }
34663         void* node_signer_ptr = untag_ptr(node_signer);
34664         CHECK_ACCESS(node_signer_ptr);
34665         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
34666         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
34667                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34668                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
34669         }
34670         void* signer_provider_ptr = untag_ptr(signer_provider);
34671         CHECK_ACCESS(signer_provider_ptr);
34672         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
34673         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
34674                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34675                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
34676         }
34677         LDKUserConfig config_conv;
34678         config_conv.inner = untag_ptr(config);
34679         config_conv.is_owned = ptr_is_owned(config);
34680         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
34681         config_conv = UserConfig_clone(&config_conv);
34682         LDKChainParameters params_conv;
34683         params_conv.inner = untag_ptr(params);
34684         params_conv.is_owned = ptr_is_owned(params);
34685         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
34686         params_conv = ChainParameters_clone(&params_conv);
34687         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);
34688         uint64_t ret_ref = 0;
34689         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34690         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34691         return ret_ref;
34692 }
34693
34694 uint64_t  __attribute__((export_name("TS_ChannelManager_get_current_default_configuration"))) TS_ChannelManager_get_current_default_configuration(uint64_t this_arg) {
34695         LDKChannelManager this_arg_conv;
34696         this_arg_conv.inner = untag_ptr(this_arg);
34697         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34699         this_arg_conv.is_owned = false;
34700         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
34701         uint64_t ret_ref = 0;
34702         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34703         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34704         return ret_ref;
34705 }
34706
34707 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) {
34708         LDKChannelManager this_arg_conv;
34709         this_arg_conv.inner = untag_ptr(this_arg);
34710         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34712         this_arg_conv.is_owned = false;
34713         LDKPublicKey their_network_key_ref;
34714         CHECK(their_network_key->arr_len == 33);
34715         memcpy(their_network_key_ref.compressed_form, their_network_key->elems, 33); FREE(their_network_key);
34716         LDKU128 user_channel_id_ref;
34717         CHECK(user_channel_id->arr_len == 16);
34718         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
34719         LDKUserConfig override_config_conv;
34720         override_config_conv.inner = untag_ptr(override_config);
34721         override_config_conv.is_owned = ptr_is_owned(override_config);
34722         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
34723         override_config_conv = UserConfig_clone(&override_config_conv);
34724         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
34725         *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id_ref, override_config_conv);
34726         return tag_ptr(ret_conv, true);
34727 }
34728
34729 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_channels"))) TS_ChannelManager_list_channels(uint64_t this_arg) {
34730         LDKChannelManager this_arg_conv;
34731         this_arg_conv.inner = untag_ptr(this_arg);
34732         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34734         this_arg_conv.is_owned = false;
34735         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
34736         uint64_tArray ret_arr = NULL;
34737         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
34738         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
34739         for (size_t q = 0; q < ret_var.datalen; q++) {
34740                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
34741                 uint64_t ret_conv_16_ref = 0;
34742                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
34743                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
34744                 ret_arr_ptr[q] = ret_conv_16_ref;
34745         }
34746         
34747         FREE(ret_var.data);
34748         return ret_arr;
34749 }
34750
34751 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_usable_channels"))) TS_ChannelManager_list_usable_channels(uint64_t this_arg) {
34752         LDKChannelManager this_arg_conv;
34753         this_arg_conv.inner = untag_ptr(this_arg);
34754         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34756         this_arg_conv.is_owned = false;
34757         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
34758         uint64_tArray ret_arr = NULL;
34759         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
34760         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
34761         for (size_t q = 0; q < ret_var.datalen; q++) {
34762                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
34763                 uint64_t ret_conv_16_ref = 0;
34764                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
34765                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
34766                 ret_arr_ptr[q] = ret_conv_16_ref;
34767         }
34768         
34769         FREE(ret_var.data);
34770         return ret_arr;
34771 }
34772
34773 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) {
34774         LDKChannelManager this_arg_conv;
34775         this_arg_conv.inner = untag_ptr(this_arg);
34776         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34778         this_arg_conv.is_owned = false;
34779         LDKPublicKey counterparty_node_id_ref;
34780         CHECK(counterparty_node_id->arr_len == 33);
34781         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
34782         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels_with_counterparty(&this_arg_conv, counterparty_node_id_ref);
34783         uint64_tArray ret_arr = NULL;
34784         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
34785         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
34786         for (size_t q = 0; q < ret_var.datalen; q++) {
34787                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
34788                 uint64_t ret_conv_16_ref = 0;
34789                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
34790                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
34791                 ret_arr_ptr[q] = ret_conv_16_ref;
34792         }
34793         
34794         FREE(ret_var.data);
34795         return ret_arr;
34796 }
34797
34798 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_recent_payments"))) TS_ChannelManager_list_recent_payments(uint64_t this_arg) {
34799         LDKChannelManager this_arg_conv;
34800         this_arg_conv.inner = untag_ptr(this_arg);
34801         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34803         this_arg_conv.is_owned = false;
34804         LDKCVec_RecentPaymentDetailsZ ret_var = ChannelManager_list_recent_payments(&this_arg_conv);
34805         uint64_tArray ret_arr = NULL;
34806         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
34807         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
34808         for (size_t w = 0; w < ret_var.datalen; w++) {
34809                 LDKRecentPaymentDetails *ret_conv_22_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
34810                 *ret_conv_22_copy = ret_var.data[w];
34811                 uint64_t ret_conv_22_ref = tag_ptr(ret_conv_22_copy, true);
34812                 ret_arr_ptr[w] = ret_conv_22_ref;
34813         }
34814         
34815         FREE(ret_var.data);
34816         return ret_arr;
34817 }
34818
34819 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) {
34820         LDKChannelManager this_arg_conv;
34821         this_arg_conv.inner = untag_ptr(this_arg);
34822         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34824         this_arg_conv.is_owned = false;
34825         uint8_t channel_id_arr[32];
34826         CHECK(channel_id->arr_len == 32);
34827         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
34828         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
34829         LDKPublicKey counterparty_node_id_ref;
34830         CHECK(counterparty_node_id->arr_len == 33);
34831         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
34832         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
34833         *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
34834         return tag_ptr(ret_conv, true);
34835 }
34836
34837 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) {
34838         LDKChannelManager this_arg_conv;
34839         this_arg_conv.inner = untag_ptr(this_arg);
34840         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34842         this_arg_conv.is_owned = false;
34843         uint8_t channel_id_arr[32];
34844         CHECK(channel_id->arr_len == 32);
34845         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
34846         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
34847         LDKPublicKey counterparty_node_id_ref;
34848         CHECK(counterparty_node_id->arr_len == 33);
34849         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
34850         void* target_feerate_sats_per_1000_weight_ptr = untag_ptr(target_feerate_sats_per_1000_weight);
34851         CHECK_ACCESS(target_feerate_sats_per_1000_weight_ptr);
34852         LDKCOption_u32Z target_feerate_sats_per_1000_weight_conv = *(LDKCOption_u32Z*)(target_feerate_sats_per_1000_weight_ptr);
34853         target_feerate_sats_per_1000_weight_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(target_feerate_sats_per_1000_weight));
34854         LDKShutdownScript shutdown_script_conv;
34855         shutdown_script_conv.inner = untag_ptr(shutdown_script);
34856         shutdown_script_conv.is_owned = ptr_is_owned(shutdown_script);
34857         CHECK_INNER_FIELD_ACCESS_OR_NULL(shutdown_script_conv);
34858         shutdown_script_conv = ShutdownScript_clone(&shutdown_script_conv);
34859         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
34860         *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);
34861         return tag_ptr(ret_conv, true);
34862 }
34863
34864 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) {
34865         LDKChannelManager this_arg_conv;
34866         this_arg_conv.inner = untag_ptr(this_arg);
34867         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34869         this_arg_conv.is_owned = false;
34870         uint8_t channel_id_arr[32];
34871         CHECK(channel_id->arr_len == 32);
34872         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
34873         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
34874         LDKPublicKey counterparty_node_id_ref;
34875         CHECK(counterparty_node_id->arr_len == 33);
34876         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
34877         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
34878         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
34879         return tag_ptr(ret_conv, true);
34880 }
34881
34882 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) {
34883         LDKChannelManager this_arg_conv;
34884         this_arg_conv.inner = untag_ptr(this_arg);
34885         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34887         this_arg_conv.is_owned = false;
34888         uint8_t channel_id_arr[32];
34889         CHECK(channel_id->arr_len == 32);
34890         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
34891         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
34892         LDKPublicKey counterparty_node_id_ref;
34893         CHECK(counterparty_node_id->arr_len == 33);
34894         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
34895         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
34896         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
34897         return tag_ptr(ret_conv, true);
34898 }
34899
34900 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) {
34901         LDKChannelManager this_arg_conv;
34902         this_arg_conv.inner = untag_ptr(this_arg);
34903         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34905         this_arg_conv.is_owned = false;
34906         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
34907 }
34908
34909 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) {
34910         LDKChannelManager this_arg_conv;
34911         this_arg_conv.inner = untag_ptr(this_arg);
34912         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34914         this_arg_conv.is_owned = false;
34915         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
34916 }
34917
34918 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) {
34919         LDKChannelManager this_arg_conv;
34920         this_arg_conv.inner = untag_ptr(this_arg);
34921         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34923         this_arg_conv.is_owned = false;
34924         LDKRoute route_conv;
34925         route_conv.inner = untag_ptr(route);
34926         route_conv.is_owned = ptr_is_owned(route);
34927         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
34928         route_conv.is_owned = false;
34929         LDKThirtyTwoBytes payment_hash_ref;
34930         CHECK(payment_hash->arr_len == 32);
34931         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
34932         LDKRecipientOnionFields recipient_onion_conv;
34933         recipient_onion_conv.inner = untag_ptr(recipient_onion);
34934         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
34935         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
34936         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
34937         LDKThirtyTwoBytes payment_id_ref;
34938         CHECK(payment_id->arr_len == 32);
34939         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
34940         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
34941         *ret_conv = ChannelManager_send_payment_with_route(&this_arg_conv, &route_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref);
34942         return tag_ptr(ret_conv, true);
34943 }
34944
34945 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) {
34946         LDKChannelManager this_arg_conv;
34947         this_arg_conv.inner = untag_ptr(this_arg);
34948         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34950         this_arg_conv.is_owned = false;
34951         LDKThirtyTwoBytes payment_hash_ref;
34952         CHECK(payment_hash->arr_len == 32);
34953         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
34954         LDKRecipientOnionFields recipient_onion_conv;
34955         recipient_onion_conv.inner = untag_ptr(recipient_onion);
34956         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
34957         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
34958         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
34959         LDKThirtyTwoBytes payment_id_ref;
34960         CHECK(payment_id->arr_len == 32);
34961         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
34962         LDKRouteParameters route_params_conv;
34963         route_params_conv.inner = untag_ptr(route_params);
34964         route_params_conv.is_owned = ptr_is_owned(route_params);
34965         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
34966         route_params_conv = RouteParameters_clone(&route_params_conv);
34967         void* retry_strategy_ptr = untag_ptr(retry_strategy);
34968         CHECK_ACCESS(retry_strategy_ptr);
34969         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
34970         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
34971         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
34972         *ret_conv = ChannelManager_send_payment(&this_arg_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref, route_params_conv, retry_strategy_conv);
34973         return tag_ptr(ret_conv, true);
34974 }
34975
34976 void  __attribute__((export_name("TS_ChannelManager_abandon_payment"))) TS_ChannelManager_abandon_payment(uint64_t this_arg, int8_tArray payment_id) {
34977         LDKChannelManager this_arg_conv;
34978         this_arg_conv.inner = untag_ptr(this_arg);
34979         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34981         this_arg_conv.is_owned = false;
34982         LDKThirtyTwoBytes payment_id_ref;
34983         CHECK(payment_id->arr_len == 32);
34984         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
34985         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
34986 }
34987
34988 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) {
34989         LDKChannelManager this_arg_conv;
34990         this_arg_conv.inner = untag_ptr(this_arg);
34991         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34993         this_arg_conv.is_owned = false;
34994         LDKRoute route_conv;
34995         route_conv.inner = untag_ptr(route);
34996         route_conv.is_owned = ptr_is_owned(route);
34997         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
34998         route_conv.is_owned = false;
34999         void* payment_preimage_ptr = untag_ptr(payment_preimage);
35000         CHECK_ACCESS(payment_preimage_ptr);
35001         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
35002         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
35003         LDKRecipientOnionFields recipient_onion_conv;
35004         recipient_onion_conv.inner = untag_ptr(recipient_onion);
35005         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
35006         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
35007         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
35008         LDKThirtyTwoBytes payment_id_ref;
35009         CHECK(payment_id->arr_len == 32);
35010         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
35011         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
35012         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_conv, recipient_onion_conv, payment_id_ref);
35013         return tag_ptr(ret_conv, true);
35014 }
35015
35016 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) {
35017         LDKChannelManager this_arg_conv;
35018         this_arg_conv.inner = untag_ptr(this_arg);
35019         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35021         this_arg_conv.is_owned = false;
35022         void* payment_preimage_ptr = untag_ptr(payment_preimage);
35023         CHECK_ACCESS(payment_preimage_ptr);
35024         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
35025         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
35026         LDKRecipientOnionFields recipient_onion_conv;
35027         recipient_onion_conv.inner = untag_ptr(recipient_onion);
35028         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
35029         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
35030         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
35031         LDKThirtyTwoBytes payment_id_ref;
35032         CHECK(payment_id->arr_len == 32);
35033         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
35034         LDKRouteParameters route_params_conv;
35035         route_params_conv.inner = untag_ptr(route_params);
35036         route_params_conv.is_owned = ptr_is_owned(route_params);
35037         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
35038         route_params_conv = RouteParameters_clone(&route_params_conv);
35039         void* retry_strategy_ptr = untag_ptr(retry_strategy);
35040         CHECK_ACCESS(retry_strategy_ptr);
35041         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
35042         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
35043         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
35044         *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);
35045         return tag_ptr(ret_conv, true);
35046 }
35047
35048 uint64_t  __attribute__((export_name("TS_ChannelManager_send_probe"))) TS_ChannelManager_send_probe(uint64_t this_arg, uint64_t path) {
35049         LDKChannelManager this_arg_conv;
35050         this_arg_conv.inner = untag_ptr(this_arg);
35051         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35053         this_arg_conv.is_owned = false;
35054         LDKPath path_conv;
35055         path_conv.inner = untag_ptr(path);
35056         path_conv.is_owned = ptr_is_owned(path);
35057         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
35058         path_conv = Path_clone(&path_conv);
35059         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
35060         *ret_conv = ChannelManager_send_probe(&this_arg_conv, path_conv);
35061         return tag_ptr(ret_conv, true);
35062 }
35063
35064 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) {
35065         LDKChannelManager this_arg_conv;
35066         this_arg_conv.inner = untag_ptr(this_arg);
35067         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35069         this_arg_conv.is_owned = false;
35070         LDKPublicKey node_id_ref;
35071         CHECK(node_id->arr_len == 33);
35072         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
35073         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
35074         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
35075         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
35076         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
35077         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
35078         *ret_conv = ChannelManager_send_spontaneous_preflight_probes(&this_arg_conv, node_id_ref, amount_msat, final_cltv_expiry_delta, liquidity_limit_multiplier_conv);
35079         return tag_ptr(ret_conv, true);
35080 }
35081
35082 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) {
35083         LDKChannelManager this_arg_conv;
35084         this_arg_conv.inner = untag_ptr(this_arg);
35085         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35087         this_arg_conv.is_owned = false;
35088         LDKRouteParameters route_params_conv;
35089         route_params_conv.inner = untag_ptr(route_params);
35090         route_params_conv.is_owned = ptr_is_owned(route_params);
35091         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
35092         route_params_conv = RouteParameters_clone(&route_params_conv);
35093         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
35094         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
35095         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
35096         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
35097         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
35098         *ret_conv = ChannelManager_send_preflight_probes(&this_arg_conv, route_params_conv, liquidity_limit_multiplier_conv);
35099         return tag_ptr(ret_conv, true);
35100 }
35101
35102 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) {
35103         LDKChannelManager this_arg_conv;
35104         this_arg_conv.inner = untag_ptr(this_arg);
35105         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35107         this_arg_conv.is_owned = false;
35108         uint8_t temporary_channel_id_arr[32];
35109         CHECK(temporary_channel_id->arr_len == 32);
35110         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
35111         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
35112         LDKPublicKey counterparty_node_id_ref;
35113         CHECK(counterparty_node_id->arr_len == 33);
35114         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
35115         LDKTransaction funding_transaction_ref;
35116         funding_transaction_ref.datalen = funding_transaction->arr_len;
35117         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
35118         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
35119         funding_transaction_ref.data_is_owned = true;
35120         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35121         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
35122         return tag_ptr(ret_conv, true);
35123 }
35124
35125 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) {
35126         LDKChannelManager this_arg_conv;
35127         this_arg_conv.inner = untag_ptr(this_arg);
35128         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35130         this_arg_conv.is_owned = false;
35131         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ temporary_channels_constr;
35132         temporary_channels_constr.datalen = temporary_channels->arr_len;
35133         if (temporary_channels_constr.datalen > 0)
35134                 temporary_channels_constr.data = MALLOC(temporary_channels_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ Elements");
35135         else
35136                 temporary_channels_constr.data = NULL;
35137         uint64_t* temporary_channels_vals = temporary_channels->elems;
35138         for (size_t j = 0; j < temporary_channels_constr.datalen; j++) {
35139                 uint64_t temporary_channels_conv_35 = temporary_channels_vals[j];
35140                 void* temporary_channels_conv_35_ptr = untag_ptr(temporary_channels_conv_35);
35141                 CHECK_ACCESS(temporary_channels_conv_35_ptr);
35142                 LDKC2Tuple_ThirtyTwoBytesPublicKeyZ temporary_channels_conv_35_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(temporary_channels_conv_35_ptr);
35143                 temporary_channels_conv_35_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone((LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(temporary_channels_conv_35));
35144                 temporary_channels_constr.data[j] = temporary_channels_conv_35_conv;
35145         }
35146         FREE(temporary_channels);
35147         LDKTransaction funding_transaction_ref;
35148         funding_transaction_ref.datalen = funding_transaction->arr_len;
35149         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
35150         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
35151         funding_transaction_ref.data_is_owned = true;
35152         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35153         *ret_conv = ChannelManager_batch_funding_transaction_generated(&this_arg_conv, temporary_channels_constr, funding_transaction_ref);
35154         return tag_ptr(ret_conv, true);
35155 }
35156
35157 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) {
35158         LDKChannelManager this_arg_conv;
35159         this_arg_conv.inner = untag_ptr(this_arg);
35160         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35162         this_arg_conv.is_owned = false;
35163         LDKPublicKey counterparty_node_id_ref;
35164         CHECK(counterparty_node_id->arr_len == 33);
35165         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
35166         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
35167         channel_ids_constr.datalen = channel_ids->arr_len;
35168         if (channel_ids_constr.datalen > 0)
35169                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
35170         else
35171                 channel_ids_constr.data = NULL;
35172         int8_tArray* channel_ids_vals = (void*) channel_ids->elems;
35173         for (size_t m = 0; m < channel_ids_constr.datalen; m++) {
35174                 int8_tArray channel_ids_conv_12 = channel_ids_vals[m];
35175                 LDKThirtyTwoBytes channel_ids_conv_12_ref;
35176                 CHECK(channel_ids_conv_12->arr_len == 32);
35177                 memcpy(channel_ids_conv_12_ref.data, channel_ids_conv_12->elems, 32); FREE(channel_ids_conv_12);
35178                 channel_ids_constr.data[m] = channel_ids_conv_12_ref;
35179         }
35180         FREE(channel_ids);
35181         LDKChannelConfigUpdate config_update_conv;
35182         config_update_conv.inner = untag_ptr(config_update);
35183         config_update_conv.is_owned = ptr_is_owned(config_update);
35184         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_update_conv);
35185         config_update_conv.is_owned = false;
35186         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35187         *ret_conv = ChannelManager_update_partial_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_update_conv);
35188         return tag_ptr(ret_conv, true);
35189 }
35190
35191 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) {
35192         LDKChannelManager this_arg_conv;
35193         this_arg_conv.inner = untag_ptr(this_arg);
35194         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35196         this_arg_conv.is_owned = false;
35197         LDKPublicKey counterparty_node_id_ref;
35198         CHECK(counterparty_node_id->arr_len == 33);
35199         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
35200         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
35201         channel_ids_constr.datalen = channel_ids->arr_len;
35202         if (channel_ids_constr.datalen > 0)
35203                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
35204         else
35205                 channel_ids_constr.data = NULL;
35206         int8_tArray* channel_ids_vals = (void*) channel_ids->elems;
35207         for (size_t m = 0; m < channel_ids_constr.datalen; m++) {
35208                 int8_tArray channel_ids_conv_12 = channel_ids_vals[m];
35209                 LDKThirtyTwoBytes channel_ids_conv_12_ref;
35210                 CHECK(channel_ids_conv_12->arr_len == 32);
35211                 memcpy(channel_ids_conv_12_ref.data, channel_ids_conv_12->elems, 32); FREE(channel_ids_conv_12);
35212                 channel_ids_constr.data[m] = channel_ids_conv_12_ref;
35213         }
35214         FREE(channel_ids);
35215         LDKChannelConfig config_conv;
35216         config_conv.inner = untag_ptr(config);
35217         config_conv.is_owned = ptr_is_owned(config);
35218         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
35219         config_conv.is_owned = false;
35220         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35221         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
35222         return tag_ptr(ret_conv, true);
35223 }
35224
35225 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) {
35226         LDKChannelManager this_arg_conv;
35227         this_arg_conv.inner = untag_ptr(this_arg);
35228         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35230         this_arg_conv.is_owned = false;
35231         LDKThirtyTwoBytes intercept_id_ref;
35232         CHECK(intercept_id->arr_len == 32);
35233         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
35234         uint8_t next_hop_channel_id_arr[32];
35235         CHECK(next_hop_channel_id->arr_len == 32);
35236         memcpy(next_hop_channel_id_arr, next_hop_channel_id->elems, 32); FREE(next_hop_channel_id);
35237         uint8_t (*next_hop_channel_id_ref)[32] = &next_hop_channel_id_arr;
35238         LDKPublicKey next_node_id_ref;
35239         CHECK(next_node_id->arr_len == 33);
35240         memcpy(next_node_id_ref.compressed_form, next_node_id->elems, 33); FREE(next_node_id);
35241         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35242         *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);
35243         return tag_ptr(ret_conv, true);
35244 }
35245
35246 uint64_t  __attribute__((export_name("TS_ChannelManager_fail_intercepted_htlc"))) TS_ChannelManager_fail_intercepted_htlc(uint64_t this_arg, int8_tArray intercept_id) {
35247         LDKChannelManager this_arg_conv;
35248         this_arg_conv.inner = untag_ptr(this_arg);
35249         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35251         this_arg_conv.is_owned = false;
35252         LDKThirtyTwoBytes intercept_id_ref;
35253         CHECK(intercept_id->arr_len == 32);
35254         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
35255         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35256         *ret_conv = ChannelManager_fail_intercepted_htlc(&this_arg_conv, intercept_id_ref);
35257         return tag_ptr(ret_conv, true);
35258 }
35259
35260 void  __attribute__((export_name("TS_ChannelManager_process_pending_htlc_forwards"))) TS_ChannelManager_process_pending_htlc_forwards(uint64_t this_arg) {
35261         LDKChannelManager this_arg_conv;
35262         this_arg_conv.inner = untag_ptr(this_arg);
35263         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35265         this_arg_conv.is_owned = false;
35266         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
35267 }
35268
35269 void  __attribute__((export_name("TS_ChannelManager_timer_tick_occurred"))) TS_ChannelManager_timer_tick_occurred(uint64_t this_arg) {
35270         LDKChannelManager this_arg_conv;
35271         this_arg_conv.inner = untag_ptr(this_arg);
35272         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35274         this_arg_conv.is_owned = false;
35275         ChannelManager_timer_tick_occurred(&this_arg_conv);
35276 }
35277
35278 void  __attribute__((export_name("TS_ChannelManager_fail_htlc_backwards"))) TS_ChannelManager_fail_htlc_backwards(uint64_t this_arg, int8_tArray payment_hash) {
35279         LDKChannelManager this_arg_conv;
35280         this_arg_conv.inner = untag_ptr(this_arg);
35281         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35283         this_arg_conv.is_owned = false;
35284         uint8_t payment_hash_arr[32];
35285         CHECK(payment_hash->arr_len == 32);
35286         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
35287         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
35288         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
35289 }
35290
35291 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) {
35292         LDKChannelManager this_arg_conv;
35293         this_arg_conv.inner = untag_ptr(this_arg);
35294         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35296         this_arg_conv.is_owned = false;
35297         uint8_t payment_hash_arr[32];
35298         CHECK(payment_hash->arr_len == 32);
35299         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
35300         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
35301         void* failure_code_ptr = untag_ptr(failure_code);
35302         CHECK_ACCESS(failure_code_ptr);
35303         LDKFailureCode failure_code_conv = *(LDKFailureCode*)(failure_code_ptr);
35304         failure_code_conv = FailureCode_clone((LDKFailureCode*)untag_ptr(failure_code));
35305         ChannelManager_fail_htlc_backwards_with_reason(&this_arg_conv, payment_hash_ref, failure_code_conv);
35306 }
35307
35308 void  __attribute__((export_name("TS_ChannelManager_claim_funds"))) TS_ChannelManager_claim_funds(uint64_t this_arg, int8_tArray payment_preimage) {
35309         LDKChannelManager this_arg_conv;
35310         this_arg_conv.inner = untag_ptr(this_arg);
35311         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35313         this_arg_conv.is_owned = false;
35314         LDKThirtyTwoBytes payment_preimage_ref;
35315         CHECK(payment_preimage->arr_len == 32);
35316         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
35317         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
35318 }
35319
35320 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) {
35321         LDKChannelManager this_arg_conv;
35322         this_arg_conv.inner = untag_ptr(this_arg);
35323         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35325         this_arg_conv.is_owned = false;
35326         LDKThirtyTwoBytes payment_preimage_ref;
35327         CHECK(payment_preimage->arr_len == 32);
35328         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
35329         ChannelManager_claim_funds_with_known_custom_tlvs(&this_arg_conv, payment_preimage_ref);
35330 }
35331
35332 int8_tArray  __attribute__((export_name("TS_ChannelManager_get_our_node_id"))) TS_ChannelManager_get_our_node_id(uint64_t this_arg) {
35333         LDKChannelManager this_arg_conv;
35334         this_arg_conv.inner = untag_ptr(this_arg);
35335         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35337         this_arg_conv.is_owned = false;
35338         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35339         memcpy(ret_arr->elems, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
35340         return ret_arr;
35341 }
35342
35343 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) {
35344         LDKChannelManager this_arg_conv;
35345         this_arg_conv.inner = untag_ptr(this_arg);
35346         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35348         this_arg_conv.is_owned = false;
35349         uint8_t temporary_channel_id_arr[32];
35350         CHECK(temporary_channel_id->arr_len == 32);
35351         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
35352         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
35353         LDKPublicKey counterparty_node_id_ref;
35354         CHECK(counterparty_node_id->arr_len == 33);
35355         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
35356         LDKU128 user_channel_id_ref;
35357         CHECK(user_channel_id->arr_len == 16);
35358         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
35359         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35360         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id_ref);
35361         return tag_ptr(ret_conv, true);
35362 }
35363
35364 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) {
35365         LDKChannelManager this_arg_conv;
35366         this_arg_conv.inner = untag_ptr(this_arg);
35367         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35369         this_arg_conv.is_owned = false;
35370         uint8_t temporary_channel_id_arr[32];
35371         CHECK(temporary_channel_id->arr_len == 32);
35372         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
35373         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
35374         LDKPublicKey counterparty_node_id_ref;
35375         CHECK(counterparty_node_id->arr_len == 33);
35376         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
35377         LDKU128 user_channel_id_ref;
35378         CHECK(user_channel_id->arr_len == 16);
35379         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
35380         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35381         *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);
35382         return tag_ptr(ret_conv, true);
35383 }
35384
35385 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) {
35386         LDKChannelManager this_arg_conv;
35387         this_arg_conv.inner = untag_ptr(this_arg);
35388         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35390         this_arg_conv.is_owned = false;
35391         void* min_value_msat_ptr = untag_ptr(min_value_msat);
35392         CHECK_ACCESS(min_value_msat_ptr);
35393         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
35394         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
35395         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
35396         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
35397         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
35398         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
35399         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
35400         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
35401         return tag_ptr(ret_conv, true);
35402 }
35403
35404 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) {
35405         LDKChannelManager this_arg_conv;
35406         this_arg_conv.inner = untag_ptr(this_arg);
35407         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35409         this_arg_conv.is_owned = false;
35410         LDKThirtyTwoBytes payment_hash_ref;
35411         CHECK(payment_hash->arr_len == 32);
35412         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
35413         void* min_value_msat_ptr = untag_ptr(min_value_msat);
35414         CHECK_ACCESS(min_value_msat_ptr);
35415         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
35416         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
35417         void* min_final_cltv_expiry_ptr = untag_ptr(min_final_cltv_expiry);
35418         CHECK_ACCESS(min_final_cltv_expiry_ptr);
35419         LDKCOption_u16Z min_final_cltv_expiry_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_ptr);
35420         min_final_cltv_expiry_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry));
35421         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
35422         *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);
35423         return tag_ptr(ret_conv, true);
35424 }
35425
35426 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) {
35427         LDKChannelManager this_arg_conv;
35428         this_arg_conv.inner = untag_ptr(this_arg);
35429         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35431         this_arg_conv.is_owned = false;
35432         LDKThirtyTwoBytes payment_hash_ref;
35433         CHECK(payment_hash->arr_len == 32);
35434         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
35435         LDKThirtyTwoBytes payment_secret_ref;
35436         CHECK(payment_secret->arr_len == 32);
35437         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
35438         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
35439         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
35440         return tag_ptr(ret_conv, true);
35441 }
35442
35443 int64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_scid"))) TS_ChannelManager_get_phantom_scid(uint64_t this_arg) {
35444         LDKChannelManager this_arg_conv;
35445         this_arg_conv.inner = untag_ptr(this_arg);
35446         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35448         this_arg_conv.is_owned = false;
35449         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
35450         return ret_conv;
35451 }
35452
35453 uint64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_route_hints"))) TS_ChannelManager_get_phantom_route_hints(uint64_t this_arg) {
35454         LDKChannelManager this_arg_conv;
35455         this_arg_conv.inner = untag_ptr(this_arg);
35456         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35458         this_arg_conv.is_owned = false;
35459         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
35460         uint64_t ret_ref = 0;
35461         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35462         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35463         return ret_ref;
35464 }
35465
35466 int64_t  __attribute__((export_name("TS_ChannelManager_get_intercept_scid"))) TS_ChannelManager_get_intercept_scid(uint64_t this_arg) {
35467         LDKChannelManager this_arg_conv;
35468         this_arg_conv.inner = untag_ptr(this_arg);
35469         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35471         this_arg_conv.is_owned = false;
35472         int64_t ret_conv = ChannelManager_get_intercept_scid(&this_arg_conv);
35473         return ret_conv;
35474 }
35475
35476 uint64_t  __attribute__((export_name("TS_ChannelManager_compute_inflight_htlcs"))) TS_ChannelManager_compute_inflight_htlcs(uint64_t this_arg) {
35477         LDKChannelManager this_arg_conv;
35478         this_arg_conv.inner = untag_ptr(this_arg);
35479         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35481         this_arg_conv.is_owned = false;
35482         LDKInFlightHtlcs ret_var = ChannelManager_compute_inflight_htlcs(&this_arg_conv);
35483         uint64_t ret_ref = 0;
35484         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35485         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35486         return ret_ref;
35487 }
35488
35489 uint64_t  __attribute__((export_name("TS_ChannelManager_as_MessageSendEventsProvider"))) TS_ChannelManager_as_MessageSendEventsProvider(uint64_t this_arg) {
35490         LDKChannelManager this_arg_conv;
35491         this_arg_conv.inner = untag_ptr(this_arg);
35492         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35494         this_arg_conv.is_owned = false;
35495         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
35496         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
35497         return tag_ptr(ret_ret, true);
35498 }
35499
35500 uint64_t  __attribute__((export_name("TS_ChannelManager_as_EventsProvider"))) TS_ChannelManager_as_EventsProvider(uint64_t this_arg) {
35501         LDKChannelManager this_arg_conv;
35502         this_arg_conv.inner = untag_ptr(this_arg);
35503         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35505         this_arg_conv.is_owned = false;
35506         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
35507         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
35508         return tag_ptr(ret_ret, true);
35509 }
35510
35511 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Listen"))) TS_ChannelManager_as_Listen(uint64_t this_arg) {
35512         LDKChannelManager this_arg_conv;
35513         this_arg_conv.inner = untag_ptr(this_arg);
35514         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35516         this_arg_conv.is_owned = false;
35517         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
35518         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
35519         return tag_ptr(ret_ret, true);
35520 }
35521
35522 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Confirm"))) TS_ChannelManager_as_Confirm(uint64_t this_arg) {
35523         LDKChannelManager this_arg_conv;
35524         this_arg_conv.inner = untag_ptr(this_arg);
35525         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35527         this_arg_conv.is_owned = false;
35528         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
35529         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
35530         return tag_ptr(ret_ret, true);
35531 }
35532
35533 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) {
35534         LDKChannelManager this_arg_conv;
35535         this_arg_conv.inner = untag_ptr(this_arg);
35536         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35538         this_arg_conv.is_owned = false;
35539         LDKFuture ret_var = ChannelManager_get_event_or_persistence_needed_future(&this_arg_conv);
35540         uint64_t ret_ref = 0;
35541         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35542         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35543         return ret_ref;
35544 }
35545
35546 jboolean  __attribute__((export_name("TS_ChannelManager_get_and_clear_needs_persistence"))) TS_ChannelManager_get_and_clear_needs_persistence(uint64_t this_arg) {
35547         LDKChannelManager this_arg_conv;
35548         this_arg_conv.inner = untag_ptr(this_arg);
35549         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35551         this_arg_conv.is_owned = false;
35552         jboolean ret_conv = ChannelManager_get_and_clear_needs_persistence(&this_arg_conv);
35553         return ret_conv;
35554 }
35555
35556 uint64_t  __attribute__((export_name("TS_ChannelManager_current_best_block"))) TS_ChannelManager_current_best_block(uint64_t this_arg) {
35557         LDKChannelManager this_arg_conv;
35558         this_arg_conv.inner = untag_ptr(this_arg);
35559         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35561         this_arg_conv.is_owned = false;
35562         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
35563         uint64_t ret_ref = 0;
35564         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35565         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35566         return ret_ref;
35567 }
35568
35569 uint64_t  __attribute__((export_name("TS_ChannelManager_node_features"))) TS_ChannelManager_node_features(uint64_t this_arg) {
35570         LDKChannelManager this_arg_conv;
35571         this_arg_conv.inner = untag_ptr(this_arg);
35572         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35574         this_arg_conv.is_owned = false;
35575         LDKNodeFeatures ret_var = ChannelManager_node_features(&this_arg_conv);
35576         uint64_t ret_ref = 0;
35577         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35578         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35579         return ret_ref;
35580 }
35581
35582 uint64_t  __attribute__((export_name("TS_ChannelManager_channel_features"))) TS_ChannelManager_channel_features(uint64_t this_arg) {
35583         LDKChannelManager this_arg_conv;
35584         this_arg_conv.inner = untag_ptr(this_arg);
35585         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35587         this_arg_conv.is_owned = false;
35588         LDKChannelFeatures ret_var = ChannelManager_channel_features(&this_arg_conv);
35589         uint64_t ret_ref = 0;
35590         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35591         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35592         return ret_ref;
35593 }
35594
35595 uint64_t  __attribute__((export_name("TS_ChannelManager_channel_type_features"))) TS_ChannelManager_channel_type_features(uint64_t this_arg) {
35596         LDKChannelManager this_arg_conv;
35597         this_arg_conv.inner = untag_ptr(this_arg);
35598         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35600         this_arg_conv.is_owned = false;
35601         LDKChannelTypeFeatures ret_var = ChannelManager_channel_type_features(&this_arg_conv);
35602         uint64_t ret_ref = 0;
35603         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35604         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35605         return ret_ref;
35606 }
35607
35608 uint64_t  __attribute__((export_name("TS_ChannelManager_init_features"))) TS_ChannelManager_init_features(uint64_t this_arg) {
35609         LDKChannelManager this_arg_conv;
35610         this_arg_conv.inner = untag_ptr(this_arg);
35611         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35613         this_arg_conv.is_owned = false;
35614         LDKInitFeatures ret_var = ChannelManager_init_features(&this_arg_conv);
35615         uint64_t ret_ref = 0;
35616         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35617         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35618         return ret_ref;
35619 }
35620
35621 uint64_t  __attribute__((export_name("TS_ChannelManager_as_ChannelMessageHandler"))) TS_ChannelManager_as_ChannelMessageHandler(uint64_t this_arg) {
35622         LDKChannelManager this_arg_conv;
35623         this_arg_conv.inner = untag_ptr(this_arg);
35624         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35626         this_arg_conv.is_owned = false;
35627         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
35628         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
35629         return tag_ptr(ret_ret, true);
35630 }
35631
35632 uint64_t  __attribute__((export_name("TS_provided_init_features"))) TS_provided_init_features(uint64_t config) {
35633         LDKUserConfig config_conv;
35634         config_conv.inner = untag_ptr(config);
35635         config_conv.is_owned = ptr_is_owned(config);
35636         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
35637         config_conv.is_owned = false;
35638         LDKInitFeatures ret_var = provided_init_features(&config_conv);
35639         uint64_t ret_ref = 0;
35640         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35641         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35642         return ret_ref;
35643 }
35644
35645 int8_tArray  __attribute__((export_name("TS_CounterpartyForwardingInfo_write"))) TS_CounterpartyForwardingInfo_write(uint64_t obj) {
35646         LDKCounterpartyForwardingInfo obj_conv;
35647         obj_conv.inner = untag_ptr(obj);
35648         obj_conv.is_owned = ptr_is_owned(obj);
35649         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35650         obj_conv.is_owned = false;
35651         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
35652         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35653         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35654         CVec_u8Z_free(ret_var);
35655         return ret_arr;
35656 }
35657
35658 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_read"))) TS_CounterpartyForwardingInfo_read(int8_tArray ser) {
35659         LDKu8slice ser_ref;
35660         ser_ref.datalen = ser->arr_len;
35661         ser_ref.data = ser->elems;
35662         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
35663         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
35664         FREE(ser);
35665         return tag_ptr(ret_conv, true);
35666 }
35667
35668 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_write"))) TS_ChannelCounterparty_write(uint64_t obj) {
35669         LDKChannelCounterparty obj_conv;
35670         obj_conv.inner = untag_ptr(obj);
35671         obj_conv.is_owned = ptr_is_owned(obj);
35672         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35673         obj_conv.is_owned = false;
35674         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
35675         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35676         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35677         CVec_u8Z_free(ret_var);
35678         return ret_arr;
35679 }
35680
35681 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_read"))) TS_ChannelCounterparty_read(int8_tArray ser) {
35682         LDKu8slice ser_ref;
35683         ser_ref.datalen = ser->arr_len;
35684         ser_ref.data = ser->elems;
35685         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
35686         *ret_conv = ChannelCounterparty_read(ser_ref);
35687         FREE(ser);
35688         return tag_ptr(ret_conv, true);
35689 }
35690
35691 int8_tArray  __attribute__((export_name("TS_ChannelDetails_write"))) TS_ChannelDetails_write(uint64_t obj) {
35692         LDKChannelDetails obj_conv;
35693         obj_conv.inner = untag_ptr(obj);
35694         obj_conv.is_owned = ptr_is_owned(obj);
35695         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35696         obj_conv.is_owned = false;
35697         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
35698         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35699         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35700         CVec_u8Z_free(ret_var);
35701         return ret_arr;
35702 }
35703
35704 uint64_t  __attribute__((export_name("TS_ChannelDetails_read"))) TS_ChannelDetails_read(int8_tArray ser) {
35705         LDKu8slice ser_ref;
35706         ser_ref.datalen = ser->arr_len;
35707         ser_ref.data = ser->elems;
35708         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
35709         *ret_conv = ChannelDetails_read(ser_ref);
35710         FREE(ser);
35711         return tag_ptr(ret_conv, true);
35712 }
35713
35714 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_write"))) TS_PhantomRouteHints_write(uint64_t obj) {
35715         LDKPhantomRouteHints obj_conv;
35716         obj_conv.inner = untag_ptr(obj);
35717         obj_conv.is_owned = ptr_is_owned(obj);
35718         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35719         obj_conv.is_owned = false;
35720         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
35721         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35722         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35723         CVec_u8Z_free(ret_var);
35724         return ret_arr;
35725 }
35726
35727 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_read"))) TS_PhantomRouteHints_read(int8_tArray ser) {
35728         LDKu8slice ser_ref;
35729         ser_ref.datalen = ser->arr_len;
35730         ser_ref.data = ser->elems;
35731         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
35732         *ret_conv = PhantomRouteHints_read(ser_ref);
35733         FREE(ser);
35734         return tag_ptr(ret_conv, true);
35735 }
35736
35737 int8_tArray  __attribute__((export_name("TS_ChannelManager_write"))) TS_ChannelManager_write(uint64_t obj) {
35738         LDKChannelManager obj_conv;
35739         obj_conv.inner = untag_ptr(obj);
35740         obj_conv.is_owned = ptr_is_owned(obj);
35741         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35742         obj_conv.is_owned = false;
35743         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
35744         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35745         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35746         CVec_u8Z_free(ret_var);
35747         return ret_arr;
35748 }
35749
35750 int8_tArray  __attribute__((export_name("TS_ChannelShutdownState_write"))) TS_ChannelShutdownState_write(uint64_t obj) {
35751         LDKChannelShutdownState* obj_conv = (LDKChannelShutdownState*)untag_ptr(obj);
35752         LDKCVec_u8Z ret_var = ChannelShutdownState_write(obj_conv);
35753         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35754         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35755         CVec_u8Z_free(ret_var);
35756         return ret_arr;
35757 }
35758
35759 uint64_t  __attribute__((export_name("TS_ChannelShutdownState_read"))) TS_ChannelShutdownState_read(int8_tArray ser) {
35760         LDKu8slice ser_ref;
35761         ser_ref.datalen = ser->arr_len;
35762         ser_ref.data = ser->elems;
35763         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
35764         *ret_conv = ChannelShutdownState_read(ser_ref);
35765         FREE(ser);
35766         return tag_ptr(ret_conv, true);
35767 }
35768
35769 void  __attribute__((export_name("TS_ChannelManagerReadArgs_free"))) TS_ChannelManagerReadArgs_free(uint64_t this_obj) {
35770         LDKChannelManagerReadArgs this_obj_conv;
35771         this_obj_conv.inner = untag_ptr(this_obj);
35772         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35774         ChannelManagerReadArgs_free(this_obj_conv);
35775 }
35776
35777 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_entropy_source"))) TS_ChannelManagerReadArgs_get_entropy_source(uint64_t this_ptr) {
35778         LDKChannelManagerReadArgs this_ptr_conv;
35779         this_ptr_conv.inner = untag_ptr(this_ptr);
35780         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35782         this_ptr_conv.is_owned = false;
35783         // WARNING: This object doesn't live past this scope, needs clone!
35784         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_entropy_source(&this_ptr_conv), false);
35785         return ret_ret;
35786 }
35787
35788 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_entropy_source"))) TS_ChannelManagerReadArgs_set_entropy_source(uint64_t this_ptr, uint64_t val) {
35789         LDKChannelManagerReadArgs this_ptr_conv;
35790         this_ptr_conv.inner = untag_ptr(this_ptr);
35791         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35793         this_ptr_conv.is_owned = false;
35794         void* val_ptr = untag_ptr(val);
35795         CHECK_ACCESS(val_ptr);
35796         LDKEntropySource val_conv = *(LDKEntropySource*)(val_ptr);
35797         if (val_conv.free == LDKEntropySource_JCalls_free) {
35798                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35799                 LDKEntropySource_JCalls_cloned(&val_conv);
35800         }
35801         ChannelManagerReadArgs_set_entropy_source(&this_ptr_conv, val_conv);
35802 }
35803
35804 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_node_signer"))) TS_ChannelManagerReadArgs_get_node_signer(uint64_t this_ptr) {
35805         LDKChannelManagerReadArgs this_ptr_conv;
35806         this_ptr_conv.inner = untag_ptr(this_ptr);
35807         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35809         this_ptr_conv.is_owned = false;
35810         // WARNING: This object doesn't live past this scope, needs clone!
35811         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_node_signer(&this_ptr_conv), false);
35812         return ret_ret;
35813 }
35814
35815 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_node_signer"))) TS_ChannelManagerReadArgs_set_node_signer(uint64_t this_ptr, uint64_t val) {
35816         LDKChannelManagerReadArgs this_ptr_conv;
35817         this_ptr_conv.inner = untag_ptr(this_ptr);
35818         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35820         this_ptr_conv.is_owned = false;
35821         void* val_ptr = untag_ptr(val);
35822         CHECK_ACCESS(val_ptr);
35823         LDKNodeSigner val_conv = *(LDKNodeSigner*)(val_ptr);
35824         if (val_conv.free == LDKNodeSigner_JCalls_free) {
35825                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35826                 LDKNodeSigner_JCalls_cloned(&val_conv);
35827         }
35828         ChannelManagerReadArgs_set_node_signer(&this_ptr_conv, val_conv);
35829 }
35830
35831 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_signer_provider"))) TS_ChannelManagerReadArgs_get_signer_provider(uint64_t this_ptr) {
35832         LDKChannelManagerReadArgs this_ptr_conv;
35833         this_ptr_conv.inner = untag_ptr(this_ptr);
35834         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35836         this_ptr_conv.is_owned = false;
35837         // WARNING: This object doesn't live past this scope, needs clone!
35838         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_signer_provider(&this_ptr_conv), false);
35839         return ret_ret;
35840 }
35841
35842 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_signer_provider"))) TS_ChannelManagerReadArgs_set_signer_provider(uint64_t this_ptr, uint64_t val) {
35843         LDKChannelManagerReadArgs this_ptr_conv;
35844         this_ptr_conv.inner = untag_ptr(this_ptr);
35845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35847         this_ptr_conv.is_owned = false;
35848         void* val_ptr = untag_ptr(val);
35849         CHECK_ACCESS(val_ptr);
35850         LDKSignerProvider val_conv = *(LDKSignerProvider*)(val_ptr);
35851         if (val_conv.free == LDKSignerProvider_JCalls_free) {
35852                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35853                 LDKSignerProvider_JCalls_cloned(&val_conv);
35854         }
35855         ChannelManagerReadArgs_set_signer_provider(&this_ptr_conv, val_conv);
35856 }
35857
35858 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_fee_estimator"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint64_t this_ptr) {
35859         LDKChannelManagerReadArgs this_ptr_conv;
35860         this_ptr_conv.inner = untag_ptr(this_ptr);
35861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35863         this_ptr_conv.is_owned = false;
35864         // WARNING: This object doesn't live past this scope, needs clone!
35865         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
35866         return ret_ret;
35867 }
35868
35869 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_fee_estimator"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint64_t this_ptr, uint64_t val) {
35870         LDKChannelManagerReadArgs this_ptr_conv;
35871         this_ptr_conv.inner = untag_ptr(this_ptr);
35872         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35874         this_ptr_conv.is_owned = false;
35875         void* val_ptr = untag_ptr(val);
35876         CHECK_ACCESS(val_ptr);
35877         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
35878         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
35879                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35880                 LDKFeeEstimator_JCalls_cloned(&val_conv);
35881         }
35882         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
35883 }
35884
35885 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_chain_monitor"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint64_t this_ptr) {
35886         LDKChannelManagerReadArgs this_ptr_conv;
35887         this_ptr_conv.inner = untag_ptr(this_ptr);
35888         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35890         this_ptr_conv.is_owned = false;
35891         // WARNING: This object doesn't live past this scope, needs clone!
35892         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
35893         return ret_ret;
35894 }
35895
35896 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_chain_monitor"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint64_t this_ptr, uint64_t val) {
35897         LDKChannelManagerReadArgs this_ptr_conv;
35898         this_ptr_conv.inner = untag_ptr(this_ptr);
35899         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35901         this_ptr_conv.is_owned = false;
35902         void* val_ptr = untag_ptr(val);
35903         CHECK_ACCESS(val_ptr);
35904         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
35905         if (val_conv.free == LDKWatch_JCalls_free) {
35906                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35907                 LDKWatch_JCalls_cloned(&val_conv);
35908         }
35909         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
35910 }
35911
35912 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_tx_broadcaster"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint64_t this_ptr) {
35913         LDKChannelManagerReadArgs this_ptr_conv;
35914         this_ptr_conv.inner = untag_ptr(this_ptr);
35915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35917         this_ptr_conv.is_owned = false;
35918         // WARNING: This object doesn't live past this scope, needs clone!
35919         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
35920         return ret_ret;
35921 }
35922
35923 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_tx_broadcaster"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint64_t this_ptr, uint64_t val) {
35924         LDKChannelManagerReadArgs this_ptr_conv;
35925         this_ptr_conv.inner = untag_ptr(this_ptr);
35926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35928         this_ptr_conv.is_owned = false;
35929         void* val_ptr = untag_ptr(val);
35930         CHECK_ACCESS(val_ptr);
35931         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
35932         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
35933                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35934                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
35935         }
35936         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
35937 }
35938
35939 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_router"))) TS_ChannelManagerReadArgs_get_router(uint64_t this_ptr) {
35940         LDKChannelManagerReadArgs this_ptr_conv;
35941         this_ptr_conv.inner = untag_ptr(this_ptr);
35942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35944         this_ptr_conv.is_owned = false;
35945         // WARNING: This object doesn't live past this scope, needs clone!
35946         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_router(&this_ptr_conv), false);
35947         return ret_ret;
35948 }
35949
35950 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_router"))) TS_ChannelManagerReadArgs_set_router(uint64_t this_ptr, uint64_t val) {
35951         LDKChannelManagerReadArgs this_ptr_conv;
35952         this_ptr_conv.inner = untag_ptr(this_ptr);
35953         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35955         this_ptr_conv.is_owned = false;
35956         void* val_ptr = untag_ptr(val);
35957         CHECK_ACCESS(val_ptr);
35958         LDKRouter val_conv = *(LDKRouter*)(val_ptr);
35959         if (val_conv.free == LDKRouter_JCalls_free) {
35960                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35961                 LDKRouter_JCalls_cloned(&val_conv);
35962         }
35963         ChannelManagerReadArgs_set_router(&this_ptr_conv, val_conv);
35964 }
35965
35966 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_logger"))) TS_ChannelManagerReadArgs_get_logger(uint64_t this_ptr) {
35967         LDKChannelManagerReadArgs this_ptr_conv;
35968         this_ptr_conv.inner = untag_ptr(this_ptr);
35969         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35971         this_ptr_conv.is_owned = false;
35972         // WARNING: This object doesn't live past this scope, needs clone!
35973         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
35974         return ret_ret;
35975 }
35976
35977 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_logger"))) TS_ChannelManagerReadArgs_set_logger(uint64_t this_ptr, uint64_t val) {
35978         LDKChannelManagerReadArgs this_ptr_conv;
35979         this_ptr_conv.inner = untag_ptr(this_ptr);
35980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35982         this_ptr_conv.is_owned = false;
35983         void* val_ptr = untag_ptr(val);
35984         CHECK_ACCESS(val_ptr);
35985         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
35986         if (val_conv.free == LDKLogger_JCalls_free) {
35987                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35988                 LDKLogger_JCalls_cloned(&val_conv);
35989         }
35990         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
35991 }
35992
35993 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_default_config"))) TS_ChannelManagerReadArgs_get_default_config(uint64_t this_ptr) {
35994         LDKChannelManagerReadArgs this_ptr_conv;
35995         this_ptr_conv.inner = untag_ptr(this_ptr);
35996         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35998         this_ptr_conv.is_owned = false;
35999         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
36000         uint64_t ret_ref = 0;
36001         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36002         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36003         return ret_ref;
36004 }
36005
36006 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_default_config"))) TS_ChannelManagerReadArgs_set_default_config(uint64_t this_ptr, uint64_t val) {
36007         LDKChannelManagerReadArgs this_ptr_conv;
36008         this_ptr_conv.inner = untag_ptr(this_ptr);
36009         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36011         this_ptr_conv.is_owned = false;
36012         LDKUserConfig val_conv;
36013         val_conv.inner = untag_ptr(val);
36014         val_conv.is_owned = ptr_is_owned(val);
36015         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36016         val_conv = UserConfig_clone(&val_conv);
36017         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
36018 }
36019
36020 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) {
36021         void* entropy_source_ptr = untag_ptr(entropy_source);
36022         CHECK_ACCESS(entropy_source_ptr);
36023         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
36024         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
36025                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36026                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
36027         }
36028         void* node_signer_ptr = untag_ptr(node_signer);
36029         CHECK_ACCESS(node_signer_ptr);
36030         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
36031         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
36032                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36033                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
36034         }
36035         void* signer_provider_ptr = untag_ptr(signer_provider);
36036         CHECK_ACCESS(signer_provider_ptr);
36037         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
36038         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
36039                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36040                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
36041         }
36042         void* fee_estimator_ptr = untag_ptr(fee_estimator);
36043         CHECK_ACCESS(fee_estimator_ptr);
36044         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
36045         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
36046                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36047                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
36048         }
36049         void* chain_monitor_ptr = untag_ptr(chain_monitor);
36050         CHECK_ACCESS(chain_monitor_ptr);
36051         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
36052         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
36053                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36054                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
36055         }
36056         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
36057         CHECK_ACCESS(tx_broadcaster_ptr);
36058         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
36059         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
36060                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36061                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
36062         }
36063         void* router_ptr = untag_ptr(router);
36064         CHECK_ACCESS(router_ptr);
36065         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
36066         if (router_conv.free == LDKRouter_JCalls_free) {
36067                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36068                 LDKRouter_JCalls_cloned(&router_conv);
36069         }
36070         void* logger_ptr = untag_ptr(logger);
36071         CHECK_ACCESS(logger_ptr);
36072         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
36073         if (logger_conv.free == LDKLogger_JCalls_free) {
36074                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36075                 LDKLogger_JCalls_cloned(&logger_conv);
36076         }
36077         LDKUserConfig default_config_conv;
36078         default_config_conv.inner = untag_ptr(default_config);
36079         default_config_conv.is_owned = ptr_is_owned(default_config);
36080         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
36081         default_config_conv = UserConfig_clone(&default_config_conv);
36082         LDKCVec_ChannelMonitorZ channel_monitors_constr;
36083         channel_monitors_constr.datalen = channel_monitors->arr_len;
36084         if (channel_monitors_constr.datalen > 0)
36085                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
36086         else
36087                 channel_monitors_constr.data = NULL;
36088         uint64_t* channel_monitors_vals = channel_monitors->elems;
36089         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
36090                 uint64_t channel_monitors_conv_16 = channel_monitors_vals[q];
36091                 LDKChannelMonitor channel_monitors_conv_16_conv;
36092                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
36093                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
36094                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
36095                 channel_monitors_conv_16_conv.is_owned = false;
36096                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
36097         }
36098         FREE(channel_monitors);
36099         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);
36100         uint64_t ret_ref = 0;
36101         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36102         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36103         return ret_ref;
36104 }
36105
36106 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_read"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_read(int8_tArray ser, uint64_t arg) {
36107         LDKu8slice ser_ref;
36108         ser_ref.datalen = ser->arr_len;
36109         ser_ref.data = ser->elems;
36110         LDKChannelManagerReadArgs arg_conv;
36111         arg_conv.inner = untag_ptr(arg);
36112         arg_conv.is_owned = ptr_is_owned(arg);
36113         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36114         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
36115         
36116         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
36117         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_read(ser_ref, arg_conv);
36118         FREE(ser);
36119         return tag_ptr(ret_conv, true);
36120 }
36121
36122 void  __attribute__((export_name("TS_ExpandedKey_free"))) TS_ExpandedKey_free(uint64_t this_obj) {
36123         LDKExpandedKey this_obj_conv;
36124         this_obj_conv.inner = untag_ptr(this_obj);
36125         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36127         ExpandedKey_free(this_obj_conv);
36128 }
36129
36130 uint64_t  __attribute__((export_name("TS_ExpandedKey_new"))) TS_ExpandedKey_new(int8_tArray key_material) {
36131         uint8_t key_material_arr[32];
36132         CHECK(key_material->arr_len == 32);
36133         memcpy(key_material_arr, key_material->elems, 32); FREE(key_material);
36134         uint8_t (*key_material_ref)[32] = &key_material_arr;
36135         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
36136         uint64_t ret_ref = 0;
36137         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36138         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36139         return ret_ref;
36140 }
36141
36142 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) {
36143         LDKExpandedKey keys_conv;
36144         keys_conv.inner = untag_ptr(keys);
36145         keys_conv.is_owned = ptr_is_owned(keys);
36146         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
36147         keys_conv.is_owned = false;
36148         void* min_value_msat_ptr = untag_ptr(min_value_msat);
36149         CHECK_ACCESS(min_value_msat_ptr);
36150         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
36151         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
36152         void* entropy_source_ptr = untag_ptr(entropy_source);
36153         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
36154         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
36155         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
36156         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
36157         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
36158         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
36159         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
36160         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, entropy_source_conv, current_time, min_final_cltv_expiry_delta_conv);
36161         return tag_ptr(ret_conv, true);
36162 }
36163
36164 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) {
36165         LDKExpandedKey keys_conv;
36166         keys_conv.inner = untag_ptr(keys);
36167         keys_conv.is_owned = ptr_is_owned(keys);
36168         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
36169         keys_conv.is_owned = false;
36170         void* min_value_msat_ptr = untag_ptr(min_value_msat);
36171         CHECK_ACCESS(min_value_msat_ptr);
36172         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
36173         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
36174         LDKThirtyTwoBytes payment_hash_ref;
36175         CHECK(payment_hash->arr_len == 32);
36176         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
36177         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
36178         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
36179         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
36180         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
36181         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
36182         *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);
36183         return tag_ptr(ret_conv, true);
36184 }
36185
36186 void  __attribute__((export_name("TS_DecodeError_free"))) TS_DecodeError_free(uint64_t this_ptr) {
36187         if (!ptr_is_owned(this_ptr)) return;
36188         void* this_ptr_ptr = untag_ptr(this_ptr);
36189         CHECK_ACCESS(this_ptr_ptr);
36190         LDKDecodeError this_ptr_conv = *(LDKDecodeError*)(this_ptr_ptr);
36191         FREE(untag_ptr(this_ptr));
36192         DecodeError_free(this_ptr_conv);
36193 }
36194
36195 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
36196         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
36197         *ret_copy = DecodeError_clone(arg);
36198         uint64_t ret_ref = tag_ptr(ret_copy, true);
36199         return ret_ref;
36200 }
36201 int64_t  __attribute__((export_name("TS_DecodeError_clone_ptr"))) TS_DecodeError_clone_ptr(uint64_t arg) {
36202         LDKDecodeError* arg_conv = (LDKDecodeError*)untag_ptr(arg);
36203         int64_t ret_conv = DecodeError_clone_ptr(arg_conv);
36204         return ret_conv;
36205 }
36206
36207 uint64_t  __attribute__((export_name("TS_DecodeError_clone"))) TS_DecodeError_clone(uint64_t orig) {
36208         LDKDecodeError* orig_conv = (LDKDecodeError*)untag_ptr(orig);
36209         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
36210         *ret_copy = DecodeError_clone(orig_conv);
36211         uint64_t ret_ref = tag_ptr(ret_copy, true);
36212         return ret_ref;
36213 }
36214
36215 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_version"))) TS_DecodeError_unknown_version() {
36216         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
36217         *ret_copy = DecodeError_unknown_version();
36218         uint64_t ret_ref = tag_ptr(ret_copy, true);
36219         return ret_ref;
36220 }
36221
36222 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_required_feature"))) TS_DecodeError_unknown_required_feature() {
36223         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
36224         *ret_copy = DecodeError_unknown_required_feature();
36225         uint64_t ret_ref = tag_ptr(ret_copy, true);
36226         return ret_ref;
36227 }
36228
36229 uint64_t  __attribute__((export_name("TS_DecodeError_invalid_value"))) TS_DecodeError_invalid_value() {
36230         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
36231         *ret_copy = DecodeError_invalid_value();
36232         uint64_t ret_ref = tag_ptr(ret_copy, true);
36233         return ret_ref;
36234 }
36235
36236 uint64_t  __attribute__((export_name("TS_DecodeError_short_read"))) TS_DecodeError_short_read() {
36237         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
36238         *ret_copy = DecodeError_short_read();
36239         uint64_t ret_ref = tag_ptr(ret_copy, true);
36240         return ret_ref;
36241 }
36242
36243 uint64_t  __attribute__((export_name("TS_DecodeError_bad_length_descriptor"))) TS_DecodeError_bad_length_descriptor() {
36244         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
36245         *ret_copy = DecodeError_bad_length_descriptor();
36246         uint64_t ret_ref = tag_ptr(ret_copy, true);
36247         return ret_ref;
36248 }
36249
36250 uint64_t  __attribute__((export_name("TS_DecodeError_io"))) TS_DecodeError_io(uint32_t a) {
36251         LDKIOError a_conv = LDKIOError_from_js(a);
36252         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
36253         *ret_copy = DecodeError_io(a_conv);
36254         uint64_t ret_ref = tag_ptr(ret_copy, true);
36255         return ret_ref;
36256 }
36257
36258 uint64_t  __attribute__((export_name("TS_DecodeError_unsupported_compression"))) TS_DecodeError_unsupported_compression() {
36259         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
36260         *ret_copy = DecodeError_unsupported_compression();
36261         uint64_t ret_ref = tag_ptr(ret_copy, true);
36262         return ret_ref;
36263 }
36264
36265 jboolean  __attribute__((export_name("TS_DecodeError_eq"))) TS_DecodeError_eq(uint64_t a, uint64_t b) {
36266         LDKDecodeError* a_conv = (LDKDecodeError*)untag_ptr(a);
36267         LDKDecodeError* b_conv = (LDKDecodeError*)untag_ptr(b);
36268         jboolean ret_conv = DecodeError_eq(a_conv, b_conv);
36269         return ret_conv;
36270 }
36271
36272 void  __attribute__((export_name("TS_Init_free"))) TS_Init_free(uint64_t this_obj) {
36273         LDKInit this_obj_conv;
36274         this_obj_conv.inner = untag_ptr(this_obj);
36275         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36277         Init_free(this_obj_conv);
36278 }
36279
36280 uint64_t  __attribute__((export_name("TS_Init_get_features"))) TS_Init_get_features(uint64_t this_ptr) {
36281         LDKInit this_ptr_conv;
36282         this_ptr_conv.inner = untag_ptr(this_ptr);
36283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36285         this_ptr_conv.is_owned = false;
36286         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
36287         uint64_t ret_ref = 0;
36288         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36289         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36290         return ret_ref;
36291 }
36292
36293 void  __attribute__((export_name("TS_Init_set_features"))) TS_Init_set_features(uint64_t this_ptr, uint64_t val) {
36294         LDKInit this_ptr_conv;
36295         this_ptr_conv.inner = untag_ptr(this_ptr);
36296         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36298         this_ptr_conv.is_owned = false;
36299         LDKInitFeatures val_conv;
36300         val_conv.inner = untag_ptr(val);
36301         val_conv.is_owned = ptr_is_owned(val);
36302         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36303         val_conv = InitFeatures_clone(&val_conv);
36304         Init_set_features(&this_ptr_conv, val_conv);
36305 }
36306
36307 uint64_t  __attribute__((export_name("TS_Init_get_networks"))) TS_Init_get_networks(uint64_t this_ptr) {
36308         LDKInit this_ptr_conv;
36309         this_ptr_conv.inner = untag_ptr(this_ptr);
36310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36312         this_ptr_conv.is_owned = false;
36313         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
36314         *ret_copy = Init_get_networks(&this_ptr_conv);
36315         uint64_t ret_ref = tag_ptr(ret_copy, true);
36316         return ret_ref;
36317 }
36318
36319 void  __attribute__((export_name("TS_Init_set_networks"))) TS_Init_set_networks(uint64_t this_ptr, uint64_t val) {
36320         LDKInit this_ptr_conv;
36321         this_ptr_conv.inner = untag_ptr(this_ptr);
36322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36324         this_ptr_conv.is_owned = false;
36325         void* val_ptr = untag_ptr(val);
36326         CHECK_ACCESS(val_ptr);
36327         LDKCOption_CVec_ThirtyTwoBytesZZ val_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(val_ptr);
36328         val_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(val));
36329         Init_set_networks(&this_ptr_conv, val_conv);
36330 }
36331
36332 uint64_t  __attribute__((export_name("TS_Init_get_remote_network_address"))) TS_Init_get_remote_network_address(uint64_t this_ptr) {
36333         LDKInit this_ptr_conv;
36334         this_ptr_conv.inner = untag_ptr(this_ptr);
36335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36337         this_ptr_conv.is_owned = false;
36338         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
36339         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
36340         uint64_t ret_ref = tag_ptr(ret_copy, true);
36341         return ret_ref;
36342 }
36343
36344 void  __attribute__((export_name("TS_Init_set_remote_network_address"))) TS_Init_set_remote_network_address(uint64_t this_ptr, uint64_t val) {
36345         LDKInit this_ptr_conv;
36346         this_ptr_conv.inner = untag_ptr(this_ptr);
36347         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36349         this_ptr_conv.is_owned = false;
36350         void* val_ptr = untag_ptr(val);
36351         CHECK_ACCESS(val_ptr);
36352         LDKCOption_SocketAddressZ val_conv = *(LDKCOption_SocketAddressZ*)(val_ptr);
36353         val_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(val));
36354         Init_set_remote_network_address(&this_ptr_conv, val_conv);
36355 }
36356
36357 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) {
36358         LDKInitFeatures features_arg_conv;
36359         features_arg_conv.inner = untag_ptr(features_arg);
36360         features_arg_conv.is_owned = ptr_is_owned(features_arg);
36361         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
36362         features_arg_conv = InitFeatures_clone(&features_arg_conv);
36363         void* networks_arg_ptr = untag_ptr(networks_arg);
36364         CHECK_ACCESS(networks_arg_ptr);
36365         LDKCOption_CVec_ThirtyTwoBytesZZ networks_arg_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(networks_arg_ptr);
36366         networks_arg_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(networks_arg));
36367         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
36368         CHECK_ACCESS(remote_network_address_arg_ptr);
36369         LDKCOption_SocketAddressZ remote_network_address_arg_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_arg_ptr);
36370         LDKInit ret_var = Init_new(features_arg_conv, networks_arg_conv, remote_network_address_arg_conv);
36371         uint64_t ret_ref = 0;
36372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36374         return ret_ref;
36375 }
36376
36377 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
36378         LDKInit ret_var = Init_clone(arg);
36379         uint64_t ret_ref = 0;
36380         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36381         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36382         return ret_ref;
36383 }
36384 int64_t  __attribute__((export_name("TS_Init_clone_ptr"))) TS_Init_clone_ptr(uint64_t arg) {
36385         LDKInit arg_conv;
36386         arg_conv.inner = untag_ptr(arg);
36387         arg_conv.is_owned = ptr_is_owned(arg);
36388         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36389         arg_conv.is_owned = false;
36390         int64_t ret_conv = Init_clone_ptr(&arg_conv);
36391         return ret_conv;
36392 }
36393
36394 uint64_t  __attribute__((export_name("TS_Init_clone"))) TS_Init_clone(uint64_t orig) {
36395         LDKInit orig_conv;
36396         orig_conv.inner = untag_ptr(orig);
36397         orig_conv.is_owned = ptr_is_owned(orig);
36398         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36399         orig_conv.is_owned = false;
36400         LDKInit ret_var = Init_clone(&orig_conv);
36401         uint64_t ret_ref = 0;
36402         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36403         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36404         return ret_ref;
36405 }
36406
36407 jboolean  __attribute__((export_name("TS_Init_eq"))) TS_Init_eq(uint64_t a, uint64_t b) {
36408         LDKInit a_conv;
36409         a_conv.inner = untag_ptr(a);
36410         a_conv.is_owned = ptr_is_owned(a);
36411         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36412         a_conv.is_owned = false;
36413         LDKInit b_conv;
36414         b_conv.inner = untag_ptr(b);
36415         b_conv.is_owned = ptr_is_owned(b);
36416         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36417         b_conv.is_owned = false;
36418         jboolean ret_conv = Init_eq(&a_conv, &b_conv);
36419         return ret_conv;
36420 }
36421
36422 void  __attribute__((export_name("TS_ErrorMessage_free"))) TS_ErrorMessage_free(uint64_t this_obj) {
36423         LDKErrorMessage this_obj_conv;
36424         this_obj_conv.inner = untag_ptr(this_obj);
36425         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36427         ErrorMessage_free(this_obj_conv);
36428 }
36429
36430 int8_tArray  __attribute__((export_name("TS_ErrorMessage_get_channel_id"))) TS_ErrorMessage_get_channel_id(uint64_t this_ptr) {
36431         LDKErrorMessage this_ptr_conv;
36432         this_ptr_conv.inner = untag_ptr(this_ptr);
36433         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36435         this_ptr_conv.is_owned = false;
36436         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36437         memcpy(ret_arr->elems, *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
36438         return ret_arr;
36439 }
36440
36441 void  __attribute__((export_name("TS_ErrorMessage_set_channel_id"))) TS_ErrorMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
36442         LDKErrorMessage this_ptr_conv;
36443         this_ptr_conv.inner = untag_ptr(this_ptr);
36444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36446         this_ptr_conv.is_owned = false;
36447         LDKThirtyTwoBytes val_ref;
36448         CHECK(val->arr_len == 32);
36449         memcpy(val_ref.data, val->elems, 32); FREE(val);
36450         ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
36451 }
36452
36453 jstring  __attribute__((export_name("TS_ErrorMessage_get_data"))) TS_ErrorMessage_get_data(uint64_t this_ptr) {
36454         LDKErrorMessage this_ptr_conv;
36455         this_ptr_conv.inner = untag_ptr(this_ptr);
36456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36458         this_ptr_conv.is_owned = false;
36459         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
36460         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
36461         Str_free(ret_str);
36462         return ret_conv;
36463 }
36464
36465 void  __attribute__((export_name("TS_ErrorMessage_set_data"))) TS_ErrorMessage_set_data(uint64_t this_ptr, jstring val) {
36466         LDKErrorMessage this_ptr_conv;
36467         this_ptr_conv.inner = untag_ptr(this_ptr);
36468         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36470         this_ptr_conv.is_owned = false;
36471         LDKStr val_conv = str_ref_to_owned_c(val);
36472         ErrorMessage_set_data(&this_ptr_conv, val_conv);
36473 }
36474
36475 uint64_t  __attribute__((export_name("TS_ErrorMessage_new"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
36476         LDKThirtyTwoBytes channel_id_arg_ref;
36477         CHECK(channel_id_arg->arr_len == 32);
36478         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
36479         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
36480         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
36481         uint64_t ret_ref = 0;
36482         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36483         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36484         return ret_ref;
36485 }
36486
36487 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
36488         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
36489         uint64_t ret_ref = 0;
36490         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36491         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36492         return ret_ref;
36493 }
36494 int64_t  __attribute__((export_name("TS_ErrorMessage_clone_ptr"))) TS_ErrorMessage_clone_ptr(uint64_t arg) {
36495         LDKErrorMessage arg_conv;
36496         arg_conv.inner = untag_ptr(arg);
36497         arg_conv.is_owned = ptr_is_owned(arg);
36498         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36499         arg_conv.is_owned = false;
36500         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
36501         return ret_conv;
36502 }
36503
36504 uint64_t  __attribute__((export_name("TS_ErrorMessage_clone"))) TS_ErrorMessage_clone(uint64_t orig) {
36505         LDKErrorMessage orig_conv;
36506         orig_conv.inner = untag_ptr(orig);
36507         orig_conv.is_owned = ptr_is_owned(orig);
36508         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36509         orig_conv.is_owned = false;
36510         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
36511         uint64_t ret_ref = 0;
36512         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36513         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36514         return ret_ref;
36515 }
36516
36517 jboolean  __attribute__((export_name("TS_ErrorMessage_eq"))) TS_ErrorMessage_eq(uint64_t a, uint64_t b) {
36518         LDKErrorMessage a_conv;
36519         a_conv.inner = untag_ptr(a);
36520         a_conv.is_owned = ptr_is_owned(a);
36521         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36522         a_conv.is_owned = false;
36523         LDKErrorMessage b_conv;
36524         b_conv.inner = untag_ptr(b);
36525         b_conv.is_owned = ptr_is_owned(b);
36526         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36527         b_conv.is_owned = false;
36528         jboolean ret_conv = ErrorMessage_eq(&a_conv, &b_conv);
36529         return ret_conv;
36530 }
36531
36532 void  __attribute__((export_name("TS_WarningMessage_free"))) TS_WarningMessage_free(uint64_t this_obj) {
36533         LDKWarningMessage this_obj_conv;
36534         this_obj_conv.inner = untag_ptr(this_obj);
36535         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36537         WarningMessage_free(this_obj_conv);
36538 }
36539
36540 int8_tArray  __attribute__((export_name("TS_WarningMessage_get_channel_id"))) TS_WarningMessage_get_channel_id(uint64_t this_ptr) {
36541         LDKWarningMessage this_ptr_conv;
36542         this_ptr_conv.inner = untag_ptr(this_ptr);
36543         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36545         this_ptr_conv.is_owned = false;
36546         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36547         memcpy(ret_arr->elems, *WarningMessage_get_channel_id(&this_ptr_conv), 32);
36548         return ret_arr;
36549 }
36550
36551 void  __attribute__((export_name("TS_WarningMessage_set_channel_id"))) TS_WarningMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
36552         LDKWarningMessage this_ptr_conv;
36553         this_ptr_conv.inner = untag_ptr(this_ptr);
36554         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36556         this_ptr_conv.is_owned = false;
36557         LDKThirtyTwoBytes val_ref;
36558         CHECK(val->arr_len == 32);
36559         memcpy(val_ref.data, val->elems, 32); FREE(val);
36560         WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
36561 }
36562
36563 jstring  __attribute__((export_name("TS_WarningMessage_get_data"))) TS_WarningMessage_get_data(uint64_t this_ptr) {
36564         LDKWarningMessage this_ptr_conv;
36565         this_ptr_conv.inner = untag_ptr(this_ptr);
36566         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36568         this_ptr_conv.is_owned = false;
36569         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
36570         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
36571         Str_free(ret_str);
36572         return ret_conv;
36573 }
36574
36575 void  __attribute__((export_name("TS_WarningMessage_set_data"))) TS_WarningMessage_set_data(uint64_t this_ptr, jstring val) {
36576         LDKWarningMessage this_ptr_conv;
36577         this_ptr_conv.inner = untag_ptr(this_ptr);
36578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36580         this_ptr_conv.is_owned = false;
36581         LDKStr val_conv = str_ref_to_owned_c(val);
36582         WarningMessage_set_data(&this_ptr_conv, val_conv);
36583 }
36584
36585 uint64_t  __attribute__((export_name("TS_WarningMessage_new"))) TS_WarningMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
36586         LDKThirtyTwoBytes channel_id_arg_ref;
36587         CHECK(channel_id_arg->arr_len == 32);
36588         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
36589         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
36590         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
36591         uint64_t ret_ref = 0;
36592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36594         return ret_ref;
36595 }
36596
36597 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
36598         LDKWarningMessage ret_var = WarningMessage_clone(arg);
36599         uint64_t ret_ref = 0;
36600         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36601         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36602         return ret_ref;
36603 }
36604 int64_t  __attribute__((export_name("TS_WarningMessage_clone_ptr"))) TS_WarningMessage_clone_ptr(uint64_t arg) {
36605         LDKWarningMessage arg_conv;
36606         arg_conv.inner = untag_ptr(arg);
36607         arg_conv.is_owned = ptr_is_owned(arg);
36608         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36609         arg_conv.is_owned = false;
36610         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
36611         return ret_conv;
36612 }
36613
36614 uint64_t  __attribute__((export_name("TS_WarningMessage_clone"))) TS_WarningMessage_clone(uint64_t orig) {
36615         LDKWarningMessage orig_conv;
36616         orig_conv.inner = untag_ptr(orig);
36617         orig_conv.is_owned = ptr_is_owned(orig);
36618         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36619         orig_conv.is_owned = false;
36620         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
36621         uint64_t ret_ref = 0;
36622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36624         return ret_ref;
36625 }
36626
36627 jboolean  __attribute__((export_name("TS_WarningMessage_eq"))) TS_WarningMessage_eq(uint64_t a, uint64_t b) {
36628         LDKWarningMessage a_conv;
36629         a_conv.inner = untag_ptr(a);
36630         a_conv.is_owned = ptr_is_owned(a);
36631         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36632         a_conv.is_owned = false;
36633         LDKWarningMessage b_conv;
36634         b_conv.inner = untag_ptr(b);
36635         b_conv.is_owned = ptr_is_owned(b);
36636         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36637         b_conv.is_owned = false;
36638         jboolean ret_conv = WarningMessage_eq(&a_conv, &b_conv);
36639         return ret_conv;
36640 }
36641
36642 void  __attribute__((export_name("TS_Ping_free"))) TS_Ping_free(uint64_t this_obj) {
36643         LDKPing this_obj_conv;
36644         this_obj_conv.inner = untag_ptr(this_obj);
36645         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36647         Ping_free(this_obj_conv);
36648 }
36649
36650 int16_t  __attribute__((export_name("TS_Ping_get_ponglen"))) TS_Ping_get_ponglen(uint64_t this_ptr) {
36651         LDKPing this_ptr_conv;
36652         this_ptr_conv.inner = untag_ptr(this_ptr);
36653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36655         this_ptr_conv.is_owned = false;
36656         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
36657         return ret_conv;
36658 }
36659
36660 void  __attribute__((export_name("TS_Ping_set_ponglen"))) TS_Ping_set_ponglen(uint64_t this_ptr, int16_t val) {
36661         LDKPing this_ptr_conv;
36662         this_ptr_conv.inner = untag_ptr(this_ptr);
36663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36665         this_ptr_conv.is_owned = false;
36666         Ping_set_ponglen(&this_ptr_conv, val);
36667 }
36668
36669 int16_t  __attribute__((export_name("TS_Ping_get_byteslen"))) TS_Ping_get_byteslen(uint64_t this_ptr) {
36670         LDKPing this_ptr_conv;
36671         this_ptr_conv.inner = untag_ptr(this_ptr);
36672         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36674         this_ptr_conv.is_owned = false;
36675         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
36676         return ret_conv;
36677 }
36678
36679 void  __attribute__((export_name("TS_Ping_set_byteslen"))) TS_Ping_set_byteslen(uint64_t this_ptr, int16_t val) {
36680         LDKPing this_ptr_conv;
36681         this_ptr_conv.inner = untag_ptr(this_ptr);
36682         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36684         this_ptr_conv.is_owned = false;
36685         Ping_set_byteslen(&this_ptr_conv, val);
36686 }
36687
36688 uint64_t  __attribute__((export_name("TS_Ping_new"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
36689         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
36690         uint64_t ret_ref = 0;
36691         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36692         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36693         return ret_ref;
36694 }
36695
36696 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
36697         LDKPing ret_var = Ping_clone(arg);
36698         uint64_t ret_ref = 0;
36699         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36700         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36701         return ret_ref;
36702 }
36703 int64_t  __attribute__((export_name("TS_Ping_clone_ptr"))) TS_Ping_clone_ptr(uint64_t arg) {
36704         LDKPing arg_conv;
36705         arg_conv.inner = untag_ptr(arg);
36706         arg_conv.is_owned = ptr_is_owned(arg);
36707         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36708         arg_conv.is_owned = false;
36709         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
36710         return ret_conv;
36711 }
36712
36713 uint64_t  __attribute__((export_name("TS_Ping_clone"))) TS_Ping_clone(uint64_t orig) {
36714         LDKPing orig_conv;
36715         orig_conv.inner = untag_ptr(orig);
36716         orig_conv.is_owned = ptr_is_owned(orig);
36717         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36718         orig_conv.is_owned = false;
36719         LDKPing ret_var = Ping_clone(&orig_conv);
36720         uint64_t ret_ref = 0;
36721         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36722         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36723         return ret_ref;
36724 }
36725
36726 jboolean  __attribute__((export_name("TS_Ping_eq"))) TS_Ping_eq(uint64_t a, uint64_t b) {
36727         LDKPing a_conv;
36728         a_conv.inner = untag_ptr(a);
36729         a_conv.is_owned = ptr_is_owned(a);
36730         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36731         a_conv.is_owned = false;
36732         LDKPing b_conv;
36733         b_conv.inner = untag_ptr(b);
36734         b_conv.is_owned = ptr_is_owned(b);
36735         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36736         b_conv.is_owned = false;
36737         jboolean ret_conv = Ping_eq(&a_conv, &b_conv);
36738         return ret_conv;
36739 }
36740
36741 void  __attribute__((export_name("TS_Pong_free"))) TS_Pong_free(uint64_t this_obj) {
36742         LDKPong this_obj_conv;
36743         this_obj_conv.inner = untag_ptr(this_obj);
36744         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36746         Pong_free(this_obj_conv);
36747 }
36748
36749 int16_t  __attribute__((export_name("TS_Pong_get_byteslen"))) TS_Pong_get_byteslen(uint64_t this_ptr) {
36750         LDKPong this_ptr_conv;
36751         this_ptr_conv.inner = untag_ptr(this_ptr);
36752         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36754         this_ptr_conv.is_owned = false;
36755         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
36756         return ret_conv;
36757 }
36758
36759 void  __attribute__((export_name("TS_Pong_set_byteslen"))) TS_Pong_set_byteslen(uint64_t this_ptr, int16_t val) {
36760         LDKPong this_ptr_conv;
36761         this_ptr_conv.inner = untag_ptr(this_ptr);
36762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36764         this_ptr_conv.is_owned = false;
36765         Pong_set_byteslen(&this_ptr_conv, val);
36766 }
36767
36768 uint64_t  __attribute__((export_name("TS_Pong_new"))) TS_Pong_new(int16_t byteslen_arg) {
36769         LDKPong ret_var = Pong_new(byteslen_arg);
36770         uint64_t ret_ref = 0;
36771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36773         return ret_ref;
36774 }
36775
36776 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
36777         LDKPong ret_var = Pong_clone(arg);
36778         uint64_t ret_ref = 0;
36779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36781         return ret_ref;
36782 }
36783 int64_t  __attribute__((export_name("TS_Pong_clone_ptr"))) TS_Pong_clone_ptr(uint64_t arg) {
36784         LDKPong arg_conv;
36785         arg_conv.inner = untag_ptr(arg);
36786         arg_conv.is_owned = ptr_is_owned(arg);
36787         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36788         arg_conv.is_owned = false;
36789         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
36790         return ret_conv;
36791 }
36792
36793 uint64_t  __attribute__((export_name("TS_Pong_clone"))) TS_Pong_clone(uint64_t orig) {
36794         LDKPong orig_conv;
36795         orig_conv.inner = untag_ptr(orig);
36796         orig_conv.is_owned = ptr_is_owned(orig);
36797         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36798         orig_conv.is_owned = false;
36799         LDKPong ret_var = Pong_clone(&orig_conv);
36800         uint64_t ret_ref = 0;
36801         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36802         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36803         return ret_ref;
36804 }
36805
36806 jboolean  __attribute__((export_name("TS_Pong_eq"))) TS_Pong_eq(uint64_t a, uint64_t b) {
36807         LDKPong a_conv;
36808         a_conv.inner = untag_ptr(a);
36809         a_conv.is_owned = ptr_is_owned(a);
36810         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36811         a_conv.is_owned = false;
36812         LDKPong b_conv;
36813         b_conv.inner = untag_ptr(b);
36814         b_conv.is_owned = ptr_is_owned(b);
36815         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36816         b_conv.is_owned = false;
36817         jboolean ret_conv = Pong_eq(&a_conv, &b_conv);
36818         return ret_conv;
36819 }
36820
36821 void  __attribute__((export_name("TS_OpenChannel_free"))) TS_OpenChannel_free(uint64_t this_obj) {
36822         LDKOpenChannel this_obj_conv;
36823         this_obj_conv.inner = untag_ptr(this_obj);
36824         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36826         OpenChannel_free(this_obj_conv);
36827 }
36828
36829 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_chain_hash"))) TS_OpenChannel_get_chain_hash(uint64_t this_ptr) {
36830         LDKOpenChannel this_ptr_conv;
36831         this_ptr_conv.inner = untag_ptr(this_ptr);
36832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36834         this_ptr_conv.is_owned = false;
36835         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36836         memcpy(ret_arr->elems, *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
36837         return ret_arr;
36838 }
36839
36840 void  __attribute__((export_name("TS_OpenChannel_set_chain_hash"))) TS_OpenChannel_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
36841         LDKOpenChannel this_ptr_conv;
36842         this_ptr_conv.inner = untag_ptr(this_ptr);
36843         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36845         this_ptr_conv.is_owned = false;
36846         LDKThirtyTwoBytes val_ref;
36847         CHECK(val->arr_len == 32);
36848         memcpy(val_ref.data, val->elems, 32); FREE(val);
36849         OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
36850 }
36851
36852 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_temporary_channel_id"))) TS_OpenChannel_get_temporary_channel_id(uint64_t this_ptr) {
36853         LDKOpenChannel this_ptr_conv;
36854         this_ptr_conv.inner = untag_ptr(this_ptr);
36855         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36857         this_ptr_conv.is_owned = false;
36858         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36859         memcpy(ret_arr->elems, *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
36860         return ret_arr;
36861 }
36862
36863 void  __attribute__((export_name("TS_OpenChannel_set_temporary_channel_id"))) TS_OpenChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
36864         LDKOpenChannel this_ptr_conv;
36865         this_ptr_conv.inner = untag_ptr(this_ptr);
36866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36868         this_ptr_conv.is_owned = false;
36869         LDKThirtyTwoBytes val_ref;
36870         CHECK(val->arr_len == 32);
36871         memcpy(val_ref.data, val->elems, 32); FREE(val);
36872         OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
36873 }
36874
36875 int64_t  __attribute__((export_name("TS_OpenChannel_get_funding_satoshis"))) TS_OpenChannel_get_funding_satoshis(uint64_t this_ptr) {
36876         LDKOpenChannel this_ptr_conv;
36877         this_ptr_conv.inner = untag_ptr(this_ptr);
36878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36880         this_ptr_conv.is_owned = false;
36881         int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
36882         return ret_conv;
36883 }
36884
36885 void  __attribute__((export_name("TS_OpenChannel_set_funding_satoshis"))) TS_OpenChannel_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
36886         LDKOpenChannel this_ptr_conv;
36887         this_ptr_conv.inner = untag_ptr(this_ptr);
36888         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36890         this_ptr_conv.is_owned = false;
36891         OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
36892 }
36893
36894 int64_t  __attribute__((export_name("TS_OpenChannel_get_push_msat"))) TS_OpenChannel_get_push_msat(uint64_t this_ptr) {
36895         LDKOpenChannel this_ptr_conv;
36896         this_ptr_conv.inner = untag_ptr(this_ptr);
36897         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36899         this_ptr_conv.is_owned = false;
36900         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
36901         return ret_conv;
36902 }
36903
36904 void  __attribute__((export_name("TS_OpenChannel_set_push_msat"))) TS_OpenChannel_set_push_msat(uint64_t this_ptr, int64_t val) {
36905         LDKOpenChannel this_ptr_conv;
36906         this_ptr_conv.inner = untag_ptr(this_ptr);
36907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36909         this_ptr_conv.is_owned = false;
36910         OpenChannel_set_push_msat(&this_ptr_conv, val);
36911 }
36912
36913 int64_t  __attribute__((export_name("TS_OpenChannel_get_dust_limit_satoshis"))) TS_OpenChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
36914         LDKOpenChannel this_ptr_conv;
36915         this_ptr_conv.inner = untag_ptr(this_ptr);
36916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36918         this_ptr_conv.is_owned = false;
36919         int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
36920         return ret_conv;
36921 }
36922
36923 void  __attribute__((export_name("TS_OpenChannel_set_dust_limit_satoshis"))) TS_OpenChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
36924         LDKOpenChannel this_ptr_conv;
36925         this_ptr_conv.inner = untag_ptr(this_ptr);
36926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36928         this_ptr_conv.is_owned = false;
36929         OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
36930 }
36931
36932 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) {
36933         LDKOpenChannel this_ptr_conv;
36934         this_ptr_conv.inner = untag_ptr(this_ptr);
36935         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36937         this_ptr_conv.is_owned = false;
36938         int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
36939         return ret_conv;
36940 }
36941
36942 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) {
36943         LDKOpenChannel this_ptr_conv;
36944         this_ptr_conv.inner = untag_ptr(this_ptr);
36945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36947         this_ptr_conv.is_owned = false;
36948         OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
36949 }
36950
36951 int64_t  __attribute__((export_name("TS_OpenChannel_get_channel_reserve_satoshis"))) TS_OpenChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
36952         LDKOpenChannel this_ptr_conv;
36953         this_ptr_conv.inner = untag_ptr(this_ptr);
36954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36956         this_ptr_conv.is_owned = false;
36957         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
36958         return ret_conv;
36959 }
36960
36961 void  __attribute__((export_name("TS_OpenChannel_set_channel_reserve_satoshis"))) TS_OpenChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
36962         LDKOpenChannel this_ptr_conv;
36963         this_ptr_conv.inner = untag_ptr(this_ptr);
36964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36966         this_ptr_conv.is_owned = false;
36967         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
36968 }
36969
36970 int64_t  __attribute__((export_name("TS_OpenChannel_get_htlc_minimum_msat"))) TS_OpenChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
36971         LDKOpenChannel this_ptr_conv;
36972         this_ptr_conv.inner = untag_ptr(this_ptr);
36973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36975         this_ptr_conv.is_owned = false;
36976         int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
36977         return ret_conv;
36978 }
36979
36980 void  __attribute__((export_name("TS_OpenChannel_set_htlc_minimum_msat"))) TS_OpenChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
36981         LDKOpenChannel this_ptr_conv;
36982         this_ptr_conv.inner = untag_ptr(this_ptr);
36983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36985         this_ptr_conv.is_owned = false;
36986         OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
36987 }
36988
36989 int32_t  __attribute__((export_name("TS_OpenChannel_get_feerate_per_kw"))) TS_OpenChannel_get_feerate_per_kw(uint64_t this_ptr) {
36990         LDKOpenChannel this_ptr_conv;
36991         this_ptr_conv.inner = untag_ptr(this_ptr);
36992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36994         this_ptr_conv.is_owned = false;
36995         int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
36996         return ret_conv;
36997 }
36998
36999 void  __attribute__((export_name("TS_OpenChannel_set_feerate_per_kw"))) TS_OpenChannel_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
37000         LDKOpenChannel this_ptr_conv;
37001         this_ptr_conv.inner = untag_ptr(this_ptr);
37002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37004         this_ptr_conv.is_owned = false;
37005         OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
37006 }
37007
37008 int16_t  __attribute__((export_name("TS_OpenChannel_get_to_self_delay"))) TS_OpenChannel_get_to_self_delay(uint64_t this_ptr) {
37009         LDKOpenChannel this_ptr_conv;
37010         this_ptr_conv.inner = untag_ptr(this_ptr);
37011         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37013         this_ptr_conv.is_owned = false;
37014         int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
37015         return ret_conv;
37016 }
37017
37018 void  __attribute__((export_name("TS_OpenChannel_set_to_self_delay"))) TS_OpenChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
37019         LDKOpenChannel this_ptr_conv;
37020         this_ptr_conv.inner = untag_ptr(this_ptr);
37021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37023         this_ptr_conv.is_owned = false;
37024         OpenChannel_set_to_self_delay(&this_ptr_conv, val);
37025 }
37026
37027 int16_t  __attribute__((export_name("TS_OpenChannel_get_max_accepted_htlcs"))) TS_OpenChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
37028         LDKOpenChannel this_ptr_conv;
37029         this_ptr_conv.inner = untag_ptr(this_ptr);
37030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37032         this_ptr_conv.is_owned = false;
37033         int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
37034         return ret_conv;
37035 }
37036
37037 void  __attribute__((export_name("TS_OpenChannel_set_max_accepted_htlcs"))) TS_OpenChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
37038         LDKOpenChannel this_ptr_conv;
37039         this_ptr_conv.inner = untag_ptr(this_ptr);
37040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37042         this_ptr_conv.is_owned = false;
37043         OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
37044 }
37045
37046 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_funding_pubkey"))) TS_OpenChannel_get_funding_pubkey(uint64_t this_ptr) {
37047         LDKOpenChannel this_ptr_conv;
37048         this_ptr_conv.inner = untag_ptr(this_ptr);
37049         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37051         this_ptr_conv.is_owned = false;
37052         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37053         memcpy(ret_arr->elems, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
37054         return ret_arr;
37055 }
37056
37057 void  __attribute__((export_name("TS_OpenChannel_set_funding_pubkey"))) TS_OpenChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
37058         LDKOpenChannel this_ptr_conv;
37059         this_ptr_conv.inner = untag_ptr(this_ptr);
37060         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37062         this_ptr_conv.is_owned = false;
37063         LDKPublicKey val_ref;
37064         CHECK(val->arr_len == 33);
37065         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37066         OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
37067 }
37068
37069 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_revocation_basepoint"))) TS_OpenChannel_get_revocation_basepoint(uint64_t this_ptr) {
37070         LDKOpenChannel this_ptr_conv;
37071         this_ptr_conv.inner = untag_ptr(this_ptr);
37072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37074         this_ptr_conv.is_owned = false;
37075         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37076         memcpy(ret_arr->elems, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
37077         return ret_arr;
37078 }
37079
37080 void  __attribute__((export_name("TS_OpenChannel_set_revocation_basepoint"))) TS_OpenChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
37081         LDKOpenChannel this_ptr_conv;
37082         this_ptr_conv.inner = untag_ptr(this_ptr);
37083         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37085         this_ptr_conv.is_owned = false;
37086         LDKPublicKey val_ref;
37087         CHECK(val->arr_len == 33);
37088         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37089         OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
37090 }
37091
37092 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_payment_point"))) TS_OpenChannel_get_payment_point(uint64_t this_ptr) {
37093         LDKOpenChannel this_ptr_conv;
37094         this_ptr_conv.inner = untag_ptr(this_ptr);
37095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37097         this_ptr_conv.is_owned = false;
37098         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37099         memcpy(ret_arr->elems, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
37100         return ret_arr;
37101 }
37102
37103 void  __attribute__((export_name("TS_OpenChannel_set_payment_point"))) TS_OpenChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
37104         LDKOpenChannel this_ptr_conv;
37105         this_ptr_conv.inner = untag_ptr(this_ptr);
37106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37108         this_ptr_conv.is_owned = false;
37109         LDKPublicKey val_ref;
37110         CHECK(val->arr_len == 33);
37111         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37112         OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
37113 }
37114
37115 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_delayed_payment_basepoint"))) TS_OpenChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
37116         LDKOpenChannel this_ptr_conv;
37117         this_ptr_conv.inner = untag_ptr(this_ptr);
37118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37120         this_ptr_conv.is_owned = false;
37121         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37122         memcpy(ret_arr->elems, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
37123         return ret_arr;
37124 }
37125
37126 void  __attribute__((export_name("TS_OpenChannel_set_delayed_payment_basepoint"))) TS_OpenChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
37127         LDKOpenChannel this_ptr_conv;
37128         this_ptr_conv.inner = untag_ptr(this_ptr);
37129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37131         this_ptr_conv.is_owned = false;
37132         LDKPublicKey val_ref;
37133         CHECK(val->arr_len == 33);
37134         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37135         OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
37136 }
37137
37138 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_htlc_basepoint"))) TS_OpenChannel_get_htlc_basepoint(uint64_t this_ptr) {
37139         LDKOpenChannel this_ptr_conv;
37140         this_ptr_conv.inner = untag_ptr(this_ptr);
37141         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37143         this_ptr_conv.is_owned = false;
37144         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37145         memcpy(ret_arr->elems, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
37146         return ret_arr;
37147 }
37148
37149 void  __attribute__((export_name("TS_OpenChannel_set_htlc_basepoint"))) TS_OpenChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
37150         LDKOpenChannel this_ptr_conv;
37151         this_ptr_conv.inner = untag_ptr(this_ptr);
37152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37154         this_ptr_conv.is_owned = false;
37155         LDKPublicKey val_ref;
37156         CHECK(val->arr_len == 33);
37157         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37158         OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
37159 }
37160
37161 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_first_per_commitment_point"))) TS_OpenChannel_get_first_per_commitment_point(uint64_t this_ptr) {
37162         LDKOpenChannel this_ptr_conv;
37163         this_ptr_conv.inner = untag_ptr(this_ptr);
37164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37166         this_ptr_conv.is_owned = false;
37167         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37168         memcpy(ret_arr->elems, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
37169         return ret_arr;
37170 }
37171
37172 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) {
37173         LDKOpenChannel this_ptr_conv;
37174         this_ptr_conv.inner = untag_ptr(this_ptr);
37175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37177         this_ptr_conv.is_owned = false;
37178         LDKPublicKey val_ref;
37179         CHECK(val->arr_len == 33);
37180         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37181         OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
37182 }
37183
37184 int8_t  __attribute__((export_name("TS_OpenChannel_get_channel_flags"))) TS_OpenChannel_get_channel_flags(uint64_t this_ptr) {
37185         LDKOpenChannel this_ptr_conv;
37186         this_ptr_conv.inner = untag_ptr(this_ptr);
37187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37189         this_ptr_conv.is_owned = false;
37190         int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
37191         return ret_conv;
37192 }
37193
37194 void  __attribute__((export_name("TS_OpenChannel_set_channel_flags"))) TS_OpenChannel_set_channel_flags(uint64_t this_ptr, int8_t val) {
37195         LDKOpenChannel this_ptr_conv;
37196         this_ptr_conv.inner = untag_ptr(this_ptr);
37197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37199         this_ptr_conv.is_owned = false;
37200         OpenChannel_set_channel_flags(&this_ptr_conv, val);
37201 }
37202
37203 uint64_t  __attribute__((export_name("TS_OpenChannel_get_shutdown_scriptpubkey"))) TS_OpenChannel_get_shutdown_scriptpubkey(uint64_t this_ptr) {
37204         LDKOpenChannel this_ptr_conv;
37205         this_ptr_conv.inner = untag_ptr(this_ptr);
37206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37208         this_ptr_conv.is_owned = false;
37209         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
37210         *ret_copy = OpenChannel_get_shutdown_scriptpubkey(&this_ptr_conv);
37211         uint64_t ret_ref = tag_ptr(ret_copy, true);
37212         return ret_ref;
37213 }
37214
37215 void  __attribute__((export_name("TS_OpenChannel_set_shutdown_scriptpubkey"))) TS_OpenChannel_set_shutdown_scriptpubkey(uint64_t this_ptr, uint64_t val) {
37216         LDKOpenChannel this_ptr_conv;
37217         this_ptr_conv.inner = untag_ptr(this_ptr);
37218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37220         this_ptr_conv.is_owned = false;
37221         void* val_ptr = untag_ptr(val);
37222         CHECK_ACCESS(val_ptr);
37223         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
37224         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
37225         OpenChannel_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
37226 }
37227
37228 uint64_t  __attribute__((export_name("TS_OpenChannel_get_channel_type"))) TS_OpenChannel_get_channel_type(uint64_t this_ptr) {
37229         LDKOpenChannel this_ptr_conv;
37230         this_ptr_conv.inner = untag_ptr(this_ptr);
37231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37233         this_ptr_conv.is_owned = false;
37234         LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
37235         uint64_t ret_ref = 0;
37236         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37237         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37238         return ret_ref;
37239 }
37240
37241 void  __attribute__((export_name("TS_OpenChannel_set_channel_type"))) TS_OpenChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
37242         LDKOpenChannel this_ptr_conv;
37243         this_ptr_conv.inner = untag_ptr(this_ptr);
37244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37246         this_ptr_conv.is_owned = false;
37247         LDKChannelTypeFeatures val_conv;
37248         val_conv.inner = untag_ptr(val);
37249         val_conv.is_owned = ptr_is_owned(val);
37250         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37251         val_conv = ChannelTypeFeatures_clone(&val_conv);
37252         OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
37253 }
37254
37255 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) {
37256         LDKThirtyTwoBytes chain_hash_arg_ref;
37257         CHECK(chain_hash_arg->arr_len == 32);
37258         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
37259         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
37260         CHECK(temporary_channel_id_arg->arr_len == 32);
37261         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
37262         LDKPublicKey funding_pubkey_arg_ref;
37263         CHECK(funding_pubkey_arg->arr_len == 33);
37264         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
37265         LDKPublicKey revocation_basepoint_arg_ref;
37266         CHECK(revocation_basepoint_arg->arr_len == 33);
37267         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
37268         LDKPublicKey payment_point_arg_ref;
37269         CHECK(payment_point_arg->arr_len == 33);
37270         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
37271         LDKPublicKey delayed_payment_basepoint_arg_ref;
37272         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
37273         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
37274         LDKPublicKey htlc_basepoint_arg_ref;
37275         CHECK(htlc_basepoint_arg->arr_len == 33);
37276         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
37277         LDKPublicKey first_per_commitment_point_arg_ref;
37278         CHECK(first_per_commitment_point_arg->arr_len == 33);
37279         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
37280         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
37281         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
37282         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
37283         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
37284         LDKChannelTypeFeatures channel_type_arg_conv;
37285         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
37286         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
37287         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
37288         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
37289         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);
37290         uint64_t ret_ref = 0;
37291         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37292         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37293         return ret_ref;
37294 }
37295
37296 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
37297         LDKOpenChannel ret_var = OpenChannel_clone(arg);
37298         uint64_t ret_ref = 0;
37299         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37300         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37301         return ret_ref;
37302 }
37303 int64_t  __attribute__((export_name("TS_OpenChannel_clone_ptr"))) TS_OpenChannel_clone_ptr(uint64_t arg) {
37304         LDKOpenChannel arg_conv;
37305         arg_conv.inner = untag_ptr(arg);
37306         arg_conv.is_owned = ptr_is_owned(arg);
37307         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37308         arg_conv.is_owned = false;
37309         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
37310         return ret_conv;
37311 }
37312
37313 uint64_t  __attribute__((export_name("TS_OpenChannel_clone"))) TS_OpenChannel_clone(uint64_t orig) {
37314         LDKOpenChannel orig_conv;
37315         orig_conv.inner = untag_ptr(orig);
37316         orig_conv.is_owned = ptr_is_owned(orig);
37317         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37318         orig_conv.is_owned = false;
37319         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
37320         uint64_t ret_ref = 0;
37321         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37322         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37323         return ret_ref;
37324 }
37325
37326 jboolean  __attribute__((export_name("TS_OpenChannel_eq"))) TS_OpenChannel_eq(uint64_t a, uint64_t b) {
37327         LDKOpenChannel a_conv;
37328         a_conv.inner = untag_ptr(a);
37329         a_conv.is_owned = ptr_is_owned(a);
37330         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37331         a_conv.is_owned = false;
37332         LDKOpenChannel b_conv;
37333         b_conv.inner = untag_ptr(b);
37334         b_conv.is_owned = ptr_is_owned(b);
37335         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37336         b_conv.is_owned = false;
37337         jboolean ret_conv = OpenChannel_eq(&a_conv, &b_conv);
37338         return ret_conv;
37339 }
37340
37341 void  __attribute__((export_name("TS_OpenChannelV2_free"))) TS_OpenChannelV2_free(uint64_t this_obj) {
37342         LDKOpenChannelV2 this_obj_conv;
37343         this_obj_conv.inner = untag_ptr(this_obj);
37344         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37346         OpenChannelV2_free(this_obj_conv);
37347 }
37348
37349 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_chain_hash"))) TS_OpenChannelV2_get_chain_hash(uint64_t this_ptr) {
37350         LDKOpenChannelV2 this_ptr_conv;
37351         this_ptr_conv.inner = untag_ptr(this_ptr);
37352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37354         this_ptr_conv.is_owned = false;
37355         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37356         memcpy(ret_arr->elems, *OpenChannelV2_get_chain_hash(&this_ptr_conv), 32);
37357         return ret_arr;
37358 }
37359
37360 void  __attribute__((export_name("TS_OpenChannelV2_set_chain_hash"))) TS_OpenChannelV2_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
37361         LDKOpenChannelV2 this_ptr_conv;
37362         this_ptr_conv.inner = untag_ptr(this_ptr);
37363         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37365         this_ptr_conv.is_owned = false;
37366         LDKThirtyTwoBytes val_ref;
37367         CHECK(val->arr_len == 32);
37368         memcpy(val_ref.data, val->elems, 32); FREE(val);
37369         OpenChannelV2_set_chain_hash(&this_ptr_conv, val_ref);
37370 }
37371
37372 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_temporary_channel_id"))) TS_OpenChannelV2_get_temporary_channel_id(uint64_t this_ptr) {
37373         LDKOpenChannelV2 this_ptr_conv;
37374         this_ptr_conv.inner = untag_ptr(this_ptr);
37375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37377         this_ptr_conv.is_owned = false;
37378         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37379         memcpy(ret_arr->elems, *OpenChannelV2_get_temporary_channel_id(&this_ptr_conv), 32);
37380         return ret_arr;
37381 }
37382
37383 void  __attribute__((export_name("TS_OpenChannelV2_set_temporary_channel_id"))) TS_OpenChannelV2_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
37384         LDKOpenChannelV2 this_ptr_conv;
37385         this_ptr_conv.inner = untag_ptr(this_ptr);
37386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37388         this_ptr_conv.is_owned = false;
37389         LDKThirtyTwoBytes val_ref;
37390         CHECK(val->arr_len == 32);
37391         memcpy(val_ref.data, val->elems, 32); FREE(val);
37392         OpenChannelV2_set_temporary_channel_id(&this_ptr_conv, val_ref);
37393 }
37394
37395 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) {
37396         LDKOpenChannelV2 this_ptr_conv;
37397         this_ptr_conv.inner = untag_ptr(this_ptr);
37398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37400         this_ptr_conv.is_owned = false;
37401         int32_t ret_conv = OpenChannelV2_get_funding_feerate_sat_per_1000_weight(&this_ptr_conv);
37402         return ret_conv;
37403 }
37404
37405 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) {
37406         LDKOpenChannelV2 this_ptr_conv;
37407         this_ptr_conv.inner = untag_ptr(this_ptr);
37408         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37410         this_ptr_conv.is_owned = false;
37411         OpenChannelV2_set_funding_feerate_sat_per_1000_weight(&this_ptr_conv, val);
37412 }
37413
37414 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) {
37415         LDKOpenChannelV2 this_ptr_conv;
37416         this_ptr_conv.inner = untag_ptr(this_ptr);
37417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37419         this_ptr_conv.is_owned = false;
37420         int32_t ret_conv = OpenChannelV2_get_commitment_feerate_sat_per_1000_weight(&this_ptr_conv);
37421         return ret_conv;
37422 }
37423
37424 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) {
37425         LDKOpenChannelV2 this_ptr_conv;
37426         this_ptr_conv.inner = untag_ptr(this_ptr);
37427         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37429         this_ptr_conv.is_owned = false;
37430         OpenChannelV2_set_commitment_feerate_sat_per_1000_weight(&this_ptr_conv, val);
37431 }
37432
37433 int64_t  __attribute__((export_name("TS_OpenChannelV2_get_funding_satoshis"))) TS_OpenChannelV2_get_funding_satoshis(uint64_t this_ptr) {
37434         LDKOpenChannelV2 this_ptr_conv;
37435         this_ptr_conv.inner = untag_ptr(this_ptr);
37436         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37438         this_ptr_conv.is_owned = false;
37439         int64_t ret_conv = OpenChannelV2_get_funding_satoshis(&this_ptr_conv);
37440         return ret_conv;
37441 }
37442
37443 void  __attribute__((export_name("TS_OpenChannelV2_set_funding_satoshis"))) TS_OpenChannelV2_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
37444         LDKOpenChannelV2 this_ptr_conv;
37445         this_ptr_conv.inner = untag_ptr(this_ptr);
37446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37448         this_ptr_conv.is_owned = false;
37449         OpenChannelV2_set_funding_satoshis(&this_ptr_conv, val);
37450 }
37451
37452 int64_t  __attribute__((export_name("TS_OpenChannelV2_get_dust_limit_satoshis"))) TS_OpenChannelV2_get_dust_limit_satoshis(uint64_t this_ptr) {
37453         LDKOpenChannelV2 this_ptr_conv;
37454         this_ptr_conv.inner = untag_ptr(this_ptr);
37455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37457         this_ptr_conv.is_owned = false;
37458         int64_t ret_conv = OpenChannelV2_get_dust_limit_satoshis(&this_ptr_conv);
37459         return ret_conv;
37460 }
37461
37462 void  __attribute__((export_name("TS_OpenChannelV2_set_dust_limit_satoshis"))) TS_OpenChannelV2_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
37463         LDKOpenChannelV2 this_ptr_conv;
37464         this_ptr_conv.inner = untag_ptr(this_ptr);
37465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37467         this_ptr_conv.is_owned = false;
37468         OpenChannelV2_set_dust_limit_satoshis(&this_ptr_conv, val);
37469 }
37470
37471 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) {
37472         LDKOpenChannelV2 this_ptr_conv;
37473         this_ptr_conv.inner = untag_ptr(this_ptr);
37474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37476         this_ptr_conv.is_owned = false;
37477         int64_t ret_conv = OpenChannelV2_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
37478         return ret_conv;
37479 }
37480
37481 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) {
37482         LDKOpenChannelV2 this_ptr_conv;
37483         this_ptr_conv.inner = untag_ptr(this_ptr);
37484         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37486         this_ptr_conv.is_owned = false;
37487         OpenChannelV2_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
37488 }
37489
37490 int64_t  __attribute__((export_name("TS_OpenChannelV2_get_htlc_minimum_msat"))) TS_OpenChannelV2_get_htlc_minimum_msat(uint64_t this_ptr) {
37491         LDKOpenChannelV2 this_ptr_conv;
37492         this_ptr_conv.inner = untag_ptr(this_ptr);
37493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37495         this_ptr_conv.is_owned = false;
37496         int64_t ret_conv = OpenChannelV2_get_htlc_minimum_msat(&this_ptr_conv);
37497         return ret_conv;
37498 }
37499
37500 void  __attribute__((export_name("TS_OpenChannelV2_set_htlc_minimum_msat"))) TS_OpenChannelV2_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
37501         LDKOpenChannelV2 this_ptr_conv;
37502         this_ptr_conv.inner = untag_ptr(this_ptr);
37503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37505         this_ptr_conv.is_owned = false;
37506         OpenChannelV2_set_htlc_minimum_msat(&this_ptr_conv, val);
37507 }
37508
37509 int16_t  __attribute__((export_name("TS_OpenChannelV2_get_to_self_delay"))) TS_OpenChannelV2_get_to_self_delay(uint64_t this_ptr) {
37510         LDKOpenChannelV2 this_ptr_conv;
37511         this_ptr_conv.inner = untag_ptr(this_ptr);
37512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37514         this_ptr_conv.is_owned = false;
37515         int16_t ret_conv = OpenChannelV2_get_to_self_delay(&this_ptr_conv);
37516         return ret_conv;
37517 }
37518
37519 void  __attribute__((export_name("TS_OpenChannelV2_set_to_self_delay"))) TS_OpenChannelV2_set_to_self_delay(uint64_t this_ptr, int16_t val) {
37520         LDKOpenChannelV2 this_ptr_conv;
37521         this_ptr_conv.inner = untag_ptr(this_ptr);
37522         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37524         this_ptr_conv.is_owned = false;
37525         OpenChannelV2_set_to_self_delay(&this_ptr_conv, val);
37526 }
37527
37528 int16_t  __attribute__((export_name("TS_OpenChannelV2_get_max_accepted_htlcs"))) TS_OpenChannelV2_get_max_accepted_htlcs(uint64_t this_ptr) {
37529         LDKOpenChannelV2 this_ptr_conv;
37530         this_ptr_conv.inner = untag_ptr(this_ptr);
37531         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37533         this_ptr_conv.is_owned = false;
37534         int16_t ret_conv = OpenChannelV2_get_max_accepted_htlcs(&this_ptr_conv);
37535         return ret_conv;
37536 }
37537
37538 void  __attribute__((export_name("TS_OpenChannelV2_set_max_accepted_htlcs"))) TS_OpenChannelV2_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
37539         LDKOpenChannelV2 this_ptr_conv;
37540         this_ptr_conv.inner = untag_ptr(this_ptr);
37541         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37543         this_ptr_conv.is_owned = false;
37544         OpenChannelV2_set_max_accepted_htlcs(&this_ptr_conv, val);
37545 }
37546
37547 int32_t  __attribute__((export_name("TS_OpenChannelV2_get_locktime"))) TS_OpenChannelV2_get_locktime(uint64_t this_ptr) {
37548         LDKOpenChannelV2 this_ptr_conv;
37549         this_ptr_conv.inner = untag_ptr(this_ptr);
37550         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37552         this_ptr_conv.is_owned = false;
37553         int32_t ret_conv = OpenChannelV2_get_locktime(&this_ptr_conv);
37554         return ret_conv;
37555 }
37556
37557 void  __attribute__((export_name("TS_OpenChannelV2_set_locktime"))) TS_OpenChannelV2_set_locktime(uint64_t this_ptr, int32_t val) {
37558         LDKOpenChannelV2 this_ptr_conv;
37559         this_ptr_conv.inner = untag_ptr(this_ptr);
37560         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37562         this_ptr_conv.is_owned = false;
37563         OpenChannelV2_set_locktime(&this_ptr_conv, val);
37564 }
37565
37566 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_funding_pubkey"))) TS_OpenChannelV2_get_funding_pubkey(uint64_t this_ptr) {
37567         LDKOpenChannelV2 this_ptr_conv;
37568         this_ptr_conv.inner = untag_ptr(this_ptr);
37569         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37571         this_ptr_conv.is_owned = false;
37572         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37573         memcpy(ret_arr->elems, OpenChannelV2_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
37574         return ret_arr;
37575 }
37576
37577 void  __attribute__((export_name("TS_OpenChannelV2_set_funding_pubkey"))) TS_OpenChannelV2_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
37578         LDKOpenChannelV2 this_ptr_conv;
37579         this_ptr_conv.inner = untag_ptr(this_ptr);
37580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37582         this_ptr_conv.is_owned = false;
37583         LDKPublicKey val_ref;
37584         CHECK(val->arr_len == 33);
37585         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37586         OpenChannelV2_set_funding_pubkey(&this_ptr_conv, val_ref);
37587 }
37588
37589 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_revocation_basepoint"))) TS_OpenChannelV2_get_revocation_basepoint(uint64_t this_ptr) {
37590         LDKOpenChannelV2 this_ptr_conv;
37591         this_ptr_conv.inner = untag_ptr(this_ptr);
37592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37594         this_ptr_conv.is_owned = false;
37595         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37596         memcpy(ret_arr->elems, OpenChannelV2_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
37597         return ret_arr;
37598 }
37599
37600 void  __attribute__((export_name("TS_OpenChannelV2_set_revocation_basepoint"))) TS_OpenChannelV2_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
37601         LDKOpenChannelV2 this_ptr_conv;
37602         this_ptr_conv.inner = untag_ptr(this_ptr);
37603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37605         this_ptr_conv.is_owned = false;
37606         LDKPublicKey val_ref;
37607         CHECK(val->arr_len == 33);
37608         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37609         OpenChannelV2_set_revocation_basepoint(&this_ptr_conv, val_ref);
37610 }
37611
37612 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_payment_basepoint"))) TS_OpenChannelV2_get_payment_basepoint(uint64_t this_ptr) {
37613         LDKOpenChannelV2 this_ptr_conv;
37614         this_ptr_conv.inner = untag_ptr(this_ptr);
37615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37617         this_ptr_conv.is_owned = false;
37618         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37619         memcpy(ret_arr->elems, OpenChannelV2_get_payment_basepoint(&this_ptr_conv).compressed_form, 33);
37620         return ret_arr;
37621 }
37622
37623 void  __attribute__((export_name("TS_OpenChannelV2_set_payment_basepoint"))) TS_OpenChannelV2_set_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
37624         LDKOpenChannelV2 this_ptr_conv;
37625         this_ptr_conv.inner = untag_ptr(this_ptr);
37626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37628         this_ptr_conv.is_owned = false;
37629         LDKPublicKey val_ref;
37630         CHECK(val->arr_len == 33);
37631         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37632         OpenChannelV2_set_payment_basepoint(&this_ptr_conv, val_ref);
37633 }
37634
37635 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_delayed_payment_basepoint"))) TS_OpenChannelV2_get_delayed_payment_basepoint(uint64_t this_ptr) {
37636         LDKOpenChannelV2 this_ptr_conv;
37637         this_ptr_conv.inner = untag_ptr(this_ptr);
37638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37640         this_ptr_conv.is_owned = false;
37641         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37642         memcpy(ret_arr->elems, OpenChannelV2_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
37643         return ret_arr;
37644 }
37645
37646 void  __attribute__((export_name("TS_OpenChannelV2_set_delayed_payment_basepoint"))) TS_OpenChannelV2_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
37647         LDKOpenChannelV2 this_ptr_conv;
37648         this_ptr_conv.inner = untag_ptr(this_ptr);
37649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37651         this_ptr_conv.is_owned = false;
37652         LDKPublicKey val_ref;
37653         CHECK(val->arr_len == 33);
37654         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37655         OpenChannelV2_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
37656 }
37657
37658 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_htlc_basepoint"))) TS_OpenChannelV2_get_htlc_basepoint(uint64_t this_ptr) {
37659         LDKOpenChannelV2 this_ptr_conv;
37660         this_ptr_conv.inner = untag_ptr(this_ptr);
37661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37663         this_ptr_conv.is_owned = false;
37664         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37665         memcpy(ret_arr->elems, OpenChannelV2_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
37666         return ret_arr;
37667 }
37668
37669 void  __attribute__((export_name("TS_OpenChannelV2_set_htlc_basepoint"))) TS_OpenChannelV2_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
37670         LDKOpenChannelV2 this_ptr_conv;
37671         this_ptr_conv.inner = untag_ptr(this_ptr);
37672         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37674         this_ptr_conv.is_owned = false;
37675         LDKPublicKey val_ref;
37676         CHECK(val->arr_len == 33);
37677         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37678         OpenChannelV2_set_htlc_basepoint(&this_ptr_conv, val_ref);
37679 }
37680
37681 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_first_per_commitment_point"))) TS_OpenChannelV2_get_first_per_commitment_point(uint64_t this_ptr) {
37682         LDKOpenChannelV2 this_ptr_conv;
37683         this_ptr_conv.inner = untag_ptr(this_ptr);
37684         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37686         this_ptr_conv.is_owned = false;
37687         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37688         memcpy(ret_arr->elems, OpenChannelV2_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
37689         return ret_arr;
37690 }
37691
37692 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) {
37693         LDKOpenChannelV2 this_ptr_conv;
37694         this_ptr_conv.inner = untag_ptr(this_ptr);
37695         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37697         this_ptr_conv.is_owned = false;
37698         LDKPublicKey val_ref;
37699         CHECK(val->arr_len == 33);
37700         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37701         OpenChannelV2_set_first_per_commitment_point(&this_ptr_conv, val_ref);
37702 }
37703
37704 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_second_per_commitment_point"))) TS_OpenChannelV2_get_second_per_commitment_point(uint64_t this_ptr) {
37705         LDKOpenChannelV2 this_ptr_conv;
37706         this_ptr_conv.inner = untag_ptr(this_ptr);
37707         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37709         this_ptr_conv.is_owned = false;
37710         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37711         memcpy(ret_arr->elems, OpenChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form, 33);
37712         return ret_arr;
37713 }
37714
37715 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) {
37716         LDKOpenChannelV2 this_ptr_conv;
37717         this_ptr_conv.inner = untag_ptr(this_ptr);
37718         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37720         this_ptr_conv.is_owned = false;
37721         LDKPublicKey val_ref;
37722         CHECK(val->arr_len == 33);
37723         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37724         OpenChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
37725 }
37726
37727 int8_t  __attribute__((export_name("TS_OpenChannelV2_get_channel_flags"))) TS_OpenChannelV2_get_channel_flags(uint64_t this_ptr) {
37728         LDKOpenChannelV2 this_ptr_conv;
37729         this_ptr_conv.inner = untag_ptr(this_ptr);
37730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37732         this_ptr_conv.is_owned = false;
37733         int8_t ret_conv = OpenChannelV2_get_channel_flags(&this_ptr_conv);
37734         return ret_conv;
37735 }
37736
37737 void  __attribute__((export_name("TS_OpenChannelV2_set_channel_flags"))) TS_OpenChannelV2_set_channel_flags(uint64_t this_ptr, int8_t val) {
37738         LDKOpenChannelV2 this_ptr_conv;
37739         this_ptr_conv.inner = untag_ptr(this_ptr);
37740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37742         this_ptr_conv.is_owned = false;
37743         OpenChannelV2_set_channel_flags(&this_ptr_conv, val);
37744 }
37745
37746 uint64_t  __attribute__((export_name("TS_OpenChannelV2_get_shutdown_scriptpubkey"))) TS_OpenChannelV2_get_shutdown_scriptpubkey(uint64_t this_ptr) {
37747         LDKOpenChannelV2 this_ptr_conv;
37748         this_ptr_conv.inner = untag_ptr(this_ptr);
37749         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37751         this_ptr_conv.is_owned = false;
37752         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
37753         *ret_copy = OpenChannelV2_get_shutdown_scriptpubkey(&this_ptr_conv);
37754         uint64_t ret_ref = tag_ptr(ret_copy, true);
37755         return ret_ref;
37756 }
37757
37758 void  __attribute__((export_name("TS_OpenChannelV2_set_shutdown_scriptpubkey"))) TS_OpenChannelV2_set_shutdown_scriptpubkey(uint64_t this_ptr, uint64_t val) {
37759         LDKOpenChannelV2 this_ptr_conv;
37760         this_ptr_conv.inner = untag_ptr(this_ptr);
37761         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37763         this_ptr_conv.is_owned = false;
37764         void* val_ptr = untag_ptr(val);
37765         CHECK_ACCESS(val_ptr);
37766         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
37767         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
37768         OpenChannelV2_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
37769 }
37770
37771 uint64_t  __attribute__((export_name("TS_OpenChannelV2_get_channel_type"))) TS_OpenChannelV2_get_channel_type(uint64_t this_ptr) {
37772         LDKOpenChannelV2 this_ptr_conv;
37773         this_ptr_conv.inner = untag_ptr(this_ptr);
37774         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37776         this_ptr_conv.is_owned = false;
37777         LDKChannelTypeFeatures ret_var = OpenChannelV2_get_channel_type(&this_ptr_conv);
37778         uint64_t ret_ref = 0;
37779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37781         return ret_ref;
37782 }
37783
37784 void  __attribute__((export_name("TS_OpenChannelV2_set_channel_type"))) TS_OpenChannelV2_set_channel_type(uint64_t this_ptr, uint64_t val) {
37785         LDKOpenChannelV2 this_ptr_conv;
37786         this_ptr_conv.inner = untag_ptr(this_ptr);
37787         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37789         this_ptr_conv.is_owned = false;
37790         LDKChannelTypeFeatures val_conv;
37791         val_conv.inner = untag_ptr(val);
37792         val_conv.is_owned = ptr_is_owned(val);
37793         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37794         val_conv = ChannelTypeFeatures_clone(&val_conv);
37795         OpenChannelV2_set_channel_type(&this_ptr_conv, val_conv);
37796 }
37797
37798 uint32_t  __attribute__((export_name("TS_OpenChannelV2_get_require_confirmed_inputs"))) TS_OpenChannelV2_get_require_confirmed_inputs(uint64_t this_ptr) {
37799         LDKOpenChannelV2 this_ptr_conv;
37800         this_ptr_conv.inner = untag_ptr(this_ptr);
37801         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37803         this_ptr_conv.is_owned = false;
37804         uint32_t ret_conv = LDKCOption_NoneZ_to_js(OpenChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
37805         return ret_conv;
37806 }
37807
37808 void  __attribute__((export_name("TS_OpenChannelV2_set_require_confirmed_inputs"))) TS_OpenChannelV2_set_require_confirmed_inputs(uint64_t this_ptr, uint32_t val) {
37809         LDKOpenChannelV2 this_ptr_conv;
37810         this_ptr_conv.inner = untag_ptr(this_ptr);
37811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37813         this_ptr_conv.is_owned = false;
37814         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
37815         OpenChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
37816 }
37817
37818 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) {
37819         LDKThirtyTwoBytes chain_hash_arg_ref;
37820         CHECK(chain_hash_arg->arr_len == 32);
37821         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
37822         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
37823         CHECK(temporary_channel_id_arg->arr_len == 32);
37824         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
37825         LDKPublicKey funding_pubkey_arg_ref;
37826         CHECK(funding_pubkey_arg->arr_len == 33);
37827         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
37828         LDKPublicKey revocation_basepoint_arg_ref;
37829         CHECK(revocation_basepoint_arg->arr_len == 33);
37830         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
37831         LDKPublicKey payment_basepoint_arg_ref;
37832         CHECK(payment_basepoint_arg->arr_len == 33);
37833         memcpy(payment_basepoint_arg_ref.compressed_form, payment_basepoint_arg->elems, 33); FREE(payment_basepoint_arg);
37834         LDKPublicKey delayed_payment_basepoint_arg_ref;
37835         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
37836         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
37837         LDKPublicKey htlc_basepoint_arg_ref;
37838         CHECK(htlc_basepoint_arg->arr_len == 33);
37839         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
37840         LDKPublicKey first_per_commitment_point_arg_ref;
37841         CHECK(first_per_commitment_point_arg->arr_len == 33);
37842         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
37843         LDKPublicKey second_per_commitment_point_arg_ref;
37844         CHECK(second_per_commitment_point_arg->arr_len == 33);
37845         memcpy(second_per_commitment_point_arg_ref.compressed_form, second_per_commitment_point_arg->elems, 33); FREE(second_per_commitment_point_arg);
37846         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
37847         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
37848         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
37849         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
37850         LDKChannelTypeFeatures channel_type_arg_conv;
37851         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
37852         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
37853         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
37854         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
37855         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_js(require_confirmed_inputs_arg);
37856         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);
37857         uint64_t ret_ref = 0;
37858         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37859         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37860         return ret_ref;
37861 }
37862
37863 static inline uint64_t OpenChannelV2_clone_ptr(LDKOpenChannelV2 *NONNULL_PTR arg) {
37864         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(arg);
37865         uint64_t ret_ref = 0;
37866         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37867         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37868         return ret_ref;
37869 }
37870 int64_t  __attribute__((export_name("TS_OpenChannelV2_clone_ptr"))) TS_OpenChannelV2_clone_ptr(uint64_t arg) {
37871         LDKOpenChannelV2 arg_conv;
37872         arg_conv.inner = untag_ptr(arg);
37873         arg_conv.is_owned = ptr_is_owned(arg);
37874         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37875         arg_conv.is_owned = false;
37876         int64_t ret_conv = OpenChannelV2_clone_ptr(&arg_conv);
37877         return ret_conv;
37878 }
37879
37880 uint64_t  __attribute__((export_name("TS_OpenChannelV2_clone"))) TS_OpenChannelV2_clone(uint64_t orig) {
37881         LDKOpenChannelV2 orig_conv;
37882         orig_conv.inner = untag_ptr(orig);
37883         orig_conv.is_owned = ptr_is_owned(orig);
37884         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37885         orig_conv.is_owned = false;
37886         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(&orig_conv);
37887         uint64_t ret_ref = 0;
37888         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37889         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37890         return ret_ref;
37891 }
37892
37893 jboolean  __attribute__((export_name("TS_OpenChannelV2_eq"))) TS_OpenChannelV2_eq(uint64_t a, uint64_t b) {
37894         LDKOpenChannelV2 a_conv;
37895         a_conv.inner = untag_ptr(a);
37896         a_conv.is_owned = ptr_is_owned(a);
37897         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37898         a_conv.is_owned = false;
37899         LDKOpenChannelV2 b_conv;
37900         b_conv.inner = untag_ptr(b);
37901         b_conv.is_owned = ptr_is_owned(b);
37902         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37903         b_conv.is_owned = false;
37904         jboolean ret_conv = OpenChannelV2_eq(&a_conv, &b_conv);
37905         return ret_conv;
37906 }
37907
37908 void  __attribute__((export_name("TS_AcceptChannel_free"))) TS_AcceptChannel_free(uint64_t this_obj) {
37909         LDKAcceptChannel this_obj_conv;
37910         this_obj_conv.inner = untag_ptr(this_obj);
37911         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37913         AcceptChannel_free(this_obj_conv);
37914 }
37915
37916 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_temporary_channel_id"))) TS_AcceptChannel_get_temporary_channel_id(uint64_t this_ptr) {
37917         LDKAcceptChannel this_ptr_conv;
37918         this_ptr_conv.inner = untag_ptr(this_ptr);
37919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37921         this_ptr_conv.is_owned = false;
37922         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37923         memcpy(ret_arr->elems, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
37924         return ret_arr;
37925 }
37926
37927 void  __attribute__((export_name("TS_AcceptChannel_set_temporary_channel_id"))) TS_AcceptChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
37928         LDKAcceptChannel this_ptr_conv;
37929         this_ptr_conv.inner = untag_ptr(this_ptr);
37930         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37932         this_ptr_conv.is_owned = false;
37933         LDKThirtyTwoBytes val_ref;
37934         CHECK(val->arr_len == 32);
37935         memcpy(val_ref.data, val->elems, 32); FREE(val);
37936         AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
37937 }
37938
37939 int64_t  __attribute__((export_name("TS_AcceptChannel_get_dust_limit_satoshis"))) TS_AcceptChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
37940         LDKAcceptChannel this_ptr_conv;
37941         this_ptr_conv.inner = untag_ptr(this_ptr);
37942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37944         this_ptr_conv.is_owned = false;
37945         int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
37946         return ret_conv;
37947 }
37948
37949 void  __attribute__((export_name("TS_AcceptChannel_set_dust_limit_satoshis"))) TS_AcceptChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
37950         LDKAcceptChannel this_ptr_conv;
37951         this_ptr_conv.inner = untag_ptr(this_ptr);
37952         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37954         this_ptr_conv.is_owned = false;
37955         AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
37956 }
37957
37958 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) {
37959         LDKAcceptChannel this_ptr_conv;
37960         this_ptr_conv.inner = untag_ptr(this_ptr);
37961         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37963         this_ptr_conv.is_owned = false;
37964         int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
37965         return ret_conv;
37966 }
37967
37968 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) {
37969         LDKAcceptChannel this_ptr_conv;
37970         this_ptr_conv.inner = untag_ptr(this_ptr);
37971         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37973         this_ptr_conv.is_owned = false;
37974         AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
37975 }
37976
37977 int64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_reserve_satoshis"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
37978         LDKAcceptChannel this_ptr_conv;
37979         this_ptr_conv.inner = untag_ptr(this_ptr);
37980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37982         this_ptr_conv.is_owned = false;
37983         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
37984         return ret_conv;
37985 }
37986
37987 void  __attribute__((export_name("TS_AcceptChannel_set_channel_reserve_satoshis"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
37988         LDKAcceptChannel this_ptr_conv;
37989         this_ptr_conv.inner = untag_ptr(this_ptr);
37990         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37992         this_ptr_conv.is_owned = false;
37993         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
37994 }
37995
37996 int64_t  __attribute__((export_name("TS_AcceptChannel_get_htlc_minimum_msat"))) TS_AcceptChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
37997         LDKAcceptChannel this_ptr_conv;
37998         this_ptr_conv.inner = untag_ptr(this_ptr);
37999         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38001         this_ptr_conv.is_owned = false;
38002         int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
38003         return ret_conv;
38004 }
38005
38006 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_minimum_msat"))) TS_AcceptChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
38007         LDKAcceptChannel this_ptr_conv;
38008         this_ptr_conv.inner = untag_ptr(this_ptr);
38009         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38011         this_ptr_conv.is_owned = false;
38012         AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
38013 }
38014
38015 int32_t  __attribute__((export_name("TS_AcceptChannel_get_minimum_depth"))) TS_AcceptChannel_get_minimum_depth(uint64_t this_ptr) {
38016         LDKAcceptChannel this_ptr_conv;
38017         this_ptr_conv.inner = untag_ptr(this_ptr);
38018         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38020         this_ptr_conv.is_owned = false;
38021         int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
38022         return ret_conv;
38023 }
38024
38025 void  __attribute__((export_name("TS_AcceptChannel_set_minimum_depth"))) TS_AcceptChannel_set_minimum_depth(uint64_t this_ptr, int32_t val) {
38026         LDKAcceptChannel this_ptr_conv;
38027         this_ptr_conv.inner = untag_ptr(this_ptr);
38028         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38030         this_ptr_conv.is_owned = false;
38031         AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
38032 }
38033
38034 int16_t  __attribute__((export_name("TS_AcceptChannel_get_to_self_delay"))) TS_AcceptChannel_get_to_self_delay(uint64_t this_ptr) {
38035         LDKAcceptChannel this_ptr_conv;
38036         this_ptr_conv.inner = untag_ptr(this_ptr);
38037         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38039         this_ptr_conv.is_owned = false;
38040         int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
38041         return ret_conv;
38042 }
38043
38044 void  __attribute__((export_name("TS_AcceptChannel_set_to_self_delay"))) TS_AcceptChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
38045         LDKAcceptChannel this_ptr_conv;
38046         this_ptr_conv.inner = untag_ptr(this_ptr);
38047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38049         this_ptr_conv.is_owned = false;
38050         AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
38051 }
38052
38053 int16_t  __attribute__((export_name("TS_AcceptChannel_get_max_accepted_htlcs"))) TS_AcceptChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
38054         LDKAcceptChannel this_ptr_conv;
38055         this_ptr_conv.inner = untag_ptr(this_ptr);
38056         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38058         this_ptr_conv.is_owned = false;
38059         int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
38060         return ret_conv;
38061 }
38062
38063 void  __attribute__((export_name("TS_AcceptChannel_set_max_accepted_htlcs"))) TS_AcceptChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
38064         LDKAcceptChannel this_ptr_conv;
38065         this_ptr_conv.inner = untag_ptr(this_ptr);
38066         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38068         this_ptr_conv.is_owned = false;
38069         AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
38070 }
38071
38072 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_funding_pubkey"))) TS_AcceptChannel_get_funding_pubkey(uint64_t this_ptr) {
38073         LDKAcceptChannel this_ptr_conv;
38074         this_ptr_conv.inner = untag_ptr(this_ptr);
38075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38077         this_ptr_conv.is_owned = false;
38078         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38079         memcpy(ret_arr->elems, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
38080         return ret_arr;
38081 }
38082
38083 void  __attribute__((export_name("TS_AcceptChannel_set_funding_pubkey"))) TS_AcceptChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
38084         LDKAcceptChannel this_ptr_conv;
38085         this_ptr_conv.inner = untag_ptr(this_ptr);
38086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38088         this_ptr_conv.is_owned = false;
38089         LDKPublicKey val_ref;
38090         CHECK(val->arr_len == 33);
38091         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38092         AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
38093 }
38094
38095 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_revocation_basepoint"))) TS_AcceptChannel_get_revocation_basepoint(uint64_t this_ptr) {
38096         LDKAcceptChannel this_ptr_conv;
38097         this_ptr_conv.inner = untag_ptr(this_ptr);
38098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38100         this_ptr_conv.is_owned = false;
38101         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38102         memcpy(ret_arr->elems, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
38103         return ret_arr;
38104 }
38105
38106 void  __attribute__((export_name("TS_AcceptChannel_set_revocation_basepoint"))) TS_AcceptChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
38107         LDKAcceptChannel this_ptr_conv;
38108         this_ptr_conv.inner = untag_ptr(this_ptr);
38109         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38111         this_ptr_conv.is_owned = false;
38112         LDKPublicKey val_ref;
38113         CHECK(val->arr_len == 33);
38114         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38115         AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
38116 }
38117
38118 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_payment_point"))) TS_AcceptChannel_get_payment_point(uint64_t this_ptr) {
38119         LDKAcceptChannel this_ptr_conv;
38120         this_ptr_conv.inner = untag_ptr(this_ptr);
38121         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38123         this_ptr_conv.is_owned = false;
38124         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38125         memcpy(ret_arr->elems, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
38126         return ret_arr;
38127 }
38128
38129 void  __attribute__((export_name("TS_AcceptChannel_set_payment_point"))) TS_AcceptChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
38130         LDKAcceptChannel this_ptr_conv;
38131         this_ptr_conv.inner = untag_ptr(this_ptr);
38132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38134         this_ptr_conv.is_owned = false;
38135         LDKPublicKey val_ref;
38136         CHECK(val->arr_len == 33);
38137         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38138         AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
38139 }
38140
38141 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_delayed_payment_basepoint"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
38142         LDKAcceptChannel this_ptr_conv;
38143         this_ptr_conv.inner = untag_ptr(this_ptr);
38144         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38146         this_ptr_conv.is_owned = false;
38147         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38148         memcpy(ret_arr->elems, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
38149         return ret_arr;
38150 }
38151
38152 void  __attribute__((export_name("TS_AcceptChannel_set_delayed_payment_basepoint"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
38153         LDKAcceptChannel this_ptr_conv;
38154         this_ptr_conv.inner = untag_ptr(this_ptr);
38155         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38157         this_ptr_conv.is_owned = false;
38158         LDKPublicKey val_ref;
38159         CHECK(val->arr_len == 33);
38160         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38161         AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
38162 }
38163
38164 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_htlc_basepoint"))) TS_AcceptChannel_get_htlc_basepoint(uint64_t this_ptr) {
38165         LDKAcceptChannel this_ptr_conv;
38166         this_ptr_conv.inner = untag_ptr(this_ptr);
38167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38169         this_ptr_conv.is_owned = false;
38170         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38171         memcpy(ret_arr->elems, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
38172         return ret_arr;
38173 }
38174
38175 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_basepoint"))) TS_AcceptChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
38176         LDKAcceptChannel this_ptr_conv;
38177         this_ptr_conv.inner = untag_ptr(this_ptr);
38178         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38180         this_ptr_conv.is_owned = false;
38181         LDKPublicKey val_ref;
38182         CHECK(val->arr_len == 33);
38183         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38184         AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
38185 }
38186
38187 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_first_per_commitment_point"))) TS_AcceptChannel_get_first_per_commitment_point(uint64_t this_ptr) {
38188         LDKAcceptChannel this_ptr_conv;
38189         this_ptr_conv.inner = untag_ptr(this_ptr);
38190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38192         this_ptr_conv.is_owned = false;
38193         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38194         memcpy(ret_arr->elems, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
38195         return ret_arr;
38196 }
38197
38198 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) {
38199         LDKAcceptChannel this_ptr_conv;
38200         this_ptr_conv.inner = untag_ptr(this_ptr);
38201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38203         this_ptr_conv.is_owned = false;
38204         LDKPublicKey val_ref;
38205         CHECK(val->arr_len == 33);
38206         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38207         AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
38208 }
38209
38210 uint64_t  __attribute__((export_name("TS_AcceptChannel_get_shutdown_scriptpubkey"))) TS_AcceptChannel_get_shutdown_scriptpubkey(uint64_t this_ptr) {
38211         LDKAcceptChannel this_ptr_conv;
38212         this_ptr_conv.inner = untag_ptr(this_ptr);
38213         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38215         this_ptr_conv.is_owned = false;
38216         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
38217         *ret_copy = AcceptChannel_get_shutdown_scriptpubkey(&this_ptr_conv);
38218         uint64_t ret_ref = tag_ptr(ret_copy, true);
38219         return ret_ref;
38220 }
38221
38222 void  __attribute__((export_name("TS_AcceptChannel_set_shutdown_scriptpubkey"))) TS_AcceptChannel_set_shutdown_scriptpubkey(uint64_t this_ptr, uint64_t val) {
38223         LDKAcceptChannel this_ptr_conv;
38224         this_ptr_conv.inner = untag_ptr(this_ptr);
38225         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38227         this_ptr_conv.is_owned = false;
38228         void* val_ptr = untag_ptr(val);
38229         CHECK_ACCESS(val_ptr);
38230         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
38231         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
38232         AcceptChannel_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
38233 }
38234
38235 uint64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_type"))) TS_AcceptChannel_get_channel_type(uint64_t this_ptr) {
38236         LDKAcceptChannel this_ptr_conv;
38237         this_ptr_conv.inner = untag_ptr(this_ptr);
38238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38240         this_ptr_conv.is_owned = false;
38241         LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
38242         uint64_t ret_ref = 0;
38243         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38244         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38245         return ret_ref;
38246 }
38247
38248 void  __attribute__((export_name("TS_AcceptChannel_set_channel_type"))) TS_AcceptChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
38249         LDKAcceptChannel this_ptr_conv;
38250         this_ptr_conv.inner = untag_ptr(this_ptr);
38251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38253         this_ptr_conv.is_owned = false;
38254         LDKChannelTypeFeatures val_conv;
38255         val_conv.inner = untag_ptr(val);
38256         val_conv.is_owned = ptr_is_owned(val);
38257         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38258         val_conv = ChannelTypeFeatures_clone(&val_conv);
38259         AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
38260 }
38261
38262 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) {
38263         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
38264         CHECK(temporary_channel_id_arg->arr_len == 32);
38265         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
38266         LDKPublicKey funding_pubkey_arg_ref;
38267         CHECK(funding_pubkey_arg->arr_len == 33);
38268         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
38269         LDKPublicKey revocation_basepoint_arg_ref;
38270         CHECK(revocation_basepoint_arg->arr_len == 33);
38271         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
38272         LDKPublicKey payment_point_arg_ref;
38273         CHECK(payment_point_arg->arr_len == 33);
38274         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
38275         LDKPublicKey delayed_payment_basepoint_arg_ref;
38276         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
38277         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
38278         LDKPublicKey htlc_basepoint_arg_ref;
38279         CHECK(htlc_basepoint_arg->arr_len == 33);
38280         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
38281         LDKPublicKey first_per_commitment_point_arg_ref;
38282         CHECK(first_per_commitment_point_arg->arr_len == 33);
38283         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
38284         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
38285         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
38286         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
38287         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
38288         LDKChannelTypeFeatures channel_type_arg_conv;
38289         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
38290         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
38291         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
38292         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
38293         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);
38294         uint64_t ret_ref = 0;
38295         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38296         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38297         return ret_ref;
38298 }
38299
38300 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
38301         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
38302         uint64_t ret_ref = 0;
38303         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38304         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38305         return ret_ref;
38306 }
38307 int64_t  __attribute__((export_name("TS_AcceptChannel_clone_ptr"))) TS_AcceptChannel_clone_ptr(uint64_t arg) {
38308         LDKAcceptChannel arg_conv;
38309         arg_conv.inner = untag_ptr(arg);
38310         arg_conv.is_owned = ptr_is_owned(arg);
38311         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38312         arg_conv.is_owned = false;
38313         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
38314         return ret_conv;
38315 }
38316
38317 uint64_t  __attribute__((export_name("TS_AcceptChannel_clone"))) TS_AcceptChannel_clone(uint64_t orig) {
38318         LDKAcceptChannel orig_conv;
38319         orig_conv.inner = untag_ptr(orig);
38320         orig_conv.is_owned = ptr_is_owned(orig);
38321         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38322         orig_conv.is_owned = false;
38323         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
38324         uint64_t ret_ref = 0;
38325         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38326         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38327         return ret_ref;
38328 }
38329
38330 jboolean  __attribute__((export_name("TS_AcceptChannel_eq"))) TS_AcceptChannel_eq(uint64_t a, uint64_t b) {
38331         LDKAcceptChannel a_conv;
38332         a_conv.inner = untag_ptr(a);
38333         a_conv.is_owned = ptr_is_owned(a);
38334         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38335         a_conv.is_owned = false;
38336         LDKAcceptChannel b_conv;
38337         b_conv.inner = untag_ptr(b);
38338         b_conv.is_owned = ptr_is_owned(b);
38339         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38340         b_conv.is_owned = false;
38341         jboolean ret_conv = AcceptChannel_eq(&a_conv, &b_conv);
38342         return ret_conv;
38343 }
38344
38345 void  __attribute__((export_name("TS_AcceptChannelV2_free"))) TS_AcceptChannelV2_free(uint64_t this_obj) {
38346         LDKAcceptChannelV2 this_obj_conv;
38347         this_obj_conv.inner = untag_ptr(this_obj);
38348         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38350         AcceptChannelV2_free(this_obj_conv);
38351 }
38352
38353 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_temporary_channel_id"))) TS_AcceptChannelV2_get_temporary_channel_id(uint64_t this_ptr) {
38354         LDKAcceptChannelV2 this_ptr_conv;
38355         this_ptr_conv.inner = untag_ptr(this_ptr);
38356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38358         this_ptr_conv.is_owned = false;
38359         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38360         memcpy(ret_arr->elems, *AcceptChannelV2_get_temporary_channel_id(&this_ptr_conv), 32);
38361         return ret_arr;
38362 }
38363
38364 void  __attribute__((export_name("TS_AcceptChannelV2_set_temporary_channel_id"))) TS_AcceptChannelV2_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
38365         LDKAcceptChannelV2 this_ptr_conv;
38366         this_ptr_conv.inner = untag_ptr(this_ptr);
38367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38369         this_ptr_conv.is_owned = false;
38370         LDKThirtyTwoBytes val_ref;
38371         CHECK(val->arr_len == 32);
38372         memcpy(val_ref.data, val->elems, 32); FREE(val);
38373         AcceptChannelV2_set_temporary_channel_id(&this_ptr_conv, val_ref);
38374 }
38375
38376 int64_t  __attribute__((export_name("TS_AcceptChannelV2_get_funding_satoshis"))) TS_AcceptChannelV2_get_funding_satoshis(uint64_t this_ptr) {
38377         LDKAcceptChannelV2 this_ptr_conv;
38378         this_ptr_conv.inner = untag_ptr(this_ptr);
38379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38381         this_ptr_conv.is_owned = false;
38382         int64_t ret_conv = AcceptChannelV2_get_funding_satoshis(&this_ptr_conv);
38383         return ret_conv;
38384 }
38385
38386 void  __attribute__((export_name("TS_AcceptChannelV2_set_funding_satoshis"))) TS_AcceptChannelV2_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
38387         LDKAcceptChannelV2 this_ptr_conv;
38388         this_ptr_conv.inner = untag_ptr(this_ptr);
38389         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38391         this_ptr_conv.is_owned = false;
38392         AcceptChannelV2_set_funding_satoshis(&this_ptr_conv, val);
38393 }
38394
38395 int64_t  __attribute__((export_name("TS_AcceptChannelV2_get_dust_limit_satoshis"))) TS_AcceptChannelV2_get_dust_limit_satoshis(uint64_t this_ptr) {
38396         LDKAcceptChannelV2 this_ptr_conv;
38397         this_ptr_conv.inner = untag_ptr(this_ptr);
38398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38400         this_ptr_conv.is_owned = false;
38401         int64_t ret_conv = AcceptChannelV2_get_dust_limit_satoshis(&this_ptr_conv);
38402         return ret_conv;
38403 }
38404
38405 void  __attribute__((export_name("TS_AcceptChannelV2_set_dust_limit_satoshis"))) TS_AcceptChannelV2_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
38406         LDKAcceptChannelV2 this_ptr_conv;
38407         this_ptr_conv.inner = untag_ptr(this_ptr);
38408         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38410         this_ptr_conv.is_owned = false;
38411         AcceptChannelV2_set_dust_limit_satoshis(&this_ptr_conv, val);
38412 }
38413
38414 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) {
38415         LDKAcceptChannelV2 this_ptr_conv;
38416         this_ptr_conv.inner = untag_ptr(this_ptr);
38417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38419         this_ptr_conv.is_owned = false;
38420         int64_t ret_conv = AcceptChannelV2_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
38421         return ret_conv;
38422 }
38423
38424 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) {
38425         LDKAcceptChannelV2 this_ptr_conv;
38426         this_ptr_conv.inner = untag_ptr(this_ptr);
38427         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38429         this_ptr_conv.is_owned = false;
38430         AcceptChannelV2_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
38431 }
38432
38433 int64_t  __attribute__((export_name("TS_AcceptChannelV2_get_htlc_minimum_msat"))) TS_AcceptChannelV2_get_htlc_minimum_msat(uint64_t this_ptr) {
38434         LDKAcceptChannelV2 this_ptr_conv;
38435         this_ptr_conv.inner = untag_ptr(this_ptr);
38436         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38438         this_ptr_conv.is_owned = false;
38439         int64_t ret_conv = AcceptChannelV2_get_htlc_minimum_msat(&this_ptr_conv);
38440         return ret_conv;
38441 }
38442
38443 void  __attribute__((export_name("TS_AcceptChannelV2_set_htlc_minimum_msat"))) TS_AcceptChannelV2_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
38444         LDKAcceptChannelV2 this_ptr_conv;
38445         this_ptr_conv.inner = untag_ptr(this_ptr);
38446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38448         this_ptr_conv.is_owned = false;
38449         AcceptChannelV2_set_htlc_minimum_msat(&this_ptr_conv, val);
38450 }
38451
38452 int32_t  __attribute__((export_name("TS_AcceptChannelV2_get_minimum_depth"))) TS_AcceptChannelV2_get_minimum_depth(uint64_t this_ptr) {
38453         LDKAcceptChannelV2 this_ptr_conv;
38454         this_ptr_conv.inner = untag_ptr(this_ptr);
38455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38457         this_ptr_conv.is_owned = false;
38458         int32_t ret_conv = AcceptChannelV2_get_minimum_depth(&this_ptr_conv);
38459         return ret_conv;
38460 }
38461
38462 void  __attribute__((export_name("TS_AcceptChannelV2_set_minimum_depth"))) TS_AcceptChannelV2_set_minimum_depth(uint64_t this_ptr, int32_t val) {
38463         LDKAcceptChannelV2 this_ptr_conv;
38464         this_ptr_conv.inner = untag_ptr(this_ptr);
38465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38467         this_ptr_conv.is_owned = false;
38468         AcceptChannelV2_set_minimum_depth(&this_ptr_conv, val);
38469 }
38470
38471 int16_t  __attribute__((export_name("TS_AcceptChannelV2_get_to_self_delay"))) TS_AcceptChannelV2_get_to_self_delay(uint64_t this_ptr) {
38472         LDKAcceptChannelV2 this_ptr_conv;
38473         this_ptr_conv.inner = untag_ptr(this_ptr);
38474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38476         this_ptr_conv.is_owned = false;
38477         int16_t ret_conv = AcceptChannelV2_get_to_self_delay(&this_ptr_conv);
38478         return ret_conv;
38479 }
38480
38481 void  __attribute__((export_name("TS_AcceptChannelV2_set_to_self_delay"))) TS_AcceptChannelV2_set_to_self_delay(uint64_t this_ptr, int16_t val) {
38482         LDKAcceptChannelV2 this_ptr_conv;
38483         this_ptr_conv.inner = untag_ptr(this_ptr);
38484         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38486         this_ptr_conv.is_owned = false;
38487         AcceptChannelV2_set_to_self_delay(&this_ptr_conv, val);
38488 }
38489
38490 int16_t  __attribute__((export_name("TS_AcceptChannelV2_get_max_accepted_htlcs"))) TS_AcceptChannelV2_get_max_accepted_htlcs(uint64_t this_ptr) {
38491         LDKAcceptChannelV2 this_ptr_conv;
38492         this_ptr_conv.inner = untag_ptr(this_ptr);
38493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38495         this_ptr_conv.is_owned = false;
38496         int16_t ret_conv = AcceptChannelV2_get_max_accepted_htlcs(&this_ptr_conv);
38497         return ret_conv;
38498 }
38499
38500 void  __attribute__((export_name("TS_AcceptChannelV2_set_max_accepted_htlcs"))) TS_AcceptChannelV2_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
38501         LDKAcceptChannelV2 this_ptr_conv;
38502         this_ptr_conv.inner = untag_ptr(this_ptr);
38503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38505         this_ptr_conv.is_owned = false;
38506         AcceptChannelV2_set_max_accepted_htlcs(&this_ptr_conv, val);
38507 }
38508
38509 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_funding_pubkey"))) TS_AcceptChannelV2_get_funding_pubkey(uint64_t this_ptr) {
38510         LDKAcceptChannelV2 this_ptr_conv;
38511         this_ptr_conv.inner = untag_ptr(this_ptr);
38512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38514         this_ptr_conv.is_owned = false;
38515         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38516         memcpy(ret_arr->elems, AcceptChannelV2_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
38517         return ret_arr;
38518 }
38519
38520 void  __attribute__((export_name("TS_AcceptChannelV2_set_funding_pubkey"))) TS_AcceptChannelV2_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
38521         LDKAcceptChannelV2 this_ptr_conv;
38522         this_ptr_conv.inner = untag_ptr(this_ptr);
38523         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38525         this_ptr_conv.is_owned = false;
38526         LDKPublicKey val_ref;
38527         CHECK(val->arr_len == 33);
38528         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38529         AcceptChannelV2_set_funding_pubkey(&this_ptr_conv, val_ref);
38530 }
38531
38532 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_revocation_basepoint"))) TS_AcceptChannelV2_get_revocation_basepoint(uint64_t this_ptr) {
38533         LDKAcceptChannelV2 this_ptr_conv;
38534         this_ptr_conv.inner = untag_ptr(this_ptr);
38535         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38537         this_ptr_conv.is_owned = false;
38538         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38539         memcpy(ret_arr->elems, AcceptChannelV2_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
38540         return ret_arr;
38541 }
38542
38543 void  __attribute__((export_name("TS_AcceptChannelV2_set_revocation_basepoint"))) TS_AcceptChannelV2_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
38544         LDKAcceptChannelV2 this_ptr_conv;
38545         this_ptr_conv.inner = untag_ptr(this_ptr);
38546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38548         this_ptr_conv.is_owned = false;
38549         LDKPublicKey val_ref;
38550         CHECK(val->arr_len == 33);
38551         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38552         AcceptChannelV2_set_revocation_basepoint(&this_ptr_conv, val_ref);
38553 }
38554
38555 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_payment_basepoint"))) TS_AcceptChannelV2_get_payment_basepoint(uint64_t this_ptr) {
38556         LDKAcceptChannelV2 this_ptr_conv;
38557         this_ptr_conv.inner = untag_ptr(this_ptr);
38558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38560         this_ptr_conv.is_owned = false;
38561         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38562         memcpy(ret_arr->elems, AcceptChannelV2_get_payment_basepoint(&this_ptr_conv).compressed_form, 33);
38563         return ret_arr;
38564 }
38565
38566 void  __attribute__((export_name("TS_AcceptChannelV2_set_payment_basepoint"))) TS_AcceptChannelV2_set_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
38567         LDKAcceptChannelV2 this_ptr_conv;
38568         this_ptr_conv.inner = untag_ptr(this_ptr);
38569         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38571         this_ptr_conv.is_owned = false;
38572         LDKPublicKey val_ref;
38573         CHECK(val->arr_len == 33);
38574         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38575         AcceptChannelV2_set_payment_basepoint(&this_ptr_conv, val_ref);
38576 }
38577
38578 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_delayed_payment_basepoint"))) TS_AcceptChannelV2_get_delayed_payment_basepoint(uint64_t this_ptr) {
38579         LDKAcceptChannelV2 this_ptr_conv;
38580         this_ptr_conv.inner = untag_ptr(this_ptr);
38581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38583         this_ptr_conv.is_owned = false;
38584         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38585         memcpy(ret_arr->elems, AcceptChannelV2_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
38586         return ret_arr;
38587 }
38588
38589 void  __attribute__((export_name("TS_AcceptChannelV2_set_delayed_payment_basepoint"))) TS_AcceptChannelV2_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
38590         LDKAcceptChannelV2 this_ptr_conv;
38591         this_ptr_conv.inner = untag_ptr(this_ptr);
38592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38594         this_ptr_conv.is_owned = false;
38595         LDKPublicKey val_ref;
38596         CHECK(val->arr_len == 33);
38597         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38598         AcceptChannelV2_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
38599 }
38600
38601 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_htlc_basepoint"))) TS_AcceptChannelV2_get_htlc_basepoint(uint64_t this_ptr) {
38602         LDKAcceptChannelV2 this_ptr_conv;
38603         this_ptr_conv.inner = untag_ptr(this_ptr);
38604         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38606         this_ptr_conv.is_owned = false;
38607         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38608         memcpy(ret_arr->elems, AcceptChannelV2_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
38609         return ret_arr;
38610 }
38611
38612 void  __attribute__((export_name("TS_AcceptChannelV2_set_htlc_basepoint"))) TS_AcceptChannelV2_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
38613         LDKAcceptChannelV2 this_ptr_conv;
38614         this_ptr_conv.inner = untag_ptr(this_ptr);
38615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38617         this_ptr_conv.is_owned = false;
38618         LDKPublicKey val_ref;
38619         CHECK(val->arr_len == 33);
38620         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38621         AcceptChannelV2_set_htlc_basepoint(&this_ptr_conv, val_ref);
38622 }
38623
38624 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_first_per_commitment_point"))) TS_AcceptChannelV2_get_first_per_commitment_point(uint64_t this_ptr) {
38625         LDKAcceptChannelV2 this_ptr_conv;
38626         this_ptr_conv.inner = untag_ptr(this_ptr);
38627         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38629         this_ptr_conv.is_owned = false;
38630         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38631         memcpy(ret_arr->elems, AcceptChannelV2_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
38632         return ret_arr;
38633 }
38634
38635 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) {
38636         LDKAcceptChannelV2 this_ptr_conv;
38637         this_ptr_conv.inner = untag_ptr(this_ptr);
38638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38640         this_ptr_conv.is_owned = false;
38641         LDKPublicKey val_ref;
38642         CHECK(val->arr_len == 33);
38643         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38644         AcceptChannelV2_set_first_per_commitment_point(&this_ptr_conv, val_ref);
38645 }
38646
38647 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_second_per_commitment_point"))) TS_AcceptChannelV2_get_second_per_commitment_point(uint64_t this_ptr) {
38648         LDKAcceptChannelV2 this_ptr_conv;
38649         this_ptr_conv.inner = untag_ptr(this_ptr);
38650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38652         this_ptr_conv.is_owned = false;
38653         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38654         memcpy(ret_arr->elems, AcceptChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form, 33);
38655         return ret_arr;
38656 }
38657
38658 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) {
38659         LDKAcceptChannelV2 this_ptr_conv;
38660         this_ptr_conv.inner = untag_ptr(this_ptr);
38661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38663         this_ptr_conv.is_owned = false;
38664         LDKPublicKey val_ref;
38665         CHECK(val->arr_len == 33);
38666         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38667         AcceptChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
38668 }
38669
38670 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_get_shutdown_scriptpubkey"))) TS_AcceptChannelV2_get_shutdown_scriptpubkey(uint64_t this_ptr) {
38671         LDKAcceptChannelV2 this_ptr_conv;
38672         this_ptr_conv.inner = untag_ptr(this_ptr);
38673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38675         this_ptr_conv.is_owned = false;
38676         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
38677         *ret_copy = AcceptChannelV2_get_shutdown_scriptpubkey(&this_ptr_conv);
38678         uint64_t ret_ref = tag_ptr(ret_copy, true);
38679         return ret_ref;
38680 }
38681
38682 void  __attribute__((export_name("TS_AcceptChannelV2_set_shutdown_scriptpubkey"))) TS_AcceptChannelV2_set_shutdown_scriptpubkey(uint64_t this_ptr, uint64_t val) {
38683         LDKAcceptChannelV2 this_ptr_conv;
38684         this_ptr_conv.inner = untag_ptr(this_ptr);
38685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38687         this_ptr_conv.is_owned = false;
38688         void* val_ptr = untag_ptr(val);
38689         CHECK_ACCESS(val_ptr);
38690         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
38691         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
38692         AcceptChannelV2_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
38693 }
38694
38695 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_get_channel_type"))) TS_AcceptChannelV2_get_channel_type(uint64_t this_ptr) {
38696         LDKAcceptChannelV2 this_ptr_conv;
38697         this_ptr_conv.inner = untag_ptr(this_ptr);
38698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38700         this_ptr_conv.is_owned = false;
38701         LDKChannelTypeFeatures ret_var = AcceptChannelV2_get_channel_type(&this_ptr_conv);
38702         uint64_t ret_ref = 0;
38703         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38704         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38705         return ret_ref;
38706 }
38707
38708 void  __attribute__((export_name("TS_AcceptChannelV2_set_channel_type"))) TS_AcceptChannelV2_set_channel_type(uint64_t this_ptr, uint64_t val) {
38709         LDKAcceptChannelV2 this_ptr_conv;
38710         this_ptr_conv.inner = untag_ptr(this_ptr);
38711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38713         this_ptr_conv.is_owned = false;
38714         LDKChannelTypeFeatures val_conv;
38715         val_conv.inner = untag_ptr(val);
38716         val_conv.is_owned = ptr_is_owned(val);
38717         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38718         val_conv = ChannelTypeFeatures_clone(&val_conv);
38719         AcceptChannelV2_set_channel_type(&this_ptr_conv, val_conv);
38720 }
38721
38722 uint32_t  __attribute__((export_name("TS_AcceptChannelV2_get_require_confirmed_inputs"))) TS_AcceptChannelV2_get_require_confirmed_inputs(uint64_t this_ptr) {
38723         LDKAcceptChannelV2 this_ptr_conv;
38724         this_ptr_conv.inner = untag_ptr(this_ptr);
38725         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38727         this_ptr_conv.is_owned = false;
38728         uint32_t ret_conv = LDKCOption_NoneZ_to_js(AcceptChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
38729         return ret_conv;
38730 }
38731
38732 void  __attribute__((export_name("TS_AcceptChannelV2_set_require_confirmed_inputs"))) TS_AcceptChannelV2_set_require_confirmed_inputs(uint64_t this_ptr, uint32_t val) {
38733         LDKAcceptChannelV2 this_ptr_conv;
38734         this_ptr_conv.inner = untag_ptr(this_ptr);
38735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38737         this_ptr_conv.is_owned = false;
38738         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
38739         AcceptChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
38740 }
38741
38742 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) {
38743         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
38744         CHECK(temporary_channel_id_arg->arr_len == 32);
38745         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
38746         LDKPublicKey funding_pubkey_arg_ref;
38747         CHECK(funding_pubkey_arg->arr_len == 33);
38748         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
38749         LDKPublicKey revocation_basepoint_arg_ref;
38750         CHECK(revocation_basepoint_arg->arr_len == 33);
38751         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
38752         LDKPublicKey payment_basepoint_arg_ref;
38753         CHECK(payment_basepoint_arg->arr_len == 33);
38754         memcpy(payment_basepoint_arg_ref.compressed_form, payment_basepoint_arg->elems, 33); FREE(payment_basepoint_arg);
38755         LDKPublicKey delayed_payment_basepoint_arg_ref;
38756         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
38757         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
38758         LDKPublicKey htlc_basepoint_arg_ref;
38759         CHECK(htlc_basepoint_arg->arr_len == 33);
38760         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
38761         LDKPublicKey first_per_commitment_point_arg_ref;
38762         CHECK(first_per_commitment_point_arg->arr_len == 33);
38763         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
38764         LDKPublicKey second_per_commitment_point_arg_ref;
38765         CHECK(second_per_commitment_point_arg->arr_len == 33);
38766         memcpy(second_per_commitment_point_arg_ref.compressed_form, second_per_commitment_point_arg->elems, 33); FREE(second_per_commitment_point_arg);
38767         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
38768         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
38769         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
38770         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
38771         LDKChannelTypeFeatures channel_type_arg_conv;
38772         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
38773         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
38774         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
38775         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
38776         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_js(require_confirmed_inputs_arg);
38777         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);
38778         uint64_t ret_ref = 0;
38779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38781         return ret_ref;
38782 }
38783
38784 static inline uint64_t AcceptChannelV2_clone_ptr(LDKAcceptChannelV2 *NONNULL_PTR arg) {
38785         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(arg);
38786         uint64_t ret_ref = 0;
38787         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38788         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38789         return ret_ref;
38790 }
38791 int64_t  __attribute__((export_name("TS_AcceptChannelV2_clone_ptr"))) TS_AcceptChannelV2_clone_ptr(uint64_t arg) {
38792         LDKAcceptChannelV2 arg_conv;
38793         arg_conv.inner = untag_ptr(arg);
38794         arg_conv.is_owned = ptr_is_owned(arg);
38795         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38796         arg_conv.is_owned = false;
38797         int64_t ret_conv = AcceptChannelV2_clone_ptr(&arg_conv);
38798         return ret_conv;
38799 }
38800
38801 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_clone"))) TS_AcceptChannelV2_clone(uint64_t orig) {
38802         LDKAcceptChannelV2 orig_conv;
38803         orig_conv.inner = untag_ptr(orig);
38804         orig_conv.is_owned = ptr_is_owned(orig);
38805         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38806         orig_conv.is_owned = false;
38807         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(&orig_conv);
38808         uint64_t ret_ref = 0;
38809         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38810         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38811         return ret_ref;
38812 }
38813
38814 jboolean  __attribute__((export_name("TS_AcceptChannelV2_eq"))) TS_AcceptChannelV2_eq(uint64_t a, uint64_t b) {
38815         LDKAcceptChannelV2 a_conv;
38816         a_conv.inner = untag_ptr(a);
38817         a_conv.is_owned = ptr_is_owned(a);
38818         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38819         a_conv.is_owned = false;
38820         LDKAcceptChannelV2 b_conv;
38821         b_conv.inner = untag_ptr(b);
38822         b_conv.is_owned = ptr_is_owned(b);
38823         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38824         b_conv.is_owned = false;
38825         jboolean ret_conv = AcceptChannelV2_eq(&a_conv, &b_conv);
38826         return ret_conv;
38827 }
38828
38829 void  __attribute__((export_name("TS_FundingCreated_free"))) TS_FundingCreated_free(uint64_t this_obj) {
38830         LDKFundingCreated this_obj_conv;
38831         this_obj_conv.inner = untag_ptr(this_obj);
38832         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38834         FundingCreated_free(this_obj_conv);
38835 }
38836
38837 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_temporary_channel_id"))) TS_FundingCreated_get_temporary_channel_id(uint64_t this_ptr) {
38838         LDKFundingCreated this_ptr_conv;
38839         this_ptr_conv.inner = untag_ptr(this_ptr);
38840         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38842         this_ptr_conv.is_owned = false;
38843         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38844         memcpy(ret_arr->elems, *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
38845         return ret_arr;
38846 }
38847
38848 void  __attribute__((export_name("TS_FundingCreated_set_temporary_channel_id"))) TS_FundingCreated_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
38849         LDKFundingCreated this_ptr_conv;
38850         this_ptr_conv.inner = untag_ptr(this_ptr);
38851         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38853         this_ptr_conv.is_owned = false;
38854         LDKThirtyTwoBytes val_ref;
38855         CHECK(val->arr_len == 32);
38856         memcpy(val_ref.data, val->elems, 32); FREE(val);
38857         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
38858 }
38859
38860 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_funding_txid"))) TS_FundingCreated_get_funding_txid(uint64_t this_ptr) {
38861         LDKFundingCreated this_ptr_conv;
38862         this_ptr_conv.inner = untag_ptr(this_ptr);
38863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38865         this_ptr_conv.is_owned = false;
38866         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38867         memcpy(ret_arr->elems, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
38868         return ret_arr;
38869 }
38870
38871 void  __attribute__((export_name("TS_FundingCreated_set_funding_txid"))) TS_FundingCreated_set_funding_txid(uint64_t this_ptr, int8_tArray val) {
38872         LDKFundingCreated this_ptr_conv;
38873         this_ptr_conv.inner = untag_ptr(this_ptr);
38874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38876         this_ptr_conv.is_owned = false;
38877         LDKThirtyTwoBytes val_ref;
38878         CHECK(val->arr_len == 32);
38879         memcpy(val_ref.data, val->elems, 32); FREE(val);
38880         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
38881 }
38882
38883 int16_t  __attribute__((export_name("TS_FundingCreated_get_funding_output_index"))) TS_FundingCreated_get_funding_output_index(uint64_t this_ptr) {
38884         LDKFundingCreated this_ptr_conv;
38885         this_ptr_conv.inner = untag_ptr(this_ptr);
38886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38888         this_ptr_conv.is_owned = false;
38889         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
38890         return ret_conv;
38891 }
38892
38893 void  __attribute__((export_name("TS_FundingCreated_set_funding_output_index"))) TS_FundingCreated_set_funding_output_index(uint64_t this_ptr, int16_t val) {
38894         LDKFundingCreated this_ptr_conv;
38895         this_ptr_conv.inner = untag_ptr(this_ptr);
38896         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38898         this_ptr_conv.is_owned = false;
38899         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
38900 }
38901
38902 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_signature"))) TS_FundingCreated_get_signature(uint64_t this_ptr) {
38903         LDKFundingCreated this_ptr_conv;
38904         this_ptr_conv.inner = untag_ptr(this_ptr);
38905         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38907         this_ptr_conv.is_owned = false;
38908         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
38909         memcpy(ret_arr->elems, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
38910         return ret_arr;
38911 }
38912
38913 void  __attribute__((export_name("TS_FundingCreated_set_signature"))) TS_FundingCreated_set_signature(uint64_t this_ptr, int8_tArray val) {
38914         LDKFundingCreated this_ptr_conv;
38915         this_ptr_conv.inner = untag_ptr(this_ptr);
38916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38918         this_ptr_conv.is_owned = false;
38919         LDKECDSASignature val_ref;
38920         CHECK(val->arr_len == 64);
38921         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
38922         FundingCreated_set_signature(&this_ptr_conv, val_ref);
38923 }
38924
38925 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) {
38926         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
38927         CHECK(temporary_channel_id_arg->arr_len == 32);
38928         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
38929         LDKThirtyTwoBytes funding_txid_arg_ref;
38930         CHECK(funding_txid_arg->arr_len == 32);
38931         memcpy(funding_txid_arg_ref.data, funding_txid_arg->elems, 32); FREE(funding_txid_arg);
38932         LDKECDSASignature signature_arg_ref;
38933         CHECK(signature_arg->arr_len == 64);
38934         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
38935         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
38936         uint64_t ret_ref = 0;
38937         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38938         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38939         return ret_ref;
38940 }
38941
38942 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
38943         LDKFundingCreated ret_var = FundingCreated_clone(arg);
38944         uint64_t ret_ref = 0;
38945         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38946         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38947         return ret_ref;
38948 }
38949 int64_t  __attribute__((export_name("TS_FundingCreated_clone_ptr"))) TS_FundingCreated_clone_ptr(uint64_t arg) {
38950         LDKFundingCreated arg_conv;
38951         arg_conv.inner = untag_ptr(arg);
38952         arg_conv.is_owned = ptr_is_owned(arg);
38953         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38954         arg_conv.is_owned = false;
38955         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
38956         return ret_conv;
38957 }
38958
38959 uint64_t  __attribute__((export_name("TS_FundingCreated_clone"))) TS_FundingCreated_clone(uint64_t orig) {
38960         LDKFundingCreated orig_conv;
38961         orig_conv.inner = untag_ptr(orig);
38962         orig_conv.is_owned = ptr_is_owned(orig);
38963         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38964         orig_conv.is_owned = false;
38965         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
38966         uint64_t ret_ref = 0;
38967         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38968         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38969         return ret_ref;
38970 }
38971
38972 jboolean  __attribute__((export_name("TS_FundingCreated_eq"))) TS_FundingCreated_eq(uint64_t a, uint64_t b) {
38973         LDKFundingCreated a_conv;
38974         a_conv.inner = untag_ptr(a);
38975         a_conv.is_owned = ptr_is_owned(a);
38976         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38977         a_conv.is_owned = false;
38978         LDKFundingCreated b_conv;
38979         b_conv.inner = untag_ptr(b);
38980         b_conv.is_owned = ptr_is_owned(b);
38981         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38982         b_conv.is_owned = false;
38983         jboolean ret_conv = FundingCreated_eq(&a_conv, &b_conv);
38984         return ret_conv;
38985 }
38986
38987 void  __attribute__((export_name("TS_FundingSigned_free"))) TS_FundingSigned_free(uint64_t this_obj) {
38988         LDKFundingSigned this_obj_conv;
38989         this_obj_conv.inner = untag_ptr(this_obj);
38990         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38992         FundingSigned_free(this_obj_conv);
38993 }
38994
38995 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_channel_id"))) TS_FundingSigned_get_channel_id(uint64_t this_ptr) {
38996         LDKFundingSigned this_ptr_conv;
38997         this_ptr_conv.inner = untag_ptr(this_ptr);
38998         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39000         this_ptr_conv.is_owned = false;
39001         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39002         memcpy(ret_arr->elems, *FundingSigned_get_channel_id(&this_ptr_conv), 32);
39003         return ret_arr;
39004 }
39005
39006 void  __attribute__((export_name("TS_FundingSigned_set_channel_id"))) TS_FundingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
39007         LDKFundingSigned this_ptr_conv;
39008         this_ptr_conv.inner = untag_ptr(this_ptr);
39009         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39011         this_ptr_conv.is_owned = false;
39012         LDKThirtyTwoBytes val_ref;
39013         CHECK(val->arr_len == 32);
39014         memcpy(val_ref.data, val->elems, 32); FREE(val);
39015         FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
39016 }
39017
39018 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_signature"))) TS_FundingSigned_get_signature(uint64_t this_ptr) {
39019         LDKFundingSigned this_ptr_conv;
39020         this_ptr_conv.inner = untag_ptr(this_ptr);
39021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39023         this_ptr_conv.is_owned = false;
39024         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
39025         memcpy(ret_arr->elems, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
39026         return ret_arr;
39027 }
39028
39029 void  __attribute__((export_name("TS_FundingSigned_set_signature"))) TS_FundingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
39030         LDKFundingSigned this_ptr_conv;
39031         this_ptr_conv.inner = untag_ptr(this_ptr);
39032         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39034         this_ptr_conv.is_owned = false;
39035         LDKECDSASignature val_ref;
39036         CHECK(val->arr_len == 64);
39037         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
39038         FundingSigned_set_signature(&this_ptr_conv, val_ref);
39039 }
39040
39041 uint64_t  __attribute__((export_name("TS_FundingSigned_new"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
39042         LDKThirtyTwoBytes channel_id_arg_ref;
39043         CHECK(channel_id_arg->arr_len == 32);
39044         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
39045         LDKECDSASignature signature_arg_ref;
39046         CHECK(signature_arg->arr_len == 64);
39047         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
39048         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
39049         uint64_t ret_ref = 0;
39050         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39051         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39052         return ret_ref;
39053 }
39054
39055 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
39056         LDKFundingSigned ret_var = FundingSigned_clone(arg);
39057         uint64_t ret_ref = 0;
39058         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39059         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39060         return ret_ref;
39061 }
39062 int64_t  __attribute__((export_name("TS_FundingSigned_clone_ptr"))) TS_FundingSigned_clone_ptr(uint64_t arg) {
39063         LDKFundingSigned arg_conv;
39064         arg_conv.inner = untag_ptr(arg);
39065         arg_conv.is_owned = ptr_is_owned(arg);
39066         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39067         arg_conv.is_owned = false;
39068         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
39069         return ret_conv;
39070 }
39071
39072 uint64_t  __attribute__((export_name("TS_FundingSigned_clone"))) TS_FundingSigned_clone(uint64_t orig) {
39073         LDKFundingSigned orig_conv;
39074         orig_conv.inner = untag_ptr(orig);
39075         orig_conv.is_owned = ptr_is_owned(orig);
39076         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39077         orig_conv.is_owned = false;
39078         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
39079         uint64_t ret_ref = 0;
39080         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39081         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39082         return ret_ref;
39083 }
39084
39085 jboolean  __attribute__((export_name("TS_FundingSigned_eq"))) TS_FundingSigned_eq(uint64_t a, uint64_t b) {
39086         LDKFundingSigned a_conv;
39087         a_conv.inner = untag_ptr(a);
39088         a_conv.is_owned = ptr_is_owned(a);
39089         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39090         a_conv.is_owned = false;
39091         LDKFundingSigned b_conv;
39092         b_conv.inner = untag_ptr(b);
39093         b_conv.is_owned = ptr_is_owned(b);
39094         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39095         b_conv.is_owned = false;
39096         jboolean ret_conv = FundingSigned_eq(&a_conv, &b_conv);
39097         return ret_conv;
39098 }
39099
39100 void  __attribute__((export_name("TS_ChannelReady_free"))) TS_ChannelReady_free(uint64_t this_obj) {
39101         LDKChannelReady this_obj_conv;
39102         this_obj_conv.inner = untag_ptr(this_obj);
39103         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39105         ChannelReady_free(this_obj_conv);
39106 }
39107
39108 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_channel_id"))) TS_ChannelReady_get_channel_id(uint64_t this_ptr) {
39109         LDKChannelReady this_ptr_conv;
39110         this_ptr_conv.inner = untag_ptr(this_ptr);
39111         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39113         this_ptr_conv.is_owned = false;
39114         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39115         memcpy(ret_arr->elems, *ChannelReady_get_channel_id(&this_ptr_conv), 32);
39116         return ret_arr;
39117 }
39118
39119 void  __attribute__((export_name("TS_ChannelReady_set_channel_id"))) TS_ChannelReady_set_channel_id(uint64_t this_ptr, int8_tArray val) {
39120         LDKChannelReady this_ptr_conv;
39121         this_ptr_conv.inner = untag_ptr(this_ptr);
39122         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39124         this_ptr_conv.is_owned = false;
39125         LDKThirtyTwoBytes val_ref;
39126         CHECK(val->arr_len == 32);
39127         memcpy(val_ref.data, val->elems, 32); FREE(val);
39128         ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
39129 }
39130
39131 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_next_per_commitment_point"))) TS_ChannelReady_get_next_per_commitment_point(uint64_t this_ptr) {
39132         LDKChannelReady this_ptr_conv;
39133         this_ptr_conv.inner = untag_ptr(this_ptr);
39134         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39136         this_ptr_conv.is_owned = false;
39137         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39138         memcpy(ret_arr->elems, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
39139         return ret_arr;
39140 }
39141
39142 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) {
39143         LDKChannelReady this_ptr_conv;
39144         this_ptr_conv.inner = untag_ptr(this_ptr);
39145         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39147         this_ptr_conv.is_owned = false;
39148         LDKPublicKey val_ref;
39149         CHECK(val->arr_len == 33);
39150         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
39151         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
39152 }
39153
39154 uint64_t  __attribute__((export_name("TS_ChannelReady_get_short_channel_id_alias"))) TS_ChannelReady_get_short_channel_id_alias(uint64_t this_ptr) {
39155         LDKChannelReady this_ptr_conv;
39156         this_ptr_conv.inner = untag_ptr(this_ptr);
39157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39159         this_ptr_conv.is_owned = false;
39160         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39161         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
39162         uint64_t ret_ref = tag_ptr(ret_copy, true);
39163         return ret_ref;
39164 }
39165
39166 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) {
39167         LDKChannelReady this_ptr_conv;
39168         this_ptr_conv.inner = untag_ptr(this_ptr);
39169         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39171         this_ptr_conv.is_owned = false;
39172         void* val_ptr = untag_ptr(val);
39173         CHECK_ACCESS(val_ptr);
39174         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
39175         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
39176         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
39177 }
39178
39179 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) {
39180         LDKThirtyTwoBytes channel_id_arg_ref;
39181         CHECK(channel_id_arg->arr_len == 32);
39182         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
39183         LDKPublicKey next_per_commitment_point_arg_ref;
39184         CHECK(next_per_commitment_point_arg->arr_len == 33);
39185         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
39186         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
39187         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
39188         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
39189         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
39190         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
39191         uint64_t ret_ref = 0;
39192         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39193         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39194         return ret_ref;
39195 }
39196
39197 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
39198         LDKChannelReady ret_var = ChannelReady_clone(arg);
39199         uint64_t ret_ref = 0;
39200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39202         return ret_ref;
39203 }
39204 int64_t  __attribute__((export_name("TS_ChannelReady_clone_ptr"))) TS_ChannelReady_clone_ptr(uint64_t arg) {
39205         LDKChannelReady arg_conv;
39206         arg_conv.inner = untag_ptr(arg);
39207         arg_conv.is_owned = ptr_is_owned(arg);
39208         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39209         arg_conv.is_owned = false;
39210         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
39211         return ret_conv;
39212 }
39213
39214 uint64_t  __attribute__((export_name("TS_ChannelReady_clone"))) TS_ChannelReady_clone(uint64_t orig) {
39215         LDKChannelReady orig_conv;
39216         orig_conv.inner = untag_ptr(orig);
39217         orig_conv.is_owned = ptr_is_owned(orig);
39218         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39219         orig_conv.is_owned = false;
39220         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
39221         uint64_t ret_ref = 0;
39222         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39223         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39224         return ret_ref;
39225 }
39226
39227 jboolean  __attribute__((export_name("TS_ChannelReady_eq"))) TS_ChannelReady_eq(uint64_t a, uint64_t b) {
39228         LDKChannelReady a_conv;
39229         a_conv.inner = untag_ptr(a);
39230         a_conv.is_owned = ptr_is_owned(a);
39231         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39232         a_conv.is_owned = false;
39233         LDKChannelReady b_conv;
39234         b_conv.inner = untag_ptr(b);
39235         b_conv.is_owned = ptr_is_owned(b);
39236         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39237         b_conv.is_owned = false;
39238         jboolean ret_conv = ChannelReady_eq(&a_conv, &b_conv);
39239         return ret_conv;
39240 }
39241
39242 void  __attribute__((export_name("TS_TxAddInput_free"))) TS_TxAddInput_free(uint64_t this_obj) {
39243         LDKTxAddInput this_obj_conv;
39244         this_obj_conv.inner = untag_ptr(this_obj);
39245         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39247         TxAddInput_free(this_obj_conv);
39248 }
39249
39250 int8_tArray  __attribute__((export_name("TS_TxAddInput_get_channel_id"))) TS_TxAddInput_get_channel_id(uint64_t this_ptr) {
39251         LDKTxAddInput this_ptr_conv;
39252         this_ptr_conv.inner = untag_ptr(this_ptr);
39253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39255         this_ptr_conv.is_owned = false;
39256         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39257         memcpy(ret_arr->elems, *TxAddInput_get_channel_id(&this_ptr_conv), 32);
39258         return ret_arr;
39259 }
39260
39261 void  __attribute__((export_name("TS_TxAddInput_set_channel_id"))) TS_TxAddInput_set_channel_id(uint64_t this_ptr, int8_tArray val) {
39262         LDKTxAddInput this_ptr_conv;
39263         this_ptr_conv.inner = untag_ptr(this_ptr);
39264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39266         this_ptr_conv.is_owned = false;
39267         LDKThirtyTwoBytes val_ref;
39268         CHECK(val->arr_len == 32);
39269         memcpy(val_ref.data, val->elems, 32); FREE(val);
39270         TxAddInput_set_channel_id(&this_ptr_conv, val_ref);
39271 }
39272
39273 int64_t  __attribute__((export_name("TS_TxAddInput_get_serial_id"))) TS_TxAddInput_get_serial_id(uint64_t this_ptr) {
39274         LDKTxAddInput this_ptr_conv;
39275         this_ptr_conv.inner = untag_ptr(this_ptr);
39276         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39278         this_ptr_conv.is_owned = false;
39279         int64_t ret_conv = TxAddInput_get_serial_id(&this_ptr_conv);
39280         return ret_conv;
39281 }
39282
39283 void  __attribute__((export_name("TS_TxAddInput_set_serial_id"))) TS_TxAddInput_set_serial_id(uint64_t this_ptr, int64_t val) {
39284         LDKTxAddInput this_ptr_conv;
39285         this_ptr_conv.inner = untag_ptr(this_ptr);
39286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39288         this_ptr_conv.is_owned = false;
39289         TxAddInput_set_serial_id(&this_ptr_conv, val);
39290 }
39291
39292 uint64_t  __attribute__((export_name("TS_TxAddInput_get_prevtx"))) TS_TxAddInput_get_prevtx(uint64_t this_ptr) {
39293         LDKTxAddInput this_ptr_conv;
39294         this_ptr_conv.inner = untag_ptr(this_ptr);
39295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39297         this_ptr_conv.is_owned = false;
39298         LDKTransactionU16LenLimited ret_var = TxAddInput_get_prevtx(&this_ptr_conv);
39299         uint64_t ret_ref = 0;
39300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39302         return ret_ref;
39303 }
39304
39305 void  __attribute__((export_name("TS_TxAddInput_set_prevtx"))) TS_TxAddInput_set_prevtx(uint64_t this_ptr, uint64_t val) {
39306         LDKTxAddInput this_ptr_conv;
39307         this_ptr_conv.inner = untag_ptr(this_ptr);
39308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39310         this_ptr_conv.is_owned = false;
39311         LDKTransactionU16LenLimited val_conv;
39312         val_conv.inner = untag_ptr(val);
39313         val_conv.is_owned = ptr_is_owned(val);
39314         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39315         val_conv = TransactionU16LenLimited_clone(&val_conv);
39316         TxAddInput_set_prevtx(&this_ptr_conv, val_conv);
39317 }
39318
39319 int32_t  __attribute__((export_name("TS_TxAddInput_get_prevtx_out"))) TS_TxAddInput_get_prevtx_out(uint64_t this_ptr) {
39320         LDKTxAddInput this_ptr_conv;
39321         this_ptr_conv.inner = untag_ptr(this_ptr);
39322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39324         this_ptr_conv.is_owned = false;
39325         int32_t ret_conv = TxAddInput_get_prevtx_out(&this_ptr_conv);
39326         return ret_conv;
39327 }
39328
39329 void  __attribute__((export_name("TS_TxAddInput_set_prevtx_out"))) TS_TxAddInput_set_prevtx_out(uint64_t this_ptr, int32_t val) {
39330         LDKTxAddInput this_ptr_conv;
39331         this_ptr_conv.inner = untag_ptr(this_ptr);
39332         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39334         this_ptr_conv.is_owned = false;
39335         TxAddInput_set_prevtx_out(&this_ptr_conv, val);
39336 }
39337
39338 int32_t  __attribute__((export_name("TS_TxAddInput_get_sequence"))) TS_TxAddInput_get_sequence(uint64_t this_ptr) {
39339         LDKTxAddInput this_ptr_conv;
39340         this_ptr_conv.inner = untag_ptr(this_ptr);
39341         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39343         this_ptr_conv.is_owned = false;
39344         int32_t ret_conv = TxAddInput_get_sequence(&this_ptr_conv);
39345         return ret_conv;
39346 }
39347
39348 void  __attribute__((export_name("TS_TxAddInput_set_sequence"))) TS_TxAddInput_set_sequence(uint64_t this_ptr, int32_t val) {
39349         LDKTxAddInput this_ptr_conv;
39350         this_ptr_conv.inner = untag_ptr(this_ptr);
39351         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39353         this_ptr_conv.is_owned = false;
39354         TxAddInput_set_sequence(&this_ptr_conv, val);
39355 }
39356
39357 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) {
39358         LDKThirtyTwoBytes channel_id_arg_ref;
39359         CHECK(channel_id_arg->arr_len == 32);
39360         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
39361         LDKTransactionU16LenLimited prevtx_arg_conv;
39362         prevtx_arg_conv.inner = untag_ptr(prevtx_arg);
39363         prevtx_arg_conv.is_owned = ptr_is_owned(prevtx_arg);
39364         CHECK_INNER_FIELD_ACCESS_OR_NULL(prevtx_arg_conv);
39365         prevtx_arg_conv = TransactionU16LenLimited_clone(&prevtx_arg_conv);
39366         LDKTxAddInput ret_var = TxAddInput_new(channel_id_arg_ref, serial_id_arg, prevtx_arg_conv, prevtx_out_arg, sequence_arg);
39367         uint64_t ret_ref = 0;
39368         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39369         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39370         return ret_ref;
39371 }
39372
39373 static inline uint64_t TxAddInput_clone_ptr(LDKTxAddInput *NONNULL_PTR arg) {
39374         LDKTxAddInput ret_var = TxAddInput_clone(arg);
39375         uint64_t ret_ref = 0;
39376         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39377         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39378         return ret_ref;
39379 }
39380 int64_t  __attribute__((export_name("TS_TxAddInput_clone_ptr"))) TS_TxAddInput_clone_ptr(uint64_t arg) {
39381         LDKTxAddInput arg_conv;
39382         arg_conv.inner = untag_ptr(arg);
39383         arg_conv.is_owned = ptr_is_owned(arg);
39384         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39385         arg_conv.is_owned = false;
39386         int64_t ret_conv = TxAddInput_clone_ptr(&arg_conv);
39387         return ret_conv;
39388 }
39389
39390 uint64_t  __attribute__((export_name("TS_TxAddInput_clone"))) TS_TxAddInput_clone(uint64_t orig) {
39391         LDKTxAddInput orig_conv;
39392         orig_conv.inner = untag_ptr(orig);
39393         orig_conv.is_owned = ptr_is_owned(orig);
39394         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39395         orig_conv.is_owned = false;
39396         LDKTxAddInput ret_var = TxAddInput_clone(&orig_conv);
39397         uint64_t ret_ref = 0;
39398         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39399         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39400         return ret_ref;
39401 }
39402
39403 jboolean  __attribute__((export_name("TS_TxAddInput_eq"))) TS_TxAddInput_eq(uint64_t a, uint64_t b) {
39404         LDKTxAddInput a_conv;
39405         a_conv.inner = untag_ptr(a);
39406         a_conv.is_owned = ptr_is_owned(a);
39407         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39408         a_conv.is_owned = false;
39409         LDKTxAddInput b_conv;
39410         b_conv.inner = untag_ptr(b);
39411         b_conv.is_owned = ptr_is_owned(b);
39412         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39413         b_conv.is_owned = false;
39414         jboolean ret_conv = TxAddInput_eq(&a_conv, &b_conv);
39415         return ret_conv;
39416 }
39417
39418 void  __attribute__((export_name("TS_TxAddOutput_free"))) TS_TxAddOutput_free(uint64_t this_obj) {
39419         LDKTxAddOutput this_obj_conv;
39420         this_obj_conv.inner = untag_ptr(this_obj);
39421         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39423         TxAddOutput_free(this_obj_conv);
39424 }
39425
39426 int8_tArray  __attribute__((export_name("TS_TxAddOutput_get_channel_id"))) TS_TxAddOutput_get_channel_id(uint64_t this_ptr) {
39427         LDKTxAddOutput this_ptr_conv;
39428         this_ptr_conv.inner = untag_ptr(this_ptr);
39429         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39431         this_ptr_conv.is_owned = false;
39432         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39433         memcpy(ret_arr->elems, *TxAddOutput_get_channel_id(&this_ptr_conv), 32);
39434         return ret_arr;
39435 }
39436
39437 void  __attribute__((export_name("TS_TxAddOutput_set_channel_id"))) TS_TxAddOutput_set_channel_id(uint64_t this_ptr, int8_tArray val) {
39438         LDKTxAddOutput this_ptr_conv;
39439         this_ptr_conv.inner = untag_ptr(this_ptr);
39440         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39442         this_ptr_conv.is_owned = false;
39443         LDKThirtyTwoBytes val_ref;
39444         CHECK(val->arr_len == 32);
39445         memcpy(val_ref.data, val->elems, 32); FREE(val);
39446         TxAddOutput_set_channel_id(&this_ptr_conv, val_ref);
39447 }
39448
39449 int64_t  __attribute__((export_name("TS_TxAddOutput_get_serial_id"))) TS_TxAddOutput_get_serial_id(uint64_t this_ptr) {
39450         LDKTxAddOutput this_ptr_conv;
39451         this_ptr_conv.inner = untag_ptr(this_ptr);
39452         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39454         this_ptr_conv.is_owned = false;
39455         int64_t ret_conv = TxAddOutput_get_serial_id(&this_ptr_conv);
39456         return ret_conv;
39457 }
39458
39459 void  __attribute__((export_name("TS_TxAddOutput_set_serial_id"))) TS_TxAddOutput_set_serial_id(uint64_t this_ptr, int64_t val) {
39460         LDKTxAddOutput this_ptr_conv;
39461         this_ptr_conv.inner = untag_ptr(this_ptr);
39462         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39464         this_ptr_conv.is_owned = false;
39465         TxAddOutput_set_serial_id(&this_ptr_conv, val);
39466 }
39467
39468 int64_t  __attribute__((export_name("TS_TxAddOutput_get_sats"))) TS_TxAddOutput_get_sats(uint64_t this_ptr) {
39469         LDKTxAddOutput this_ptr_conv;
39470         this_ptr_conv.inner = untag_ptr(this_ptr);
39471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39473         this_ptr_conv.is_owned = false;
39474         int64_t ret_conv = TxAddOutput_get_sats(&this_ptr_conv);
39475         return ret_conv;
39476 }
39477
39478 void  __attribute__((export_name("TS_TxAddOutput_set_sats"))) TS_TxAddOutput_set_sats(uint64_t this_ptr, int64_t val) {
39479         LDKTxAddOutput this_ptr_conv;
39480         this_ptr_conv.inner = untag_ptr(this_ptr);
39481         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39483         this_ptr_conv.is_owned = false;
39484         TxAddOutput_set_sats(&this_ptr_conv, val);
39485 }
39486
39487 int8_tArray  __attribute__((export_name("TS_TxAddOutput_get_script"))) TS_TxAddOutput_get_script(uint64_t this_ptr) {
39488         LDKTxAddOutput this_ptr_conv;
39489         this_ptr_conv.inner = untag_ptr(this_ptr);
39490         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39492         this_ptr_conv.is_owned = false;
39493         LDKu8slice ret_var = TxAddOutput_get_script(&this_ptr_conv);
39494         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39495         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39496         return ret_arr;
39497 }
39498
39499 void  __attribute__((export_name("TS_TxAddOutput_set_script"))) TS_TxAddOutput_set_script(uint64_t this_ptr, int8_tArray val) {
39500         LDKTxAddOutput this_ptr_conv;
39501         this_ptr_conv.inner = untag_ptr(this_ptr);
39502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39504         this_ptr_conv.is_owned = false;
39505         LDKCVec_u8Z val_ref;
39506         val_ref.datalen = val->arr_len;
39507         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
39508         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
39509         TxAddOutput_set_script(&this_ptr_conv, val_ref);
39510 }
39511
39512 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) {
39513         LDKThirtyTwoBytes channel_id_arg_ref;
39514         CHECK(channel_id_arg->arr_len == 32);
39515         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
39516         LDKCVec_u8Z script_arg_ref;
39517         script_arg_ref.datalen = script_arg->arr_len;
39518         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
39519         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
39520         LDKTxAddOutput ret_var = TxAddOutput_new(channel_id_arg_ref, serial_id_arg, sats_arg, script_arg_ref);
39521         uint64_t ret_ref = 0;
39522         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39523         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39524         return ret_ref;
39525 }
39526
39527 static inline uint64_t TxAddOutput_clone_ptr(LDKTxAddOutput *NONNULL_PTR arg) {
39528         LDKTxAddOutput ret_var = TxAddOutput_clone(arg);
39529         uint64_t ret_ref = 0;
39530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39532         return ret_ref;
39533 }
39534 int64_t  __attribute__((export_name("TS_TxAddOutput_clone_ptr"))) TS_TxAddOutput_clone_ptr(uint64_t arg) {
39535         LDKTxAddOutput arg_conv;
39536         arg_conv.inner = untag_ptr(arg);
39537         arg_conv.is_owned = ptr_is_owned(arg);
39538         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39539         arg_conv.is_owned = false;
39540         int64_t ret_conv = TxAddOutput_clone_ptr(&arg_conv);
39541         return ret_conv;
39542 }
39543
39544 uint64_t  __attribute__((export_name("TS_TxAddOutput_clone"))) TS_TxAddOutput_clone(uint64_t orig) {
39545         LDKTxAddOutput orig_conv;
39546         orig_conv.inner = untag_ptr(orig);
39547         orig_conv.is_owned = ptr_is_owned(orig);
39548         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39549         orig_conv.is_owned = false;
39550         LDKTxAddOutput ret_var = TxAddOutput_clone(&orig_conv);
39551         uint64_t ret_ref = 0;
39552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39554         return ret_ref;
39555 }
39556
39557 jboolean  __attribute__((export_name("TS_TxAddOutput_eq"))) TS_TxAddOutput_eq(uint64_t a, uint64_t b) {
39558         LDKTxAddOutput a_conv;
39559         a_conv.inner = untag_ptr(a);
39560         a_conv.is_owned = ptr_is_owned(a);
39561         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39562         a_conv.is_owned = false;
39563         LDKTxAddOutput b_conv;
39564         b_conv.inner = untag_ptr(b);
39565         b_conv.is_owned = ptr_is_owned(b);
39566         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39567         b_conv.is_owned = false;
39568         jboolean ret_conv = TxAddOutput_eq(&a_conv, &b_conv);
39569         return ret_conv;
39570 }
39571
39572 void  __attribute__((export_name("TS_TxRemoveInput_free"))) TS_TxRemoveInput_free(uint64_t this_obj) {
39573         LDKTxRemoveInput this_obj_conv;
39574         this_obj_conv.inner = untag_ptr(this_obj);
39575         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39577         TxRemoveInput_free(this_obj_conv);
39578 }
39579
39580 int8_tArray  __attribute__((export_name("TS_TxRemoveInput_get_channel_id"))) TS_TxRemoveInput_get_channel_id(uint64_t this_ptr) {
39581         LDKTxRemoveInput this_ptr_conv;
39582         this_ptr_conv.inner = untag_ptr(this_ptr);
39583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39585         this_ptr_conv.is_owned = false;
39586         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39587         memcpy(ret_arr->elems, *TxRemoveInput_get_channel_id(&this_ptr_conv), 32);
39588         return ret_arr;
39589 }
39590
39591 void  __attribute__((export_name("TS_TxRemoveInput_set_channel_id"))) TS_TxRemoveInput_set_channel_id(uint64_t this_ptr, int8_tArray val) {
39592         LDKTxRemoveInput this_ptr_conv;
39593         this_ptr_conv.inner = untag_ptr(this_ptr);
39594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39596         this_ptr_conv.is_owned = false;
39597         LDKThirtyTwoBytes val_ref;
39598         CHECK(val->arr_len == 32);
39599         memcpy(val_ref.data, val->elems, 32); FREE(val);
39600         TxRemoveInput_set_channel_id(&this_ptr_conv, val_ref);
39601 }
39602
39603 int64_t  __attribute__((export_name("TS_TxRemoveInput_get_serial_id"))) TS_TxRemoveInput_get_serial_id(uint64_t this_ptr) {
39604         LDKTxRemoveInput this_ptr_conv;
39605         this_ptr_conv.inner = untag_ptr(this_ptr);
39606         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39608         this_ptr_conv.is_owned = false;
39609         int64_t ret_conv = TxRemoveInput_get_serial_id(&this_ptr_conv);
39610         return ret_conv;
39611 }
39612
39613 void  __attribute__((export_name("TS_TxRemoveInput_set_serial_id"))) TS_TxRemoveInput_set_serial_id(uint64_t this_ptr, int64_t val) {
39614         LDKTxRemoveInput this_ptr_conv;
39615         this_ptr_conv.inner = untag_ptr(this_ptr);
39616         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39618         this_ptr_conv.is_owned = false;
39619         TxRemoveInput_set_serial_id(&this_ptr_conv, val);
39620 }
39621
39622 uint64_t  __attribute__((export_name("TS_TxRemoveInput_new"))) TS_TxRemoveInput_new(int8_tArray channel_id_arg, int64_t serial_id_arg) {
39623         LDKThirtyTwoBytes channel_id_arg_ref;
39624         CHECK(channel_id_arg->arr_len == 32);
39625         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
39626         LDKTxRemoveInput ret_var = TxRemoveInput_new(channel_id_arg_ref, serial_id_arg);
39627         uint64_t ret_ref = 0;
39628         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39629         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39630         return ret_ref;
39631 }
39632
39633 static inline uint64_t TxRemoveInput_clone_ptr(LDKTxRemoveInput *NONNULL_PTR arg) {
39634         LDKTxRemoveInput ret_var = TxRemoveInput_clone(arg);
39635         uint64_t ret_ref = 0;
39636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39638         return ret_ref;
39639 }
39640 int64_t  __attribute__((export_name("TS_TxRemoveInput_clone_ptr"))) TS_TxRemoveInput_clone_ptr(uint64_t arg) {
39641         LDKTxRemoveInput arg_conv;
39642         arg_conv.inner = untag_ptr(arg);
39643         arg_conv.is_owned = ptr_is_owned(arg);
39644         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39645         arg_conv.is_owned = false;
39646         int64_t ret_conv = TxRemoveInput_clone_ptr(&arg_conv);
39647         return ret_conv;
39648 }
39649
39650 uint64_t  __attribute__((export_name("TS_TxRemoveInput_clone"))) TS_TxRemoveInput_clone(uint64_t orig) {
39651         LDKTxRemoveInput orig_conv;
39652         orig_conv.inner = untag_ptr(orig);
39653         orig_conv.is_owned = ptr_is_owned(orig);
39654         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39655         orig_conv.is_owned = false;
39656         LDKTxRemoveInput ret_var = TxRemoveInput_clone(&orig_conv);
39657         uint64_t ret_ref = 0;
39658         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39659         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39660         return ret_ref;
39661 }
39662
39663 jboolean  __attribute__((export_name("TS_TxRemoveInput_eq"))) TS_TxRemoveInput_eq(uint64_t a, uint64_t b) {
39664         LDKTxRemoveInput a_conv;
39665         a_conv.inner = untag_ptr(a);
39666         a_conv.is_owned = ptr_is_owned(a);
39667         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39668         a_conv.is_owned = false;
39669         LDKTxRemoveInput b_conv;
39670         b_conv.inner = untag_ptr(b);
39671         b_conv.is_owned = ptr_is_owned(b);
39672         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39673         b_conv.is_owned = false;
39674         jboolean ret_conv = TxRemoveInput_eq(&a_conv, &b_conv);
39675         return ret_conv;
39676 }
39677
39678 void  __attribute__((export_name("TS_TxRemoveOutput_free"))) TS_TxRemoveOutput_free(uint64_t this_obj) {
39679         LDKTxRemoveOutput this_obj_conv;
39680         this_obj_conv.inner = untag_ptr(this_obj);
39681         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39683         TxRemoveOutput_free(this_obj_conv);
39684 }
39685
39686 int8_tArray  __attribute__((export_name("TS_TxRemoveOutput_get_channel_id"))) TS_TxRemoveOutput_get_channel_id(uint64_t this_ptr) {
39687         LDKTxRemoveOutput this_ptr_conv;
39688         this_ptr_conv.inner = untag_ptr(this_ptr);
39689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39691         this_ptr_conv.is_owned = false;
39692         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39693         memcpy(ret_arr->elems, *TxRemoveOutput_get_channel_id(&this_ptr_conv), 32);
39694         return ret_arr;
39695 }
39696
39697 void  __attribute__((export_name("TS_TxRemoveOutput_set_channel_id"))) TS_TxRemoveOutput_set_channel_id(uint64_t this_ptr, int8_tArray val) {
39698         LDKTxRemoveOutput this_ptr_conv;
39699         this_ptr_conv.inner = untag_ptr(this_ptr);
39700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39702         this_ptr_conv.is_owned = false;
39703         LDKThirtyTwoBytes val_ref;
39704         CHECK(val->arr_len == 32);
39705         memcpy(val_ref.data, val->elems, 32); FREE(val);
39706         TxRemoveOutput_set_channel_id(&this_ptr_conv, val_ref);
39707 }
39708
39709 int64_t  __attribute__((export_name("TS_TxRemoveOutput_get_serial_id"))) TS_TxRemoveOutput_get_serial_id(uint64_t this_ptr) {
39710         LDKTxRemoveOutput this_ptr_conv;
39711         this_ptr_conv.inner = untag_ptr(this_ptr);
39712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39714         this_ptr_conv.is_owned = false;
39715         int64_t ret_conv = TxRemoveOutput_get_serial_id(&this_ptr_conv);
39716         return ret_conv;
39717 }
39718
39719 void  __attribute__((export_name("TS_TxRemoveOutput_set_serial_id"))) TS_TxRemoveOutput_set_serial_id(uint64_t this_ptr, int64_t val) {
39720         LDKTxRemoveOutput this_ptr_conv;
39721         this_ptr_conv.inner = untag_ptr(this_ptr);
39722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39724         this_ptr_conv.is_owned = false;
39725         TxRemoveOutput_set_serial_id(&this_ptr_conv, val);
39726 }
39727
39728 uint64_t  __attribute__((export_name("TS_TxRemoveOutput_new"))) TS_TxRemoveOutput_new(int8_tArray channel_id_arg, int64_t serial_id_arg) {
39729         LDKThirtyTwoBytes channel_id_arg_ref;
39730         CHECK(channel_id_arg->arr_len == 32);
39731         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
39732         LDKTxRemoveOutput ret_var = TxRemoveOutput_new(channel_id_arg_ref, serial_id_arg);
39733         uint64_t ret_ref = 0;
39734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39736         return ret_ref;
39737 }
39738
39739 static inline uint64_t TxRemoveOutput_clone_ptr(LDKTxRemoveOutput *NONNULL_PTR arg) {
39740         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(arg);
39741         uint64_t ret_ref = 0;
39742         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39743         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39744         return ret_ref;
39745 }
39746 int64_t  __attribute__((export_name("TS_TxRemoveOutput_clone_ptr"))) TS_TxRemoveOutput_clone_ptr(uint64_t arg) {
39747         LDKTxRemoveOutput arg_conv;
39748         arg_conv.inner = untag_ptr(arg);
39749         arg_conv.is_owned = ptr_is_owned(arg);
39750         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39751         arg_conv.is_owned = false;
39752         int64_t ret_conv = TxRemoveOutput_clone_ptr(&arg_conv);
39753         return ret_conv;
39754 }
39755
39756 uint64_t  __attribute__((export_name("TS_TxRemoveOutput_clone"))) TS_TxRemoveOutput_clone(uint64_t orig) {
39757         LDKTxRemoveOutput orig_conv;
39758         orig_conv.inner = untag_ptr(orig);
39759         orig_conv.is_owned = ptr_is_owned(orig);
39760         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39761         orig_conv.is_owned = false;
39762         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(&orig_conv);
39763         uint64_t ret_ref = 0;
39764         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39765         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39766         return ret_ref;
39767 }
39768
39769 jboolean  __attribute__((export_name("TS_TxRemoveOutput_eq"))) TS_TxRemoveOutput_eq(uint64_t a, uint64_t b) {
39770         LDKTxRemoveOutput a_conv;
39771         a_conv.inner = untag_ptr(a);
39772         a_conv.is_owned = ptr_is_owned(a);
39773         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39774         a_conv.is_owned = false;
39775         LDKTxRemoveOutput b_conv;
39776         b_conv.inner = untag_ptr(b);
39777         b_conv.is_owned = ptr_is_owned(b);
39778         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39779         b_conv.is_owned = false;
39780         jboolean ret_conv = TxRemoveOutput_eq(&a_conv, &b_conv);
39781         return ret_conv;
39782 }
39783
39784 void  __attribute__((export_name("TS_TxComplete_free"))) TS_TxComplete_free(uint64_t this_obj) {
39785         LDKTxComplete this_obj_conv;
39786         this_obj_conv.inner = untag_ptr(this_obj);
39787         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39789         TxComplete_free(this_obj_conv);
39790 }
39791
39792 int8_tArray  __attribute__((export_name("TS_TxComplete_get_channel_id"))) TS_TxComplete_get_channel_id(uint64_t this_ptr) {
39793         LDKTxComplete this_ptr_conv;
39794         this_ptr_conv.inner = untag_ptr(this_ptr);
39795         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39797         this_ptr_conv.is_owned = false;
39798         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39799         memcpy(ret_arr->elems, *TxComplete_get_channel_id(&this_ptr_conv), 32);
39800         return ret_arr;
39801 }
39802
39803 void  __attribute__((export_name("TS_TxComplete_set_channel_id"))) TS_TxComplete_set_channel_id(uint64_t this_ptr, int8_tArray val) {
39804         LDKTxComplete this_ptr_conv;
39805         this_ptr_conv.inner = untag_ptr(this_ptr);
39806         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39808         this_ptr_conv.is_owned = false;
39809         LDKThirtyTwoBytes val_ref;
39810         CHECK(val->arr_len == 32);
39811         memcpy(val_ref.data, val->elems, 32); FREE(val);
39812         TxComplete_set_channel_id(&this_ptr_conv, val_ref);
39813 }
39814
39815 uint64_t  __attribute__((export_name("TS_TxComplete_new"))) TS_TxComplete_new(int8_tArray channel_id_arg) {
39816         LDKThirtyTwoBytes channel_id_arg_ref;
39817         CHECK(channel_id_arg->arr_len == 32);
39818         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
39819         LDKTxComplete ret_var = TxComplete_new(channel_id_arg_ref);
39820         uint64_t ret_ref = 0;
39821         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39822         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39823         return ret_ref;
39824 }
39825
39826 static inline uint64_t TxComplete_clone_ptr(LDKTxComplete *NONNULL_PTR arg) {
39827         LDKTxComplete ret_var = TxComplete_clone(arg);
39828         uint64_t ret_ref = 0;
39829         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39830         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39831         return ret_ref;
39832 }
39833 int64_t  __attribute__((export_name("TS_TxComplete_clone_ptr"))) TS_TxComplete_clone_ptr(uint64_t arg) {
39834         LDKTxComplete arg_conv;
39835         arg_conv.inner = untag_ptr(arg);
39836         arg_conv.is_owned = ptr_is_owned(arg);
39837         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39838         arg_conv.is_owned = false;
39839         int64_t ret_conv = TxComplete_clone_ptr(&arg_conv);
39840         return ret_conv;
39841 }
39842
39843 uint64_t  __attribute__((export_name("TS_TxComplete_clone"))) TS_TxComplete_clone(uint64_t orig) {
39844         LDKTxComplete orig_conv;
39845         orig_conv.inner = untag_ptr(orig);
39846         orig_conv.is_owned = ptr_is_owned(orig);
39847         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39848         orig_conv.is_owned = false;
39849         LDKTxComplete ret_var = TxComplete_clone(&orig_conv);
39850         uint64_t ret_ref = 0;
39851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39853         return ret_ref;
39854 }
39855
39856 jboolean  __attribute__((export_name("TS_TxComplete_eq"))) TS_TxComplete_eq(uint64_t a, uint64_t b) {
39857         LDKTxComplete a_conv;
39858         a_conv.inner = untag_ptr(a);
39859         a_conv.is_owned = ptr_is_owned(a);
39860         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39861         a_conv.is_owned = false;
39862         LDKTxComplete b_conv;
39863         b_conv.inner = untag_ptr(b);
39864         b_conv.is_owned = ptr_is_owned(b);
39865         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39866         b_conv.is_owned = false;
39867         jboolean ret_conv = TxComplete_eq(&a_conv, &b_conv);
39868         return ret_conv;
39869 }
39870
39871 void  __attribute__((export_name("TS_TxSignatures_free"))) TS_TxSignatures_free(uint64_t this_obj) {
39872         LDKTxSignatures this_obj_conv;
39873         this_obj_conv.inner = untag_ptr(this_obj);
39874         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39876         TxSignatures_free(this_obj_conv);
39877 }
39878
39879 int8_tArray  __attribute__((export_name("TS_TxSignatures_get_channel_id"))) TS_TxSignatures_get_channel_id(uint64_t this_ptr) {
39880         LDKTxSignatures this_ptr_conv;
39881         this_ptr_conv.inner = untag_ptr(this_ptr);
39882         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39884         this_ptr_conv.is_owned = false;
39885         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39886         memcpy(ret_arr->elems, *TxSignatures_get_channel_id(&this_ptr_conv), 32);
39887         return ret_arr;
39888 }
39889
39890 void  __attribute__((export_name("TS_TxSignatures_set_channel_id"))) TS_TxSignatures_set_channel_id(uint64_t this_ptr, int8_tArray val) {
39891         LDKTxSignatures this_ptr_conv;
39892         this_ptr_conv.inner = untag_ptr(this_ptr);
39893         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39895         this_ptr_conv.is_owned = false;
39896         LDKThirtyTwoBytes val_ref;
39897         CHECK(val->arr_len == 32);
39898         memcpy(val_ref.data, val->elems, 32); FREE(val);
39899         TxSignatures_set_channel_id(&this_ptr_conv, val_ref);
39900 }
39901
39902 int8_tArray  __attribute__((export_name("TS_TxSignatures_get_tx_hash"))) TS_TxSignatures_get_tx_hash(uint64_t this_ptr) {
39903         LDKTxSignatures this_ptr_conv;
39904         this_ptr_conv.inner = untag_ptr(this_ptr);
39905         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39907         this_ptr_conv.is_owned = false;
39908         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39909         memcpy(ret_arr->elems, *TxSignatures_get_tx_hash(&this_ptr_conv), 32);
39910         return ret_arr;
39911 }
39912
39913 void  __attribute__((export_name("TS_TxSignatures_set_tx_hash"))) TS_TxSignatures_set_tx_hash(uint64_t this_ptr, int8_tArray val) {
39914         LDKTxSignatures this_ptr_conv;
39915         this_ptr_conv.inner = untag_ptr(this_ptr);
39916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39918         this_ptr_conv.is_owned = false;
39919         LDKThirtyTwoBytes val_ref;
39920         CHECK(val->arr_len == 32);
39921         memcpy(val_ref.data, val->elems, 32); FREE(val);
39922         TxSignatures_set_tx_hash(&this_ptr_conv, val_ref);
39923 }
39924
39925 ptrArray  __attribute__((export_name("TS_TxSignatures_get_witnesses"))) TS_TxSignatures_get_witnesses(uint64_t this_ptr) {
39926         LDKTxSignatures this_ptr_conv;
39927         this_ptr_conv.inner = untag_ptr(this_ptr);
39928         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39930         this_ptr_conv.is_owned = false;
39931         LDKCVec_WitnessZ ret_var = TxSignatures_get_witnesses(&this_ptr_conv);
39932         ptrArray ret_arr = NULL;
39933         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
39934         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
39935         for (size_t m = 0; m < ret_var.datalen; m++) {
39936                 LDKWitness ret_conv_12_var = ret_var.data[m];
39937                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
39938                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
39939                 Witness_free(ret_conv_12_var);
39940                 ret_arr_ptr[m] = ret_conv_12_arr;
39941         }
39942         
39943         FREE(ret_var.data);
39944         return ret_arr;
39945 }
39946
39947 void  __attribute__((export_name("TS_TxSignatures_set_witnesses"))) TS_TxSignatures_set_witnesses(uint64_t this_ptr, ptrArray val) {
39948         LDKTxSignatures this_ptr_conv;
39949         this_ptr_conv.inner = untag_ptr(this_ptr);
39950         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39952         this_ptr_conv.is_owned = false;
39953         LDKCVec_WitnessZ val_constr;
39954         val_constr.datalen = val->arr_len;
39955         if (val_constr.datalen > 0)
39956                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
39957         else
39958                 val_constr.data = NULL;
39959         int8_tArray* val_vals = (void*) val->elems;
39960         for (size_t m = 0; m < val_constr.datalen; m++) {
39961                 int8_tArray val_conv_12 = val_vals[m];
39962                 LDKWitness val_conv_12_ref;
39963                 val_conv_12_ref.datalen = val_conv_12->arr_len;
39964                 val_conv_12_ref.data = MALLOC(val_conv_12_ref.datalen, "LDKWitness Bytes");
39965                 memcpy(val_conv_12_ref.data, val_conv_12->elems, val_conv_12_ref.datalen); FREE(val_conv_12);
39966                 val_conv_12_ref.data_is_owned = true;
39967                 val_constr.data[m] = val_conv_12_ref;
39968         }
39969         FREE(val);
39970         TxSignatures_set_witnesses(&this_ptr_conv, val_constr);
39971 }
39972
39973 uint64_t  __attribute__((export_name("TS_TxSignatures_new"))) TS_TxSignatures_new(int8_tArray channel_id_arg, int8_tArray tx_hash_arg, ptrArray witnesses_arg) {
39974         LDKThirtyTwoBytes channel_id_arg_ref;
39975         CHECK(channel_id_arg->arr_len == 32);
39976         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
39977         LDKThirtyTwoBytes tx_hash_arg_ref;
39978         CHECK(tx_hash_arg->arr_len == 32);
39979         memcpy(tx_hash_arg_ref.data, tx_hash_arg->elems, 32); FREE(tx_hash_arg);
39980         LDKCVec_WitnessZ witnesses_arg_constr;
39981         witnesses_arg_constr.datalen = witnesses_arg->arr_len;
39982         if (witnesses_arg_constr.datalen > 0)
39983                 witnesses_arg_constr.data = MALLOC(witnesses_arg_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
39984         else
39985                 witnesses_arg_constr.data = NULL;
39986         int8_tArray* witnesses_arg_vals = (void*) witnesses_arg->elems;
39987         for (size_t m = 0; m < witnesses_arg_constr.datalen; m++) {
39988                 int8_tArray witnesses_arg_conv_12 = witnesses_arg_vals[m];
39989                 LDKWitness witnesses_arg_conv_12_ref;
39990                 witnesses_arg_conv_12_ref.datalen = witnesses_arg_conv_12->arr_len;
39991                 witnesses_arg_conv_12_ref.data = MALLOC(witnesses_arg_conv_12_ref.datalen, "LDKWitness Bytes");
39992                 memcpy(witnesses_arg_conv_12_ref.data, witnesses_arg_conv_12->elems, witnesses_arg_conv_12_ref.datalen); FREE(witnesses_arg_conv_12);
39993                 witnesses_arg_conv_12_ref.data_is_owned = true;
39994                 witnesses_arg_constr.data[m] = witnesses_arg_conv_12_ref;
39995         }
39996         FREE(witnesses_arg);
39997         LDKTxSignatures ret_var = TxSignatures_new(channel_id_arg_ref, tx_hash_arg_ref, witnesses_arg_constr);
39998         uint64_t ret_ref = 0;
39999         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40000         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40001         return ret_ref;
40002 }
40003
40004 static inline uint64_t TxSignatures_clone_ptr(LDKTxSignatures *NONNULL_PTR arg) {
40005         LDKTxSignatures ret_var = TxSignatures_clone(arg);
40006         uint64_t ret_ref = 0;
40007         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40008         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40009         return ret_ref;
40010 }
40011 int64_t  __attribute__((export_name("TS_TxSignatures_clone_ptr"))) TS_TxSignatures_clone_ptr(uint64_t arg) {
40012         LDKTxSignatures arg_conv;
40013         arg_conv.inner = untag_ptr(arg);
40014         arg_conv.is_owned = ptr_is_owned(arg);
40015         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40016         arg_conv.is_owned = false;
40017         int64_t ret_conv = TxSignatures_clone_ptr(&arg_conv);
40018         return ret_conv;
40019 }
40020
40021 uint64_t  __attribute__((export_name("TS_TxSignatures_clone"))) TS_TxSignatures_clone(uint64_t orig) {
40022         LDKTxSignatures orig_conv;
40023         orig_conv.inner = untag_ptr(orig);
40024         orig_conv.is_owned = ptr_is_owned(orig);
40025         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40026         orig_conv.is_owned = false;
40027         LDKTxSignatures ret_var = TxSignatures_clone(&orig_conv);
40028         uint64_t ret_ref = 0;
40029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40031         return ret_ref;
40032 }
40033
40034 jboolean  __attribute__((export_name("TS_TxSignatures_eq"))) TS_TxSignatures_eq(uint64_t a, uint64_t b) {
40035         LDKTxSignatures a_conv;
40036         a_conv.inner = untag_ptr(a);
40037         a_conv.is_owned = ptr_is_owned(a);
40038         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40039         a_conv.is_owned = false;
40040         LDKTxSignatures b_conv;
40041         b_conv.inner = untag_ptr(b);
40042         b_conv.is_owned = ptr_is_owned(b);
40043         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40044         b_conv.is_owned = false;
40045         jboolean ret_conv = TxSignatures_eq(&a_conv, &b_conv);
40046         return ret_conv;
40047 }
40048
40049 void  __attribute__((export_name("TS_TxInitRbf_free"))) TS_TxInitRbf_free(uint64_t this_obj) {
40050         LDKTxInitRbf this_obj_conv;
40051         this_obj_conv.inner = untag_ptr(this_obj);
40052         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40054         TxInitRbf_free(this_obj_conv);
40055 }
40056
40057 int8_tArray  __attribute__((export_name("TS_TxInitRbf_get_channel_id"))) TS_TxInitRbf_get_channel_id(uint64_t this_ptr) {
40058         LDKTxInitRbf this_ptr_conv;
40059         this_ptr_conv.inner = untag_ptr(this_ptr);
40060         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40062         this_ptr_conv.is_owned = false;
40063         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40064         memcpy(ret_arr->elems, *TxInitRbf_get_channel_id(&this_ptr_conv), 32);
40065         return ret_arr;
40066 }
40067
40068 void  __attribute__((export_name("TS_TxInitRbf_set_channel_id"))) TS_TxInitRbf_set_channel_id(uint64_t this_ptr, int8_tArray val) {
40069         LDKTxInitRbf this_ptr_conv;
40070         this_ptr_conv.inner = untag_ptr(this_ptr);
40071         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40073         this_ptr_conv.is_owned = false;
40074         LDKThirtyTwoBytes val_ref;
40075         CHECK(val->arr_len == 32);
40076         memcpy(val_ref.data, val->elems, 32); FREE(val);
40077         TxInitRbf_set_channel_id(&this_ptr_conv, val_ref);
40078 }
40079
40080 int32_t  __attribute__((export_name("TS_TxInitRbf_get_locktime"))) TS_TxInitRbf_get_locktime(uint64_t this_ptr) {
40081         LDKTxInitRbf this_ptr_conv;
40082         this_ptr_conv.inner = untag_ptr(this_ptr);
40083         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40085         this_ptr_conv.is_owned = false;
40086         int32_t ret_conv = TxInitRbf_get_locktime(&this_ptr_conv);
40087         return ret_conv;
40088 }
40089
40090 void  __attribute__((export_name("TS_TxInitRbf_set_locktime"))) TS_TxInitRbf_set_locktime(uint64_t this_ptr, int32_t val) {
40091         LDKTxInitRbf this_ptr_conv;
40092         this_ptr_conv.inner = untag_ptr(this_ptr);
40093         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40095         this_ptr_conv.is_owned = false;
40096         TxInitRbf_set_locktime(&this_ptr_conv, val);
40097 }
40098
40099 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) {
40100         LDKTxInitRbf this_ptr_conv;
40101         this_ptr_conv.inner = untag_ptr(this_ptr);
40102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40104         this_ptr_conv.is_owned = false;
40105         int32_t ret_conv = TxInitRbf_get_feerate_sat_per_1000_weight(&this_ptr_conv);
40106         return ret_conv;
40107 }
40108
40109 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) {
40110         LDKTxInitRbf this_ptr_conv;
40111         this_ptr_conv.inner = untag_ptr(this_ptr);
40112         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40114         this_ptr_conv.is_owned = false;
40115         TxInitRbf_set_feerate_sat_per_1000_weight(&this_ptr_conv, val);
40116 }
40117
40118 uint64_t  __attribute__((export_name("TS_TxInitRbf_get_funding_output_contribution"))) TS_TxInitRbf_get_funding_output_contribution(uint64_t this_ptr) {
40119         LDKTxInitRbf this_ptr_conv;
40120         this_ptr_conv.inner = untag_ptr(this_ptr);
40121         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40123         this_ptr_conv.is_owned = false;
40124         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
40125         *ret_copy = TxInitRbf_get_funding_output_contribution(&this_ptr_conv);
40126         uint64_t ret_ref = tag_ptr(ret_copy, true);
40127         return ret_ref;
40128 }
40129
40130 void  __attribute__((export_name("TS_TxInitRbf_set_funding_output_contribution"))) TS_TxInitRbf_set_funding_output_contribution(uint64_t this_ptr, uint64_t val) {
40131         LDKTxInitRbf this_ptr_conv;
40132         this_ptr_conv.inner = untag_ptr(this_ptr);
40133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40135         this_ptr_conv.is_owned = false;
40136         void* val_ptr = untag_ptr(val);
40137         CHECK_ACCESS(val_ptr);
40138         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
40139         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
40140         TxInitRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
40141 }
40142
40143 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) {
40144         LDKThirtyTwoBytes channel_id_arg_ref;
40145         CHECK(channel_id_arg->arr_len == 32);
40146         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
40147         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
40148         CHECK_ACCESS(funding_output_contribution_arg_ptr);
40149         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
40150         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
40151         LDKTxInitRbf ret_var = TxInitRbf_new(channel_id_arg_ref, locktime_arg, feerate_sat_per_1000_weight_arg, funding_output_contribution_arg_conv);
40152         uint64_t ret_ref = 0;
40153         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40154         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40155         return ret_ref;
40156 }
40157
40158 static inline uint64_t TxInitRbf_clone_ptr(LDKTxInitRbf *NONNULL_PTR arg) {
40159         LDKTxInitRbf ret_var = TxInitRbf_clone(arg);
40160         uint64_t ret_ref = 0;
40161         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40162         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40163         return ret_ref;
40164 }
40165 int64_t  __attribute__((export_name("TS_TxInitRbf_clone_ptr"))) TS_TxInitRbf_clone_ptr(uint64_t arg) {
40166         LDKTxInitRbf arg_conv;
40167         arg_conv.inner = untag_ptr(arg);
40168         arg_conv.is_owned = ptr_is_owned(arg);
40169         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40170         arg_conv.is_owned = false;
40171         int64_t ret_conv = TxInitRbf_clone_ptr(&arg_conv);
40172         return ret_conv;
40173 }
40174
40175 uint64_t  __attribute__((export_name("TS_TxInitRbf_clone"))) TS_TxInitRbf_clone(uint64_t orig) {
40176         LDKTxInitRbf orig_conv;
40177         orig_conv.inner = untag_ptr(orig);
40178         orig_conv.is_owned = ptr_is_owned(orig);
40179         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40180         orig_conv.is_owned = false;
40181         LDKTxInitRbf ret_var = TxInitRbf_clone(&orig_conv);
40182         uint64_t ret_ref = 0;
40183         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40184         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40185         return ret_ref;
40186 }
40187
40188 jboolean  __attribute__((export_name("TS_TxInitRbf_eq"))) TS_TxInitRbf_eq(uint64_t a, uint64_t b) {
40189         LDKTxInitRbf a_conv;
40190         a_conv.inner = untag_ptr(a);
40191         a_conv.is_owned = ptr_is_owned(a);
40192         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40193         a_conv.is_owned = false;
40194         LDKTxInitRbf b_conv;
40195         b_conv.inner = untag_ptr(b);
40196         b_conv.is_owned = ptr_is_owned(b);
40197         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40198         b_conv.is_owned = false;
40199         jboolean ret_conv = TxInitRbf_eq(&a_conv, &b_conv);
40200         return ret_conv;
40201 }
40202
40203 void  __attribute__((export_name("TS_TxAckRbf_free"))) TS_TxAckRbf_free(uint64_t this_obj) {
40204         LDKTxAckRbf this_obj_conv;
40205         this_obj_conv.inner = untag_ptr(this_obj);
40206         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40208         TxAckRbf_free(this_obj_conv);
40209 }
40210
40211 int8_tArray  __attribute__((export_name("TS_TxAckRbf_get_channel_id"))) TS_TxAckRbf_get_channel_id(uint64_t this_ptr) {
40212         LDKTxAckRbf this_ptr_conv;
40213         this_ptr_conv.inner = untag_ptr(this_ptr);
40214         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40216         this_ptr_conv.is_owned = false;
40217         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40218         memcpy(ret_arr->elems, *TxAckRbf_get_channel_id(&this_ptr_conv), 32);
40219         return ret_arr;
40220 }
40221
40222 void  __attribute__((export_name("TS_TxAckRbf_set_channel_id"))) TS_TxAckRbf_set_channel_id(uint64_t this_ptr, int8_tArray val) {
40223         LDKTxAckRbf this_ptr_conv;
40224         this_ptr_conv.inner = untag_ptr(this_ptr);
40225         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40227         this_ptr_conv.is_owned = false;
40228         LDKThirtyTwoBytes val_ref;
40229         CHECK(val->arr_len == 32);
40230         memcpy(val_ref.data, val->elems, 32); FREE(val);
40231         TxAckRbf_set_channel_id(&this_ptr_conv, val_ref);
40232 }
40233
40234 uint64_t  __attribute__((export_name("TS_TxAckRbf_get_funding_output_contribution"))) TS_TxAckRbf_get_funding_output_contribution(uint64_t this_ptr) {
40235         LDKTxAckRbf this_ptr_conv;
40236         this_ptr_conv.inner = untag_ptr(this_ptr);
40237         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40239         this_ptr_conv.is_owned = false;
40240         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
40241         *ret_copy = TxAckRbf_get_funding_output_contribution(&this_ptr_conv);
40242         uint64_t ret_ref = tag_ptr(ret_copy, true);
40243         return ret_ref;
40244 }
40245
40246 void  __attribute__((export_name("TS_TxAckRbf_set_funding_output_contribution"))) TS_TxAckRbf_set_funding_output_contribution(uint64_t this_ptr, uint64_t val) {
40247         LDKTxAckRbf this_ptr_conv;
40248         this_ptr_conv.inner = untag_ptr(this_ptr);
40249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40251         this_ptr_conv.is_owned = false;
40252         void* val_ptr = untag_ptr(val);
40253         CHECK_ACCESS(val_ptr);
40254         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
40255         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
40256         TxAckRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
40257 }
40258
40259 uint64_t  __attribute__((export_name("TS_TxAckRbf_new"))) TS_TxAckRbf_new(int8_tArray channel_id_arg, uint64_t funding_output_contribution_arg) {
40260         LDKThirtyTwoBytes channel_id_arg_ref;
40261         CHECK(channel_id_arg->arr_len == 32);
40262         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
40263         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
40264         CHECK_ACCESS(funding_output_contribution_arg_ptr);
40265         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
40266         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
40267         LDKTxAckRbf ret_var = TxAckRbf_new(channel_id_arg_ref, funding_output_contribution_arg_conv);
40268         uint64_t ret_ref = 0;
40269         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40270         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40271         return ret_ref;
40272 }
40273
40274 static inline uint64_t TxAckRbf_clone_ptr(LDKTxAckRbf *NONNULL_PTR arg) {
40275         LDKTxAckRbf ret_var = TxAckRbf_clone(arg);
40276         uint64_t ret_ref = 0;
40277         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40278         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40279         return ret_ref;
40280 }
40281 int64_t  __attribute__((export_name("TS_TxAckRbf_clone_ptr"))) TS_TxAckRbf_clone_ptr(uint64_t arg) {
40282         LDKTxAckRbf arg_conv;
40283         arg_conv.inner = untag_ptr(arg);
40284         arg_conv.is_owned = ptr_is_owned(arg);
40285         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40286         arg_conv.is_owned = false;
40287         int64_t ret_conv = TxAckRbf_clone_ptr(&arg_conv);
40288         return ret_conv;
40289 }
40290
40291 uint64_t  __attribute__((export_name("TS_TxAckRbf_clone"))) TS_TxAckRbf_clone(uint64_t orig) {
40292         LDKTxAckRbf orig_conv;
40293         orig_conv.inner = untag_ptr(orig);
40294         orig_conv.is_owned = ptr_is_owned(orig);
40295         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40296         orig_conv.is_owned = false;
40297         LDKTxAckRbf ret_var = TxAckRbf_clone(&orig_conv);
40298         uint64_t ret_ref = 0;
40299         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40300         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40301         return ret_ref;
40302 }
40303
40304 jboolean  __attribute__((export_name("TS_TxAckRbf_eq"))) TS_TxAckRbf_eq(uint64_t a, uint64_t b) {
40305         LDKTxAckRbf a_conv;
40306         a_conv.inner = untag_ptr(a);
40307         a_conv.is_owned = ptr_is_owned(a);
40308         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40309         a_conv.is_owned = false;
40310         LDKTxAckRbf b_conv;
40311         b_conv.inner = untag_ptr(b);
40312         b_conv.is_owned = ptr_is_owned(b);
40313         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40314         b_conv.is_owned = false;
40315         jboolean ret_conv = TxAckRbf_eq(&a_conv, &b_conv);
40316         return ret_conv;
40317 }
40318
40319 void  __attribute__((export_name("TS_TxAbort_free"))) TS_TxAbort_free(uint64_t this_obj) {
40320         LDKTxAbort this_obj_conv;
40321         this_obj_conv.inner = untag_ptr(this_obj);
40322         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40324         TxAbort_free(this_obj_conv);
40325 }
40326
40327 int8_tArray  __attribute__((export_name("TS_TxAbort_get_channel_id"))) TS_TxAbort_get_channel_id(uint64_t this_ptr) {
40328         LDKTxAbort this_ptr_conv;
40329         this_ptr_conv.inner = untag_ptr(this_ptr);
40330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40332         this_ptr_conv.is_owned = false;
40333         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40334         memcpy(ret_arr->elems, *TxAbort_get_channel_id(&this_ptr_conv), 32);
40335         return ret_arr;
40336 }
40337
40338 void  __attribute__((export_name("TS_TxAbort_set_channel_id"))) TS_TxAbort_set_channel_id(uint64_t this_ptr, int8_tArray val) {
40339         LDKTxAbort this_ptr_conv;
40340         this_ptr_conv.inner = untag_ptr(this_ptr);
40341         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40343         this_ptr_conv.is_owned = false;
40344         LDKThirtyTwoBytes val_ref;
40345         CHECK(val->arr_len == 32);
40346         memcpy(val_ref.data, val->elems, 32); FREE(val);
40347         TxAbort_set_channel_id(&this_ptr_conv, val_ref);
40348 }
40349
40350 int8_tArray  __attribute__((export_name("TS_TxAbort_get_data"))) TS_TxAbort_get_data(uint64_t this_ptr) {
40351         LDKTxAbort this_ptr_conv;
40352         this_ptr_conv.inner = untag_ptr(this_ptr);
40353         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40355         this_ptr_conv.is_owned = false;
40356         LDKCVec_u8Z ret_var = TxAbort_get_data(&this_ptr_conv);
40357         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40358         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40359         CVec_u8Z_free(ret_var);
40360         return ret_arr;
40361 }
40362
40363 void  __attribute__((export_name("TS_TxAbort_set_data"))) TS_TxAbort_set_data(uint64_t this_ptr, int8_tArray val) {
40364         LDKTxAbort this_ptr_conv;
40365         this_ptr_conv.inner = untag_ptr(this_ptr);
40366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40368         this_ptr_conv.is_owned = false;
40369         LDKCVec_u8Z val_ref;
40370         val_ref.datalen = val->arr_len;
40371         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
40372         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
40373         TxAbort_set_data(&this_ptr_conv, val_ref);
40374 }
40375
40376 uint64_t  __attribute__((export_name("TS_TxAbort_new"))) TS_TxAbort_new(int8_tArray channel_id_arg, int8_tArray data_arg) {
40377         LDKThirtyTwoBytes channel_id_arg_ref;
40378         CHECK(channel_id_arg->arr_len == 32);
40379         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
40380         LDKCVec_u8Z data_arg_ref;
40381         data_arg_ref.datalen = data_arg->arr_len;
40382         data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
40383         memcpy(data_arg_ref.data, data_arg->elems, data_arg_ref.datalen); FREE(data_arg);
40384         LDKTxAbort ret_var = TxAbort_new(channel_id_arg_ref, data_arg_ref);
40385         uint64_t ret_ref = 0;
40386         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40387         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40388         return ret_ref;
40389 }
40390
40391 static inline uint64_t TxAbort_clone_ptr(LDKTxAbort *NONNULL_PTR arg) {
40392         LDKTxAbort ret_var = TxAbort_clone(arg);
40393         uint64_t ret_ref = 0;
40394         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40395         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40396         return ret_ref;
40397 }
40398 int64_t  __attribute__((export_name("TS_TxAbort_clone_ptr"))) TS_TxAbort_clone_ptr(uint64_t arg) {
40399         LDKTxAbort arg_conv;
40400         arg_conv.inner = untag_ptr(arg);
40401         arg_conv.is_owned = ptr_is_owned(arg);
40402         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40403         arg_conv.is_owned = false;
40404         int64_t ret_conv = TxAbort_clone_ptr(&arg_conv);
40405         return ret_conv;
40406 }
40407
40408 uint64_t  __attribute__((export_name("TS_TxAbort_clone"))) TS_TxAbort_clone(uint64_t orig) {
40409         LDKTxAbort orig_conv;
40410         orig_conv.inner = untag_ptr(orig);
40411         orig_conv.is_owned = ptr_is_owned(orig);
40412         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40413         orig_conv.is_owned = false;
40414         LDKTxAbort ret_var = TxAbort_clone(&orig_conv);
40415         uint64_t ret_ref = 0;
40416         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40417         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40418         return ret_ref;
40419 }
40420
40421 jboolean  __attribute__((export_name("TS_TxAbort_eq"))) TS_TxAbort_eq(uint64_t a, uint64_t b) {
40422         LDKTxAbort a_conv;
40423         a_conv.inner = untag_ptr(a);
40424         a_conv.is_owned = ptr_is_owned(a);
40425         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40426         a_conv.is_owned = false;
40427         LDKTxAbort b_conv;
40428         b_conv.inner = untag_ptr(b);
40429         b_conv.is_owned = ptr_is_owned(b);
40430         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40431         b_conv.is_owned = false;
40432         jboolean ret_conv = TxAbort_eq(&a_conv, &b_conv);
40433         return ret_conv;
40434 }
40435
40436 void  __attribute__((export_name("TS_Shutdown_free"))) TS_Shutdown_free(uint64_t this_obj) {
40437         LDKShutdown this_obj_conv;
40438         this_obj_conv.inner = untag_ptr(this_obj);
40439         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40441         Shutdown_free(this_obj_conv);
40442 }
40443
40444 int8_tArray  __attribute__((export_name("TS_Shutdown_get_channel_id"))) TS_Shutdown_get_channel_id(uint64_t this_ptr) {
40445         LDKShutdown this_ptr_conv;
40446         this_ptr_conv.inner = untag_ptr(this_ptr);
40447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40449         this_ptr_conv.is_owned = false;
40450         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40451         memcpy(ret_arr->elems, *Shutdown_get_channel_id(&this_ptr_conv), 32);
40452         return ret_arr;
40453 }
40454
40455 void  __attribute__((export_name("TS_Shutdown_set_channel_id"))) TS_Shutdown_set_channel_id(uint64_t this_ptr, int8_tArray val) {
40456         LDKShutdown this_ptr_conv;
40457         this_ptr_conv.inner = untag_ptr(this_ptr);
40458         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40460         this_ptr_conv.is_owned = false;
40461         LDKThirtyTwoBytes val_ref;
40462         CHECK(val->arr_len == 32);
40463         memcpy(val_ref.data, val->elems, 32); FREE(val);
40464         Shutdown_set_channel_id(&this_ptr_conv, val_ref);
40465 }
40466
40467 int8_tArray  __attribute__((export_name("TS_Shutdown_get_scriptpubkey"))) TS_Shutdown_get_scriptpubkey(uint64_t this_ptr) {
40468         LDKShutdown this_ptr_conv;
40469         this_ptr_conv.inner = untag_ptr(this_ptr);
40470         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40472         this_ptr_conv.is_owned = false;
40473         LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
40474         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40475         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40476         return ret_arr;
40477 }
40478
40479 void  __attribute__((export_name("TS_Shutdown_set_scriptpubkey"))) TS_Shutdown_set_scriptpubkey(uint64_t this_ptr, int8_tArray val) {
40480         LDKShutdown this_ptr_conv;
40481         this_ptr_conv.inner = untag_ptr(this_ptr);
40482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40484         this_ptr_conv.is_owned = false;
40485         LDKCVec_u8Z val_ref;
40486         val_ref.datalen = val->arr_len;
40487         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
40488         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
40489         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
40490 }
40491
40492 uint64_t  __attribute__((export_name("TS_Shutdown_new"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
40493         LDKThirtyTwoBytes channel_id_arg_ref;
40494         CHECK(channel_id_arg->arr_len == 32);
40495         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
40496         LDKCVec_u8Z scriptpubkey_arg_ref;
40497         scriptpubkey_arg_ref.datalen = scriptpubkey_arg->arr_len;
40498         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
40499         memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg->elems, scriptpubkey_arg_ref.datalen); FREE(scriptpubkey_arg);
40500         LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
40501         uint64_t ret_ref = 0;
40502         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40503         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40504         return ret_ref;
40505 }
40506
40507 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
40508         LDKShutdown ret_var = Shutdown_clone(arg);
40509         uint64_t ret_ref = 0;
40510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40512         return ret_ref;
40513 }
40514 int64_t  __attribute__((export_name("TS_Shutdown_clone_ptr"))) TS_Shutdown_clone_ptr(uint64_t arg) {
40515         LDKShutdown arg_conv;
40516         arg_conv.inner = untag_ptr(arg);
40517         arg_conv.is_owned = ptr_is_owned(arg);
40518         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40519         arg_conv.is_owned = false;
40520         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
40521         return ret_conv;
40522 }
40523
40524 uint64_t  __attribute__((export_name("TS_Shutdown_clone"))) TS_Shutdown_clone(uint64_t orig) {
40525         LDKShutdown orig_conv;
40526         orig_conv.inner = untag_ptr(orig);
40527         orig_conv.is_owned = ptr_is_owned(orig);
40528         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40529         orig_conv.is_owned = false;
40530         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
40531         uint64_t ret_ref = 0;
40532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40533         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40534         return ret_ref;
40535 }
40536
40537 jboolean  __attribute__((export_name("TS_Shutdown_eq"))) TS_Shutdown_eq(uint64_t a, uint64_t b) {
40538         LDKShutdown a_conv;
40539         a_conv.inner = untag_ptr(a);
40540         a_conv.is_owned = ptr_is_owned(a);
40541         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40542         a_conv.is_owned = false;
40543         LDKShutdown b_conv;
40544         b_conv.inner = untag_ptr(b);
40545         b_conv.is_owned = ptr_is_owned(b);
40546         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40547         b_conv.is_owned = false;
40548         jboolean ret_conv = Shutdown_eq(&a_conv, &b_conv);
40549         return ret_conv;
40550 }
40551
40552 void  __attribute__((export_name("TS_ClosingSignedFeeRange_free"))) TS_ClosingSignedFeeRange_free(uint64_t this_obj) {
40553         LDKClosingSignedFeeRange this_obj_conv;
40554         this_obj_conv.inner = untag_ptr(this_obj);
40555         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40557         ClosingSignedFeeRange_free(this_obj_conv);
40558 }
40559
40560 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_min_fee_satoshis"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint64_t this_ptr) {
40561         LDKClosingSignedFeeRange this_ptr_conv;
40562         this_ptr_conv.inner = untag_ptr(this_ptr);
40563         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40565         this_ptr_conv.is_owned = false;
40566         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
40567         return ret_conv;
40568 }
40569
40570 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_min_fee_satoshis"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint64_t this_ptr, int64_t val) {
40571         LDKClosingSignedFeeRange this_ptr_conv;
40572         this_ptr_conv.inner = untag_ptr(this_ptr);
40573         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40575         this_ptr_conv.is_owned = false;
40576         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
40577 }
40578
40579 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_max_fee_satoshis"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint64_t this_ptr) {
40580         LDKClosingSignedFeeRange this_ptr_conv;
40581         this_ptr_conv.inner = untag_ptr(this_ptr);
40582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40584         this_ptr_conv.is_owned = false;
40585         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
40586         return ret_conv;
40587 }
40588
40589 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_max_fee_satoshis"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint64_t this_ptr, int64_t val) {
40590         LDKClosingSignedFeeRange this_ptr_conv;
40591         this_ptr_conv.inner = untag_ptr(this_ptr);
40592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40594         this_ptr_conv.is_owned = false;
40595         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
40596 }
40597
40598 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_new"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
40599         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
40600         uint64_t ret_ref = 0;
40601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40603         return ret_ref;
40604 }
40605
40606 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
40607         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
40608         uint64_t ret_ref = 0;
40609         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40610         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40611         return ret_ref;
40612 }
40613 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone_ptr"))) TS_ClosingSignedFeeRange_clone_ptr(uint64_t arg) {
40614         LDKClosingSignedFeeRange arg_conv;
40615         arg_conv.inner = untag_ptr(arg);
40616         arg_conv.is_owned = ptr_is_owned(arg);
40617         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40618         arg_conv.is_owned = false;
40619         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
40620         return ret_conv;
40621 }
40622
40623 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone"))) TS_ClosingSignedFeeRange_clone(uint64_t orig) {
40624         LDKClosingSignedFeeRange orig_conv;
40625         orig_conv.inner = untag_ptr(orig);
40626         orig_conv.is_owned = ptr_is_owned(orig);
40627         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40628         orig_conv.is_owned = false;
40629         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
40630         uint64_t ret_ref = 0;
40631         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40632         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40633         return ret_ref;
40634 }
40635
40636 jboolean  __attribute__((export_name("TS_ClosingSignedFeeRange_eq"))) TS_ClosingSignedFeeRange_eq(uint64_t a, uint64_t b) {
40637         LDKClosingSignedFeeRange a_conv;
40638         a_conv.inner = untag_ptr(a);
40639         a_conv.is_owned = ptr_is_owned(a);
40640         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40641         a_conv.is_owned = false;
40642         LDKClosingSignedFeeRange b_conv;
40643         b_conv.inner = untag_ptr(b);
40644         b_conv.is_owned = ptr_is_owned(b);
40645         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40646         b_conv.is_owned = false;
40647         jboolean ret_conv = ClosingSignedFeeRange_eq(&a_conv, &b_conv);
40648         return ret_conv;
40649 }
40650
40651 void  __attribute__((export_name("TS_ClosingSigned_free"))) TS_ClosingSigned_free(uint64_t this_obj) {
40652         LDKClosingSigned this_obj_conv;
40653         this_obj_conv.inner = untag_ptr(this_obj);
40654         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40656         ClosingSigned_free(this_obj_conv);
40657 }
40658
40659 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_channel_id"))) TS_ClosingSigned_get_channel_id(uint64_t this_ptr) {
40660         LDKClosingSigned this_ptr_conv;
40661         this_ptr_conv.inner = untag_ptr(this_ptr);
40662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40664         this_ptr_conv.is_owned = false;
40665         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40666         memcpy(ret_arr->elems, *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
40667         return ret_arr;
40668 }
40669
40670 void  __attribute__((export_name("TS_ClosingSigned_set_channel_id"))) TS_ClosingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
40671         LDKClosingSigned this_ptr_conv;
40672         this_ptr_conv.inner = untag_ptr(this_ptr);
40673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40675         this_ptr_conv.is_owned = false;
40676         LDKThirtyTwoBytes val_ref;
40677         CHECK(val->arr_len == 32);
40678         memcpy(val_ref.data, val->elems, 32); FREE(val);
40679         ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
40680 }
40681
40682 int64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_satoshis"))) TS_ClosingSigned_get_fee_satoshis(uint64_t this_ptr) {
40683         LDKClosingSigned this_ptr_conv;
40684         this_ptr_conv.inner = untag_ptr(this_ptr);
40685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40687         this_ptr_conv.is_owned = false;
40688         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
40689         return ret_conv;
40690 }
40691
40692 void  __attribute__((export_name("TS_ClosingSigned_set_fee_satoshis"))) TS_ClosingSigned_set_fee_satoshis(uint64_t this_ptr, int64_t val) {
40693         LDKClosingSigned this_ptr_conv;
40694         this_ptr_conv.inner = untag_ptr(this_ptr);
40695         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40697         this_ptr_conv.is_owned = false;
40698         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
40699 }
40700
40701 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_signature"))) TS_ClosingSigned_get_signature(uint64_t this_ptr) {
40702         LDKClosingSigned this_ptr_conv;
40703         this_ptr_conv.inner = untag_ptr(this_ptr);
40704         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40706         this_ptr_conv.is_owned = false;
40707         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
40708         memcpy(ret_arr->elems, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
40709         return ret_arr;
40710 }
40711
40712 void  __attribute__((export_name("TS_ClosingSigned_set_signature"))) TS_ClosingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
40713         LDKClosingSigned this_ptr_conv;
40714         this_ptr_conv.inner = untag_ptr(this_ptr);
40715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40717         this_ptr_conv.is_owned = false;
40718         LDKECDSASignature val_ref;
40719         CHECK(val->arr_len == 64);
40720         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
40721         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
40722 }
40723
40724 uint64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_range"))) TS_ClosingSigned_get_fee_range(uint64_t this_ptr) {
40725         LDKClosingSigned this_ptr_conv;
40726         this_ptr_conv.inner = untag_ptr(this_ptr);
40727         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40729         this_ptr_conv.is_owned = false;
40730         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
40731         uint64_t ret_ref = 0;
40732         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40733         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40734         return ret_ref;
40735 }
40736
40737 void  __attribute__((export_name("TS_ClosingSigned_set_fee_range"))) TS_ClosingSigned_set_fee_range(uint64_t this_ptr, uint64_t val) {
40738         LDKClosingSigned this_ptr_conv;
40739         this_ptr_conv.inner = untag_ptr(this_ptr);
40740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40742         this_ptr_conv.is_owned = false;
40743         LDKClosingSignedFeeRange val_conv;
40744         val_conv.inner = untag_ptr(val);
40745         val_conv.is_owned = ptr_is_owned(val);
40746         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40747         val_conv = ClosingSignedFeeRange_clone(&val_conv);
40748         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
40749 }
40750
40751 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) {
40752         LDKThirtyTwoBytes channel_id_arg_ref;
40753         CHECK(channel_id_arg->arr_len == 32);
40754         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
40755         LDKECDSASignature signature_arg_ref;
40756         CHECK(signature_arg->arr_len == 64);
40757         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
40758         LDKClosingSignedFeeRange fee_range_arg_conv;
40759         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
40760         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
40761         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
40762         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
40763         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
40764         uint64_t ret_ref = 0;
40765         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40766         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40767         return ret_ref;
40768 }
40769
40770 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
40771         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
40772         uint64_t ret_ref = 0;
40773         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40774         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40775         return ret_ref;
40776 }
40777 int64_t  __attribute__((export_name("TS_ClosingSigned_clone_ptr"))) TS_ClosingSigned_clone_ptr(uint64_t arg) {
40778         LDKClosingSigned arg_conv;
40779         arg_conv.inner = untag_ptr(arg);
40780         arg_conv.is_owned = ptr_is_owned(arg);
40781         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40782         arg_conv.is_owned = false;
40783         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
40784         return ret_conv;
40785 }
40786
40787 uint64_t  __attribute__((export_name("TS_ClosingSigned_clone"))) TS_ClosingSigned_clone(uint64_t orig) {
40788         LDKClosingSigned orig_conv;
40789         orig_conv.inner = untag_ptr(orig);
40790         orig_conv.is_owned = ptr_is_owned(orig);
40791         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40792         orig_conv.is_owned = false;
40793         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
40794         uint64_t ret_ref = 0;
40795         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40796         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40797         return ret_ref;
40798 }
40799
40800 jboolean  __attribute__((export_name("TS_ClosingSigned_eq"))) TS_ClosingSigned_eq(uint64_t a, uint64_t b) {
40801         LDKClosingSigned a_conv;
40802         a_conv.inner = untag_ptr(a);
40803         a_conv.is_owned = ptr_is_owned(a);
40804         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40805         a_conv.is_owned = false;
40806         LDKClosingSigned b_conv;
40807         b_conv.inner = untag_ptr(b);
40808         b_conv.is_owned = ptr_is_owned(b);
40809         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40810         b_conv.is_owned = false;
40811         jboolean ret_conv = ClosingSigned_eq(&a_conv, &b_conv);
40812         return ret_conv;
40813 }
40814
40815 void  __attribute__((export_name("TS_UpdateAddHTLC_free"))) TS_UpdateAddHTLC_free(uint64_t this_obj) {
40816         LDKUpdateAddHTLC this_obj_conv;
40817         this_obj_conv.inner = untag_ptr(this_obj);
40818         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40820         UpdateAddHTLC_free(this_obj_conv);
40821 }
40822
40823 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_channel_id"))) TS_UpdateAddHTLC_get_channel_id(uint64_t this_ptr) {
40824         LDKUpdateAddHTLC this_ptr_conv;
40825         this_ptr_conv.inner = untag_ptr(this_ptr);
40826         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40828         this_ptr_conv.is_owned = false;
40829         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40830         memcpy(ret_arr->elems, *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
40831         return ret_arr;
40832 }
40833
40834 void  __attribute__((export_name("TS_UpdateAddHTLC_set_channel_id"))) TS_UpdateAddHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
40835         LDKUpdateAddHTLC this_ptr_conv;
40836         this_ptr_conv.inner = untag_ptr(this_ptr);
40837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40839         this_ptr_conv.is_owned = false;
40840         LDKThirtyTwoBytes val_ref;
40841         CHECK(val->arr_len == 32);
40842         memcpy(val_ref.data, val->elems, 32); FREE(val);
40843         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
40844 }
40845
40846 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_htlc_id"))) TS_UpdateAddHTLC_get_htlc_id(uint64_t this_ptr) {
40847         LDKUpdateAddHTLC this_ptr_conv;
40848         this_ptr_conv.inner = untag_ptr(this_ptr);
40849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40851         this_ptr_conv.is_owned = false;
40852         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
40853         return ret_conv;
40854 }
40855
40856 void  __attribute__((export_name("TS_UpdateAddHTLC_set_htlc_id"))) TS_UpdateAddHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
40857         LDKUpdateAddHTLC this_ptr_conv;
40858         this_ptr_conv.inner = untag_ptr(this_ptr);
40859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40861         this_ptr_conv.is_owned = false;
40862         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
40863 }
40864
40865 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_amount_msat"))) TS_UpdateAddHTLC_get_amount_msat(uint64_t this_ptr) {
40866         LDKUpdateAddHTLC this_ptr_conv;
40867         this_ptr_conv.inner = untag_ptr(this_ptr);
40868         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40870         this_ptr_conv.is_owned = false;
40871         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
40872         return ret_conv;
40873 }
40874
40875 void  __attribute__((export_name("TS_UpdateAddHTLC_set_amount_msat"))) TS_UpdateAddHTLC_set_amount_msat(uint64_t this_ptr, int64_t val) {
40876         LDKUpdateAddHTLC this_ptr_conv;
40877         this_ptr_conv.inner = untag_ptr(this_ptr);
40878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40880         this_ptr_conv.is_owned = false;
40881         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
40882 }
40883
40884 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_payment_hash"))) TS_UpdateAddHTLC_get_payment_hash(uint64_t this_ptr) {
40885         LDKUpdateAddHTLC this_ptr_conv;
40886         this_ptr_conv.inner = untag_ptr(this_ptr);
40887         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40889         this_ptr_conv.is_owned = false;
40890         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40891         memcpy(ret_arr->elems, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
40892         return ret_arr;
40893 }
40894
40895 void  __attribute__((export_name("TS_UpdateAddHTLC_set_payment_hash"))) TS_UpdateAddHTLC_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
40896         LDKUpdateAddHTLC this_ptr_conv;
40897         this_ptr_conv.inner = untag_ptr(this_ptr);
40898         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40900         this_ptr_conv.is_owned = false;
40901         LDKThirtyTwoBytes val_ref;
40902         CHECK(val->arr_len == 32);
40903         memcpy(val_ref.data, val->elems, 32); FREE(val);
40904         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
40905 }
40906
40907 int32_t  __attribute__((export_name("TS_UpdateAddHTLC_get_cltv_expiry"))) TS_UpdateAddHTLC_get_cltv_expiry(uint64_t this_ptr) {
40908         LDKUpdateAddHTLC this_ptr_conv;
40909         this_ptr_conv.inner = untag_ptr(this_ptr);
40910         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40912         this_ptr_conv.is_owned = false;
40913         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
40914         return ret_conv;
40915 }
40916
40917 void  __attribute__((export_name("TS_UpdateAddHTLC_set_cltv_expiry"))) TS_UpdateAddHTLC_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
40918         LDKUpdateAddHTLC this_ptr_conv;
40919         this_ptr_conv.inner = untag_ptr(this_ptr);
40920         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40922         this_ptr_conv.is_owned = false;
40923         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
40924 }
40925
40926 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_skimmed_fee_msat"))) TS_UpdateAddHTLC_get_skimmed_fee_msat(uint64_t this_ptr) {
40927         LDKUpdateAddHTLC this_ptr_conv;
40928         this_ptr_conv.inner = untag_ptr(this_ptr);
40929         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40931         this_ptr_conv.is_owned = false;
40932         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40933         *ret_copy = UpdateAddHTLC_get_skimmed_fee_msat(&this_ptr_conv);
40934         uint64_t ret_ref = tag_ptr(ret_copy, true);
40935         return ret_ref;
40936 }
40937
40938 void  __attribute__((export_name("TS_UpdateAddHTLC_set_skimmed_fee_msat"))) TS_UpdateAddHTLC_set_skimmed_fee_msat(uint64_t this_ptr, uint64_t val) {
40939         LDKUpdateAddHTLC this_ptr_conv;
40940         this_ptr_conv.inner = untag_ptr(this_ptr);
40941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40943         this_ptr_conv.is_owned = false;
40944         void* val_ptr = untag_ptr(val);
40945         CHECK_ACCESS(val_ptr);
40946         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
40947         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
40948         UpdateAddHTLC_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
40949 }
40950
40951 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
40952         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
40953         uint64_t ret_ref = 0;
40954         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40955         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40956         return ret_ref;
40957 }
40958 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone_ptr"))) TS_UpdateAddHTLC_clone_ptr(uint64_t arg) {
40959         LDKUpdateAddHTLC arg_conv;
40960         arg_conv.inner = untag_ptr(arg);
40961         arg_conv.is_owned = ptr_is_owned(arg);
40962         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40963         arg_conv.is_owned = false;
40964         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
40965         return ret_conv;
40966 }
40967
40968 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone"))) TS_UpdateAddHTLC_clone(uint64_t orig) {
40969         LDKUpdateAddHTLC orig_conv;
40970         orig_conv.inner = untag_ptr(orig);
40971         orig_conv.is_owned = ptr_is_owned(orig);
40972         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40973         orig_conv.is_owned = false;
40974         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
40975         uint64_t ret_ref = 0;
40976         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40977         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40978         return ret_ref;
40979 }
40980
40981 jboolean  __attribute__((export_name("TS_UpdateAddHTLC_eq"))) TS_UpdateAddHTLC_eq(uint64_t a, uint64_t b) {
40982         LDKUpdateAddHTLC a_conv;
40983         a_conv.inner = untag_ptr(a);
40984         a_conv.is_owned = ptr_is_owned(a);
40985         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40986         a_conv.is_owned = false;
40987         LDKUpdateAddHTLC b_conv;
40988         b_conv.inner = untag_ptr(b);
40989         b_conv.is_owned = ptr_is_owned(b);
40990         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40991         b_conv.is_owned = false;
40992         jboolean ret_conv = UpdateAddHTLC_eq(&a_conv, &b_conv);
40993         return ret_conv;
40994 }
40995
40996 void  __attribute__((export_name("TS_OnionMessage_free"))) TS_OnionMessage_free(uint64_t this_obj) {
40997         LDKOnionMessage this_obj_conv;
40998         this_obj_conv.inner = untag_ptr(this_obj);
40999         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41001         OnionMessage_free(this_obj_conv);
41002 }
41003
41004 int8_tArray  __attribute__((export_name("TS_OnionMessage_get_blinding_point"))) TS_OnionMessage_get_blinding_point(uint64_t this_ptr) {
41005         LDKOnionMessage this_ptr_conv;
41006         this_ptr_conv.inner = untag_ptr(this_ptr);
41007         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41009         this_ptr_conv.is_owned = false;
41010         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41011         memcpy(ret_arr->elems, OnionMessage_get_blinding_point(&this_ptr_conv).compressed_form, 33);
41012         return ret_arr;
41013 }
41014
41015 void  __attribute__((export_name("TS_OnionMessage_set_blinding_point"))) TS_OnionMessage_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
41016         LDKOnionMessage this_ptr_conv;
41017         this_ptr_conv.inner = untag_ptr(this_ptr);
41018         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41020         this_ptr_conv.is_owned = false;
41021         LDKPublicKey val_ref;
41022         CHECK(val->arr_len == 33);
41023         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41024         OnionMessage_set_blinding_point(&this_ptr_conv, val_ref);
41025 }
41026
41027 uint64_t  __attribute__((export_name("TS_OnionMessage_get_onion_routing_packet"))) TS_OnionMessage_get_onion_routing_packet(uint64_t this_ptr) {
41028         LDKOnionMessage this_ptr_conv;
41029         this_ptr_conv.inner = untag_ptr(this_ptr);
41030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41032         this_ptr_conv.is_owned = false;
41033         LDKPacket ret_var = OnionMessage_get_onion_routing_packet(&this_ptr_conv);
41034         uint64_t ret_ref = 0;
41035         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41036         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41037         return ret_ref;
41038 }
41039
41040 void  __attribute__((export_name("TS_OnionMessage_set_onion_routing_packet"))) TS_OnionMessage_set_onion_routing_packet(uint64_t this_ptr, uint64_t val) {
41041         LDKOnionMessage this_ptr_conv;
41042         this_ptr_conv.inner = untag_ptr(this_ptr);
41043         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41045         this_ptr_conv.is_owned = false;
41046         LDKPacket val_conv;
41047         val_conv.inner = untag_ptr(val);
41048         val_conv.is_owned = ptr_is_owned(val);
41049         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41050         val_conv = Packet_clone(&val_conv);
41051         OnionMessage_set_onion_routing_packet(&this_ptr_conv, val_conv);
41052 }
41053
41054 uint64_t  __attribute__((export_name("TS_OnionMessage_new"))) TS_OnionMessage_new(int8_tArray blinding_point_arg, uint64_t onion_routing_packet_arg) {
41055         LDKPublicKey blinding_point_arg_ref;
41056         CHECK(blinding_point_arg->arr_len == 33);
41057         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
41058         LDKPacket onion_routing_packet_arg_conv;
41059         onion_routing_packet_arg_conv.inner = untag_ptr(onion_routing_packet_arg);
41060         onion_routing_packet_arg_conv.is_owned = ptr_is_owned(onion_routing_packet_arg);
41061         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_routing_packet_arg_conv);
41062         onion_routing_packet_arg_conv = Packet_clone(&onion_routing_packet_arg_conv);
41063         LDKOnionMessage ret_var = OnionMessage_new(blinding_point_arg_ref, onion_routing_packet_arg_conv);
41064         uint64_t ret_ref = 0;
41065         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41066         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41067         return ret_ref;
41068 }
41069
41070 static inline uint64_t OnionMessage_clone_ptr(LDKOnionMessage *NONNULL_PTR arg) {
41071         LDKOnionMessage ret_var = OnionMessage_clone(arg);
41072         uint64_t ret_ref = 0;
41073         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41074         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41075         return ret_ref;
41076 }
41077 int64_t  __attribute__((export_name("TS_OnionMessage_clone_ptr"))) TS_OnionMessage_clone_ptr(uint64_t arg) {
41078         LDKOnionMessage arg_conv;
41079         arg_conv.inner = untag_ptr(arg);
41080         arg_conv.is_owned = ptr_is_owned(arg);
41081         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41082         arg_conv.is_owned = false;
41083         int64_t ret_conv = OnionMessage_clone_ptr(&arg_conv);
41084         return ret_conv;
41085 }
41086
41087 uint64_t  __attribute__((export_name("TS_OnionMessage_clone"))) TS_OnionMessage_clone(uint64_t orig) {
41088         LDKOnionMessage orig_conv;
41089         orig_conv.inner = untag_ptr(orig);
41090         orig_conv.is_owned = ptr_is_owned(orig);
41091         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41092         orig_conv.is_owned = false;
41093         LDKOnionMessage ret_var = OnionMessage_clone(&orig_conv);
41094         uint64_t ret_ref = 0;
41095         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41096         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41097         return ret_ref;
41098 }
41099
41100 jboolean  __attribute__((export_name("TS_OnionMessage_eq"))) TS_OnionMessage_eq(uint64_t a, uint64_t b) {
41101         LDKOnionMessage a_conv;
41102         a_conv.inner = untag_ptr(a);
41103         a_conv.is_owned = ptr_is_owned(a);
41104         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41105         a_conv.is_owned = false;
41106         LDKOnionMessage b_conv;
41107         b_conv.inner = untag_ptr(b);
41108         b_conv.is_owned = ptr_is_owned(b);
41109         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41110         b_conv.is_owned = false;
41111         jboolean ret_conv = OnionMessage_eq(&a_conv, &b_conv);
41112         return ret_conv;
41113 }
41114
41115 void  __attribute__((export_name("TS_UpdateFulfillHTLC_free"))) TS_UpdateFulfillHTLC_free(uint64_t this_obj) {
41116         LDKUpdateFulfillHTLC this_obj_conv;
41117         this_obj_conv.inner = untag_ptr(this_obj);
41118         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41120         UpdateFulfillHTLC_free(this_obj_conv);
41121 }
41122
41123 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_channel_id"))) TS_UpdateFulfillHTLC_get_channel_id(uint64_t this_ptr) {
41124         LDKUpdateFulfillHTLC this_ptr_conv;
41125         this_ptr_conv.inner = untag_ptr(this_ptr);
41126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41128         this_ptr_conv.is_owned = false;
41129         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41130         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
41131         return ret_arr;
41132 }
41133
41134 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_channel_id"))) TS_UpdateFulfillHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
41135         LDKUpdateFulfillHTLC this_ptr_conv;
41136         this_ptr_conv.inner = untag_ptr(this_ptr);
41137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41139         this_ptr_conv.is_owned = false;
41140         LDKThirtyTwoBytes val_ref;
41141         CHECK(val->arr_len == 32);
41142         memcpy(val_ref.data, val->elems, 32); FREE(val);
41143         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
41144 }
41145
41146 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_get_htlc_id"))) TS_UpdateFulfillHTLC_get_htlc_id(uint64_t this_ptr) {
41147         LDKUpdateFulfillHTLC this_ptr_conv;
41148         this_ptr_conv.inner = untag_ptr(this_ptr);
41149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41151         this_ptr_conv.is_owned = false;
41152         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
41153         return ret_conv;
41154 }
41155
41156 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_htlc_id"))) TS_UpdateFulfillHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
41157         LDKUpdateFulfillHTLC this_ptr_conv;
41158         this_ptr_conv.inner = untag_ptr(this_ptr);
41159         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41161         this_ptr_conv.is_owned = false;
41162         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
41163 }
41164
41165 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_payment_preimage"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint64_t this_ptr) {
41166         LDKUpdateFulfillHTLC this_ptr_conv;
41167         this_ptr_conv.inner = untag_ptr(this_ptr);
41168         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41170         this_ptr_conv.is_owned = false;
41171         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41172         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
41173         return ret_arr;
41174 }
41175
41176 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_payment_preimage"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint64_t this_ptr, int8_tArray val) {
41177         LDKUpdateFulfillHTLC this_ptr_conv;
41178         this_ptr_conv.inner = untag_ptr(this_ptr);
41179         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41181         this_ptr_conv.is_owned = false;
41182         LDKThirtyTwoBytes val_ref;
41183         CHECK(val->arr_len == 32);
41184         memcpy(val_ref.data, val->elems, 32); FREE(val);
41185         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
41186 }
41187
41188 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) {
41189         LDKThirtyTwoBytes channel_id_arg_ref;
41190         CHECK(channel_id_arg->arr_len == 32);
41191         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
41192         LDKThirtyTwoBytes payment_preimage_arg_ref;
41193         CHECK(payment_preimage_arg->arr_len == 32);
41194         memcpy(payment_preimage_arg_ref.data, payment_preimage_arg->elems, 32); FREE(payment_preimage_arg);
41195         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
41196         uint64_t ret_ref = 0;
41197         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41198         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41199         return ret_ref;
41200 }
41201
41202 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
41203         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
41204         uint64_t ret_ref = 0;
41205         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41206         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41207         return ret_ref;
41208 }
41209 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone_ptr"))) TS_UpdateFulfillHTLC_clone_ptr(uint64_t arg) {
41210         LDKUpdateFulfillHTLC arg_conv;
41211         arg_conv.inner = untag_ptr(arg);
41212         arg_conv.is_owned = ptr_is_owned(arg);
41213         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41214         arg_conv.is_owned = false;
41215         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
41216         return ret_conv;
41217 }
41218
41219 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone"))) TS_UpdateFulfillHTLC_clone(uint64_t orig) {
41220         LDKUpdateFulfillHTLC orig_conv;
41221         orig_conv.inner = untag_ptr(orig);
41222         orig_conv.is_owned = ptr_is_owned(orig);
41223         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41224         orig_conv.is_owned = false;
41225         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
41226         uint64_t ret_ref = 0;
41227         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41228         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41229         return ret_ref;
41230 }
41231
41232 jboolean  __attribute__((export_name("TS_UpdateFulfillHTLC_eq"))) TS_UpdateFulfillHTLC_eq(uint64_t a, uint64_t b) {
41233         LDKUpdateFulfillHTLC a_conv;
41234         a_conv.inner = untag_ptr(a);
41235         a_conv.is_owned = ptr_is_owned(a);
41236         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41237         a_conv.is_owned = false;
41238         LDKUpdateFulfillHTLC b_conv;
41239         b_conv.inner = untag_ptr(b);
41240         b_conv.is_owned = ptr_is_owned(b);
41241         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41242         b_conv.is_owned = false;
41243         jboolean ret_conv = UpdateFulfillHTLC_eq(&a_conv, &b_conv);
41244         return ret_conv;
41245 }
41246
41247 void  __attribute__((export_name("TS_UpdateFailHTLC_free"))) TS_UpdateFailHTLC_free(uint64_t this_obj) {
41248         LDKUpdateFailHTLC this_obj_conv;
41249         this_obj_conv.inner = untag_ptr(this_obj);
41250         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41252         UpdateFailHTLC_free(this_obj_conv);
41253 }
41254
41255 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_get_channel_id"))) TS_UpdateFailHTLC_get_channel_id(uint64_t this_ptr) {
41256         LDKUpdateFailHTLC this_ptr_conv;
41257         this_ptr_conv.inner = untag_ptr(this_ptr);
41258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41260         this_ptr_conv.is_owned = false;
41261         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41262         memcpy(ret_arr->elems, *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
41263         return ret_arr;
41264 }
41265
41266 void  __attribute__((export_name("TS_UpdateFailHTLC_set_channel_id"))) TS_UpdateFailHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
41267         LDKUpdateFailHTLC this_ptr_conv;
41268         this_ptr_conv.inner = untag_ptr(this_ptr);
41269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41271         this_ptr_conv.is_owned = false;
41272         LDKThirtyTwoBytes val_ref;
41273         CHECK(val->arr_len == 32);
41274         memcpy(val_ref.data, val->elems, 32); FREE(val);
41275         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
41276 }
41277
41278 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_get_htlc_id"))) TS_UpdateFailHTLC_get_htlc_id(uint64_t this_ptr) {
41279         LDKUpdateFailHTLC this_ptr_conv;
41280         this_ptr_conv.inner = untag_ptr(this_ptr);
41281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41283         this_ptr_conv.is_owned = false;
41284         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
41285         return ret_conv;
41286 }
41287
41288 void  __attribute__((export_name("TS_UpdateFailHTLC_set_htlc_id"))) TS_UpdateFailHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
41289         LDKUpdateFailHTLC this_ptr_conv;
41290         this_ptr_conv.inner = untag_ptr(this_ptr);
41291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41293         this_ptr_conv.is_owned = false;
41294         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
41295 }
41296
41297 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
41298         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
41299         uint64_t ret_ref = 0;
41300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41302         return ret_ref;
41303 }
41304 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone_ptr"))) TS_UpdateFailHTLC_clone_ptr(uint64_t arg) {
41305         LDKUpdateFailHTLC arg_conv;
41306         arg_conv.inner = untag_ptr(arg);
41307         arg_conv.is_owned = ptr_is_owned(arg);
41308         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41309         arg_conv.is_owned = false;
41310         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
41311         return ret_conv;
41312 }
41313
41314 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone"))) TS_UpdateFailHTLC_clone(uint64_t orig) {
41315         LDKUpdateFailHTLC orig_conv;
41316         orig_conv.inner = untag_ptr(orig);
41317         orig_conv.is_owned = ptr_is_owned(orig);
41318         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41319         orig_conv.is_owned = false;
41320         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
41321         uint64_t ret_ref = 0;
41322         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41323         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41324         return ret_ref;
41325 }
41326
41327 jboolean  __attribute__((export_name("TS_UpdateFailHTLC_eq"))) TS_UpdateFailHTLC_eq(uint64_t a, uint64_t b) {
41328         LDKUpdateFailHTLC a_conv;
41329         a_conv.inner = untag_ptr(a);
41330         a_conv.is_owned = ptr_is_owned(a);
41331         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41332         a_conv.is_owned = false;
41333         LDKUpdateFailHTLC b_conv;
41334         b_conv.inner = untag_ptr(b);
41335         b_conv.is_owned = ptr_is_owned(b);
41336         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41337         b_conv.is_owned = false;
41338         jboolean ret_conv = UpdateFailHTLC_eq(&a_conv, &b_conv);
41339         return ret_conv;
41340 }
41341
41342 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_free"))) TS_UpdateFailMalformedHTLC_free(uint64_t this_obj) {
41343         LDKUpdateFailMalformedHTLC this_obj_conv;
41344         this_obj_conv.inner = untag_ptr(this_obj);
41345         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41347         UpdateFailMalformedHTLC_free(this_obj_conv);
41348 }
41349
41350 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_channel_id"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint64_t this_ptr) {
41351         LDKUpdateFailMalformedHTLC this_ptr_conv;
41352         this_ptr_conv.inner = untag_ptr(this_ptr);
41353         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41355         this_ptr_conv.is_owned = false;
41356         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41357         memcpy(ret_arr->elems, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
41358         return ret_arr;
41359 }
41360
41361 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_channel_id"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
41362         LDKUpdateFailMalformedHTLC this_ptr_conv;
41363         this_ptr_conv.inner = untag_ptr(this_ptr);
41364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41366         this_ptr_conv.is_owned = false;
41367         LDKThirtyTwoBytes val_ref;
41368         CHECK(val->arr_len == 32);
41369         memcpy(val_ref.data, val->elems, 32); FREE(val);
41370         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
41371 }
41372
41373 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_htlc_id"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint64_t this_ptr) {
41374         LDKUpdateFailMalformedHTLC this_ptr_conv;
41375         this_ptr_conv.inner = untag_ptr(this_ptr);
41376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41378         this_ptr_conv.is_owned = false;
41379         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
41380         return ret_conv;
41381 }
41382
41383 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_htlc_id"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
41384         LDKUpdateFailMalformedHTLC this_ptr_conv;
41385         this_ptr_conv.inner = untag_ptr(this_ptr);
41386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41388         this_ptr_conv.is_owned = false;
41389         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
41390 }
41391
41392 int16_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_failure_code"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint64_t this_ptr) {
41393         LDKUpdateFailMalformedHTLC this_ptr_conv;
41394         this_ptr_conv.inner = untag_ptr(this_ptr);
41395         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41397         this_ptr_conv.is_owned = false;
41398         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
41399         return ret_conv;
41400 }
41401
41402 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_failure_code"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint64_t this_ptr, int16_t val) {
41403         LDKUpdateFailMalformedHTLC this_ptr_conv;
41404         this_ptr_conv.inner = untag_ptr(this_ptr);
41405         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41407         this_ptr_conv.is_owned = false;
41408         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
41409 }
41410
41411 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
41412         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
41413         uint64_t ret_ref = 0;
41414         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41415         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41416         return ret_ref;
41417 }
41418 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone_ptr"))) TS_UpdateFailMalformedHTLC_clone_ptr(uint64_t arg) {
41419         LDKUpdateFailMalformedHTLC arg_conv;
41420         arg_conv.inner = untag_ptr(arg);
41421         arg_conv.is_owned = ptr_is_owned(arg);
41422         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41423         arg_conv.is_owned = false;
41424         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
41425         return ret_conv;
41426 }
41427
41428 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone"))) TS_UpdateFailMalformedHTLC_clone(uint64_t orig) {
41429         LDKUpdateFailMalformedHTLC orig_conv;
41430         orig_conv.inner = untag_ptr(orig);
41431         orig_conv.is_owned = ptr_is_owned(orig);
41432         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41433         orig_conv.is_owned = false;
41434         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
41435         uint64_t ret_ref = 0;
41436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41438         return ret_ref;
41439 }
41440
41441 jboolean  __attribute__((export_name("TS_UpdateFailMalformedHTLC_eq"))) TS_UpdateFailMalformedHTLC_eq(uint64_t a, uint64_t b) {
41442         LDKUpdateFailMalformedHTLC a_conv;
41443         a_conv.inner = untag_ptr(a);
41444         a_conv.is_owned = ptr_is_owned(a);
41445         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41446         a_conv.is_owned = false;
41447         LDKUpdateFailMalformedHTLC b_conv;
41448         b_conv.inner = untag_ptr(b);
41449         b_conv.is_owned = ptr_is_owned(b);
41450         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41451         b_conv.is_owned = false;
41452         jboolean ret_conv = UpdateFailMalformedHTLC_eq(&a_conv, &b_conv);
41453         return ret_conv;
41454 }
41455
41456 void  __attribute__((export_name("TS_CommitmentSigned_free"))) TS_CommitmentSigned_free(uint64_t this_obj) {
41457         LDKCommitmentSigned this_obj_conv;
41458         this_obj_conv.inner = untag_ptr(this_obj);
41459         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41461         CommitmentSigned_free(this_obj_conv);
41462 }
41463
41464 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_channel_id"))) TS_CommitmentSigned_get_channel_id(uint64_t this_ptr) {
41465         LDKCommitmentSigned this_ptr_conv;
41466         this_ptr_conv.inner = untag_ptr(this_ptr);
41467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41469         this_ptr_conv.is_owned = false;
41470         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41471         memcpy(ret_arr->elems, *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
41472         return ret_arr;
41473 }
41474
41475 void  __attribute__((export_name("TS_CommitmentSigned_set_channel_id"))) TS_CommitmentSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
41476         LDKCommitmentSigned this_ptr_conv;
41477         this_ptr_conv.inner = untag_ptr(this_ptr);
41478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41480         this_ptr_conv.is_owned = false;
41481         LDKThirtyTwoBytes val_ref;
41482         CHECK(val->arr_len == 32);
41483         memcpy(val_ref.data, val->elems, 32); FREE(val);
41484         CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
41485 }
41486
41487 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_signature"))) TS_CommitmentSigned_get_signature(uint64_t this_ptr) {
41488         LDKCommitmentSigned this_ptr_conv;
41489         this_ptr_conv.inner = untag_ptr(this_ptr);
41490         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41492         this_ptr_conv.is_owned = false;
41493         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
41494         memcpy(ret_arr->elems, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
41495         return ret_arr;
41496 }
41497
41498 void  __attribute__((export_name("TS_CommitmentSigned_set_signature"))) TS_CommitmentSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
41499         LDKCommitmentSigned this_ptr_conv;
41500         this_ptr_conv.inner = untag_ptr(this_ptr);
41501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41503         this_ptr_conv.is_owned = false;
41504         LDKECDSASignature val_ref;
41505         CHECK(val->arr_len == 64);
41506         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
41507         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
41508 }
41509
41510 ptrArray  __attribute__((export_name("TS_CommitmentSigned_get_htlc_signatures"))) TS_CommitmentSigned_get_htlc_signatures(uint64_t this_ptr) {
41511         LDKCommitmentSigned this_ptr_conv;
41512         this_ptr_conv.inner = untag_ptr(this_ptr);
41513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41515         this_ptr_conv.is_owned = false;
41516         LDKCVec_ECDSASignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
41517         ptrArray ret_arr = NULL;
41518         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
41519         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
41520         for (size_t m = 0; m < ret_var.datalen; m++) {
41521                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
41522                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
41523                 ret_arr_ptr[m] = ret_conv_12_arr;
41524         }
41525         
41526         FREE(ret_var.data);
41527         return ret_arr;
41528 }
41529
41530 void  __attribute__((export_name("TS_CommitmentSigned_set_htlc_signatures"))) TS_CommitmentSigned_set_htlc_signatures(uint64_t this_ptr, ptrArray val) {
41531         LDKCommitmentSigned this_ptr_conv;
41532         this_ptr_conv.inner = untag_ptr(this_ptr);
41533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41535         this_ptr_conv.is_owned = false;
41536         LDKCVec_ECDSASignatureZ val_constr;
41537         val_constr.datalen = val->arr_len;
41538         if (val_constr.datalen > 0)
41539                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
41540         else
41541                 val_constr.data = NULL;
41542         int8_tArray* val_vals = (void*) val->elems;
41543         for (size_t m = 0; m < val_constr.datalen; m++) {
41544                 int8_tArray val_conv_12 = val_vals[m];
41545                 LDKECDSASignature val_conv_12_ref;
41546                 CHECK(val_conv_12->arr_len == 64);
41547                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
41548                 val_constr.data[m] = val_conv_12_ref;
41549         }
41550         FREE(val);
41551         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
41552 }
41553
41554 uint64_t  __attribute__((export_name("TS_CommitmentSigned_new"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
41555         LDKThirtyTwoBytes channel_id_arg_ref;
41556         CHECK(channel_id_arg->arr_len == 32);
41557         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
41558         LDKECDSASignature signature_arg_ref;
41559         CHECK(signature_arg->arr_len == 64);
41560         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
41561         LDKCVec_ECDSASignatureZ htlc_signatures_arg_constr;
41562         htlc_signatures_arg_constr.datalen = htlc_signatures_arg->arr_len;
41563         if (htlc_signatures_arg_constr.datalen > 0)
41564                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
41565         else
41566                 htlc_signatures_arg_constr.data = NULL;
41567         int8_tArray* htlc_signatures_arg_vals = (void*) htlc_signatures_arg->elems;
41568         for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
41569                 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
41570                 LDKECDSASignature htlc_signatures_arg_conv_12_ref;
41571                 CHECK(htlc_signatures_arg_conv_12->arr_len == 64);
41572                 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, htlc_signatures_arg_conv_12->elems, 64); FREE(htlc_signatures_arg_conv_12);
41573                 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
41574         }
41575         FREE(htlc_signatures_arg);
41576         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
41577         uint64_t ret_ref = 0;
41578         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41579         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41580         return ret_ref;
41581 }
41582
41583 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
41584         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
41585         uint64_t ret_ref = 0;
41586         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41587         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41588         return ret_ref;
41589 }
41590 int64_t  __attribute__((export_name("TS_CommitmentSigned_clone_ptr"))) TS_CommitmentSigned_clone_ptr(uint64_t arg) {
41591         LDKCommitmentSigned arg_conv;
41592         arg_conv.inner = untag_ptr(arg);
41593         arg_conv.is_owned = ptr_is_owned(arg);
41594         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41595         arg_conv.is_owned = false;
41596         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
41597         return ret_conv;
41598 }
41599
41600 uint64_t  __attribute__((export_name("TS_CommitmentSigned_clone"))) TS_CommitmentSigned_clone(uint64_t orig) {
41601         LDKCommitmentSigned orig_conv;
41602         orig_conv.inner = untag_ptr(orig);
41603         orig_conv.is_owned = ptr_is_owned(orig);
41604         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41605         orig_conv.is_owned = false;
41606         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
41607         uint64_t ret_ref = 0;
41608         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41609         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41610         return ret_ref;
41611 }
41612
41613 jboolean  __attribute__((export_name("TS_CommitmentSigned_eq"))) TS_CommitmentSigned_eq(uint64_t a, uint64_t b) {
41614         LDKCommitmentSigned a_conv;
41615         a_conv.inner = untag_ptr(a);
41616         a_conv.is_owned = ptr_is_owned(a);
41617         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41618         a_conv.is_owned = false;
41619         LDKCommitmentSigned b_conv;
41620         b_conv.inner = untag_ptr(b);
41621         b_conv.is_owned = ptr_is_owned(b);
41622         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41623         b_conv.is_owned = false;
41624         jboolean ret_conv = CommitmentSigned_eq(&a_conv, &b_conv);
41625         return ret_conv;
41626 }
41627
41628 void  __attribute__((export_name("TS_RevokeAndACK_free"))) TS_RevokeAndACK_free(uint64_t this_obj) {
41629         LDKRevokeAndACK this_obj_conv;
41630         this_obj_conv.inner = untag_ptr(this_obj);
41631         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41633         RevokeAndACK_free(this_obj_conv);
41634 }
41635
41636 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_channel_id"))) TS_RevokeAndACK_get_channel_id(uint64_t this_ptr) {
41637         LDKRevokeAndACK this_ptr_conv;
41638         this_ptr_conv.inner = untag_ptr(this_ptr);
41639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41641         this_ptr_conv.is_owned = false;
41642         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41643         memcpy(ret_arr->elems, *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
41644         return ret_arr;
41645 }
41646
41647 void  __attribute__((export_name("TS_RevokeAndACK_set_channel_id"))) TS_RevokeAndACK_set_channel_id(uint64_t this_ptr, int8_tArray val) {
41648         LDKRevokeAndACK this_ptr_conv;
41649         this_ptr_conv.inner = untag_ptr(this_ptr);
41650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41652         this_ptr_conv.is_owned = false;
41653         LDKThirtyTwoBytes val_ref;
41654         CHECK(val->arr_len == 32);
41655         memcpy(val_ref.data, val->elems, 32); FREE(val);
41656         RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
41657 }
41658
41659 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_per_commitment_secret"))) TS_RevokeAndACK_get_per_commitment_secret(uint64_t this_ptr) {
41660         LDKRevokeAndACK this_ptr_conv;
41661         this_ptr_conv.inner = untag_ptr(this_ptr);
41662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41664         this_ptr_conv.is_owned = false;
41665         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41666         memcpy(ret_arr->elems, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
41667         return ret_arr;
41668 }
41669
41670 void  __attribute__((export_name("TS_RevokeAndACK_set_per_commitment_secret"))) TS_RevokeAndACK_set_per_commitment_secret(uint64_t this_ptr, int8_tArray val) {
41671         LDKRevokeAndACK this_ptr_conv;
41672         this_ptr_conv.inner = untag_ptr(this_ptr);
41673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41675         this_ptr_conv.is_owned = false;
41676         LDKThirtyTwoBytes val_ref;
41677         CHECK(val->arr_len == 32);
41678         memcpy(val_ref.data, val->elems, 32); FREE(val);
41679         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
41680 }
41681
41682 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_next_per_commitment_point"))) TS_RevokeAndACK_get_next_per_commitment_point(uint64_t this_ptr) {
41683         LDKRevokeAndACK this_ptr_conv;
41684         this_ptr_conv.inner = untag_ptr(this_ptr);
41685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41687         this_ptr_conv.is_owned = false;
41688         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41689         memcpy(ret_arr->elems, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
41690         return ret_arr;
41691 }
41692
41693 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) {
41694         LDKRevokeAndACK this_ptr_conv;
41695         this_ptr_conv.inner = untag_ptr(this_ptr);
41696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41698         this_ptr_conv.is_owned = false;
41699         LDKPublicKey val_ref;
41700         CHECK(val->arr_len == 33);
41701         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41702         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
41703 }
41704
41705 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) {
41706         LDKThirtyTwoBytes channel_id_arg_ref;
41707         CHECK(channel_id_arg->arr_len == 32);
41708         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
41709         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
41710         CHECK(per_commitment_secret_arg->arr_len == 32);
41711         memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg->elems, 32); FREE(per_commitment_secret_arg);
41712         LDKPublicKey next_per_commitment_point_arg_ref;
41713         CHECK(next_per_commitment_point_arg->arr_len == 33);
41714         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
41715         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
41716         uint64_t ret_ref = 0;
41717         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41718         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41719         return ret_ref;
41720 }
41721
41722 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
41723         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
41724         uint64_t ret_ref = 0;
41725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41726         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41727         return ret_ref;
41728 }
41729 int64_t  __attribute__((export_name("TS_RevokeAndACK_clone_ptr"))) TS_RevokeAndACK_clone_ptr(uint64_t arg) {
41730         LDKRevokeAndACK arg_conv;
41731         arg_conv.inner = untag_ptr(arg);
41732         arg_conv.is_owned = ptr_is_owned(arg);
41733         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41734         arg_conv.is_owned = false;
41735         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
41736         return ret_conv;
41737 }
41738
41739 uint64_t  __attribute__((export_name("TS_RevokeAndACK_clone"))) TS_RevokeAndACK_clone(uint64_t orig) {
41740         LDKRevokeAndACK orig_conv;
41741         orig_conv.inner = untag_ptr(orig);
41742         orig_conv.is_owned = ptr_is_owned(orig);
41743         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41744         orig_conv.is_owned = false;
41745         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
41746         uint64_t ret_ref = 0;
41747         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41748         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41749         return ret_ref;
41750 }
41751
41752 jboolean  __attribute__((export_name("TS_RevokeAndACK_eq"))) TS_RevokeAndACK_eq(uint64_t a, uint64_t b) {
41753         LDKRevokeAndACK a_conv;
41754         a_conv.inner = untag_ptr(a);
41755         a_conv.is_owned = ptr_is_owned(a);
41756         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41757         a_conv.is_owned = false;
41758         LDKRevokeAndACK b_conv;
41759         b_conv.inner = untag_ptr(b);
41760         b_conv.is_owned = ptr_is_owned(b);
41761         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41762         b_conv.is_owned = false;
41763         jboolean ret_conv = RevokeAndACK_eq(&a_conv, &b_conv);
41764         return ret_conv;
41765 }
41766
41767 void  __attribute__((export_name("TS_UpdateFee_free"))) TS_UpdateFee_free(uint64_t this_obj) {
41768         LDKUpdateFee this_obj_conv;
41769         this_obj_conv.inner = untag_ptr(this_obj);
41770         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41772         UpdateFee_free(this_obj_conv);
41773 }
41774
41775 int8_tArray  __attribute__((export_name("TS_UpdateFee_get_channel_id"))) TS_UpdateFee_get_channel_id(uint64_t this_ptr) {
41776         LDKUpdateFee this_ptr_conv;
41777         this_ptr_conv.inner = untag_ptr(this_ptr);
41778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41780         this_ptr_conv.is_owned = false;
41781         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41782         memcpy(ret_arr->elems, *UpdateFee_get_channel_id(&this_ptr_conv), 32);
41783         return ret_arr;
41784 }
41785
41786 void  __attribute__((export_name("TS_UpdateFee_set_channel_id"))) TS_UpdateFee_set_channel_id(uint64_t this_ptr, int8_tArray val) {
41787         LDKUpdateFee this_ptr_conv;
41788         this_ptr_conv.inner = untag_ptr(this_ptr);
41789         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41791         this_ptr_conv.is_owned = false;
41792         LDKThirtyTwoBytes val_ref;
41793         CHECK(val->arr_len == 32);
41794         memcpy(val_ref.data, val->elems, 32); FREE(val);
41795         UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
41796 }
41797
41798 int32_t  __attribute__((export_name("TS_UpdateFee_get_feerate_per_kw"))) TS_UpdateFee_get_feerate_per_kw(uint64_t this_ptr) {
41799         LDKUpdateFee this_ptr_conv;
41800         this_ptr_conv.inner = untag_ptr(this_ptr);
41801         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41803         this_ptr_conv.is_owned = false;
41804         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
41805         return ret_conv;
41806 }
41807
41808 void  __attribute__((export_name("TS_UpdateFee_set_feerate_per_kw"))) TS_UpdateFee_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
41809         LDKUpdateFee this_ptr_conv;
41810         this_ptr_conv.inner = untag_ptr(this_ptr);
41811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41813         this_ptr_conv.is_owned = false;
41814         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
41815 }
41816
41817 uint64_t  __attribute__((export_name("TS_UpdateFee_new"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
41818         LDKThirtyTwoBytes channel_id_arg_ref;
41819         CHECK(channel_id_arg->arr_len == 32);
41820         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
41821         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
41822         uint64_t ret_ref = 0;
41823         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41824         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41825         return ret_ref;
41826 }
41827
41828 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
41829         LDKUpdateFee ret_var = UpdateFee_clone(arg);
41830         uint64_t ret_ref = 0;
41831         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41832         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41833         return ret_ref;
41834 }
41835 int64_t  __attribute__((export_name("TS_UpdateFee_clone_ptr"))) TS_UpdateFee_clone_ptr(uint64_t arg) {
41836         LDKUpdateFee arg_conv;
41837         arg_conv.inner = untag_ptr(arg);
41838         arg_conv.is_owned = ptr_is_owned(arg);
41839         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41840         arg_conv.is_owned = false;
41841         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
41842         return ret_conv;
41843 }
41844
41845 uint64_t  __attribute__((export_name("TS_UpdateFee_clone"))) TS_UpdateFee_clone(uint64_t orig) {
41846         LDKUpdateFee orig_conv;
41847         orig_conv.inner = untag_ptr(orig);
41848         orig_conv.is_owned = ptr_is_owned(orig);
41849         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41850         orig_conv.is_owned = false;
41851         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
41852         uint64_t ret_ref = 0;
41853         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41854         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41855         return ret_ref;
41856 }
41857
41858 jboolean  __attribute__((export_name("TS_UpdateFee_eq"))) TS_UpdateFee_eq(uint64_t a, uint64_t b) {
41859         LDKUpdateFee a_conv;
41860         a_conv.inner = untag_ptr(a);
41861         a_conv.is_owned = ptr_is_owned(a);
41862         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41863         a_conv.is_owned = false;
41864         LDKUpdateFee b_conv;
41865         b_conv.inner = untag_ptr(b);
41866         b_conv.is_owned = ptr_is_owned(b);
41867         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41868         b_conv.is_owned = false;
41869         jboolean ret_conv = UpdateFee_eq(&a_conv, &b_conv);
41870         return ret_conv;
41871 }
41872
41873 void  __attribute__((export_name("TS_ChannelReestablish_free"))) TS_ChannelReestablish_free(uint64_t this_obj) {
41874         LDKChannelReestablish this_obj_conv;
41875         this_obj_conv.inner = untag_ptr(this_obj);
41876         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41878         ChannelReestablish_free(this_obj_conv);
41879 }
41880
41881 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_get_channel_id"))) TS_ChannelReestablish_get_channel_id(uint64_t this_ptr) {
41882         LDKChannelReestablish this_ptr_conv;
41883         this_ptr_conv.inner = untag_ptr(this_ptr);
41884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41886         this_ptr_conv.is_owned = false;
41887         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41888         memcpy(ret_arr->elems, *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
41889         return ret_arr;
41890 }
41891
41892 void  __attribute__((export_name("TS_ChannelReestablish_set_channel_id"))) TS_ChannelReestablish_set_channel_id(uint64_t this_ptr, int8_tArray val) {
41893         LDKChannelReestablish this_ptr_conv;
41894         this_ptr_conv.inner = untag_ptr(this_ptr);
41895         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41897         this_ptr_conv.is_owned = false;
41898         LDKThirtyTwoBytes val_ref;
41899         CHECK(val->arr_len == 32);
41900         memcpy(val_ref.data, val->elems, 32); FREE(val);
41901         ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
41902 }
41903
41904 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_local_commitment_number"))) TS_ChannelReestablish_get_next_local_commitment_number(uint64_t this_ptr) {
41905         LDKChannelReestablish this_ptr_conv;
41906         this_ptr_conv.inner = untag_ptr(this_ptr);
41907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41909         this_ptr_conv.is_owned = false;
41910         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
41911         return ret_conv;
41912 }
41913
41914 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) {
41915         LDKChannelReestablish this_ptr_conv;
41916         this_ptr_conv.inner = untag_ptr(this_ptr);
41917         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41919         this_ptr_conv.is_owned = false;
41920         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
41921 }
41922
41923 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_remote_commitment_number"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint64_t this_ptr) {
41924         LDKChannelReestablish this_ptr_conv;
41925         this_ptr_conv.inner = untag_ptr(this_ptr);
41926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41928         this_ptr_conv.is_owned = false;
41929         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
41930         return ret_conv;
41931 }
41932
41933 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) {
41934         LDKChannelReestablish this_ptr_conv;
41935         this_ptr_conv.inner = untag_ptr(this_ptr);
41936         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41938         this_ptr_conv.is_owned = false;
41939         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
41940 }
41941
41942 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) {
41943         LDKChannelReestablish this_ptr_conv;
41944         this_ptr_conv.inner = untag_ptr(this_ptr);
41945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41947         this_ptr_conv.is_owned = false;
41948         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41949         memcpy(ret_arr->elems, *ChannelReestablish_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
41950         return ret_arr;
41951 }
41952
41953 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) {
41954         LDKChannelReestablish this_ptr_conv;
41955         this_ptr_conv.inner = untag_ptr(this_ptr);
41956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41958         this_ptr_conv.is_owned = false;
41959         LDKThirtyTwoBytes val_ref;
41960         CHECK(val->arr_len == 32);
41961         memcpy(val_ref.data, val->elems, 32); FREE(val);
41962         ChannelReestablish_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
41963 }
41964
41965 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) {
41966         LDKChannelReestablish this_ptr_conv;
41967         this_ptr_conv.inner = untag_ptr(this_ptr);
41968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41970         this_ptr_conv.is_owned = false;
41971         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41972         memcpy(ret_arr->elems, ChannelReestablish_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
41973         return ret_arr;
41974 }
41975
41976 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) {
41977         LDKChannelReestablish this_ptr_conv;
41978         this_ptr_conv.inner = untag_ptr(this_ptr);
41979         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41981         this_ptr_conv.is_owned = false;
41982         LDKPublicKey val_ref;
41983         CHECK(val->arr_len == 33);
41984         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41985         ChannelReestablish_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
41986 }
41987
41988 uint64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_funding_txid"))) TS_ChannelReestablish_get_next_funding_txid(uint64_t this_ptr) {
41989         LDKChannelReestablish this_ptr_conv;
41990         this_ptr_conv.inner = untag_ptr(this_ptr);
41991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41993         this_ptr_conv.is_owned = false;
41994         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
41995         *ret_copy = ChannelReestablish_get_next_funding_txid(&this_ptr_conv);
41996         uint64_t ret_ref = tag_ptr(ret_copy, true);
41997         return ret_ref;
41998 }
41999
42000 void  __attribute__((export_name("TS_ChannelReestablish_set_next_funding_txid"))) TS_ChannelReestablish_set_next_funding_txid(uint64_t this_ptr, uint64_t val) {
42001         LDKChannelReestablish this_ptr_conv;
42002         this_ptr_conv.inner = untag_ptr(this_ptr);
42003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42005         this_ptr_conv.is_owned = false;
42006         void* val_ptr = untag_ptr(val);
42007         CHECK_ACCESS(val_ptr);
42008         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
42009         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
42010         ChannelReestablish_set_next_funding_txid(&this_ptr_conv, val_conv);
42011 }
42012
42013 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) {
42014         LDKThirtyTwoBytes channel_id_arg_ref;
42015         CHECK(channel_id_arg->arr_len == 32);
42016         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
42017         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
42018         CHECK(your_last_per_commitment_secret_arg->arr_len == 32);
42019         memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg->elems, 32); FREE(your_last_per_commitment_secret_arg);
42020         LDKPublicKey my_current_per_commitment_point_arg_ref;
42021         CHECK(my_current_per_commitment_point_arg->arr_len == 33);
42022         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);
42023         void* next_funding_txid_arg_ptr = untag_ptr(next_funding_txid_arg);
42024         CHECK_ACCESS(next_funding_txid_arg_ptr);
42025         LDKCOption_ThirtyTwoBytesZ next_funding_txid_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(next_funding_txid_arg_ptr);
42026         next_funding_txid_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(next_funding_txid_arg));
42027         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);
42028         uint64_t ret_ref = 0;
42029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42031         return ret_ref;
42032 }
42033
42034 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
42035         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
42036         uint64_t ret_ref = 0;
42037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42039         return ret_ref;
42040 }
42041 int64_t  __attribute__((export_name("TS_ChannelReestablish_clone_ptr"))) TS_ChannelReestablish_clone_ptr(uint64_t arg) {
42042         LDKChannelReestablish arg_conv;
42043         arg_conv.inner = untag_ptr(arg);
42044         arg_conv.is_owned = ptr_is_owned(arg);
42045         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42046         arg_conv.is_owned = false;
42047         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
42048         return ret_conv;
42049 }
42050
42051 uint64_t  __attribute__((export_name("TS_ChannelReestablish_clone"))) TS_ChannelReestablish_clone(uint64_t orig) {
42052         LDKChannelReestablish orig_conv;
42053         orig_conv.inner = untag_ptr(orig);
42054         orig_conv.is_owned = ptr_is_owned(orig);
42055         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42056         orig_conv.is_owned = false;
42057         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
42058         uint64_t ret_ref = 0;
42059         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42060         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42061         return ret_ref;
42062 }
42063
42064 jboolean  __attribute__((export_name("TS_ChannelReestablish_eq"))) TS_ChannelReestablish_eq(uint64_t a, uint64_t b) {
42065         LDKChannelReestablish a_conv;
42066         a_conv.inner = untag_ptr(a);
42067         a_conv.is_owned = ptr_is_owned(a);
42068         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42069         a_conv.is_owned = false;
42070         LDKChannelReestablish b_conv;
42071         b_conv.inner = untag_ptr(b);
42072         b_conv.is_owned = ptr_is_owned(b);
42073         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42074         b_conv.is_owned = false;
42075         jboolean ret_conv = ChannelReestablish_eq(&a_conv, &b_conv);
42076         return ret_conv;
42077 }
42078
42079 void  __attribute__((export_name("TS_AnnouncementSignatures_free"))) TS_AnnouncementSignatures_free(uint64_t this_obj) {
42080         LDKAnnouncementSignatures this_obj_conv;
42081         this_obj_conv.inner = untag_ptr(this_obj);
42082         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42084         AnnouncementSignatures_free(this_obj_conv);
42085 }
42086
42087 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_channel_id"))) TS_AnnouncementSignatures_get_channel_id(uint64_t this_ptr) {
42088         LDKAnnouncementSignatures this_ptr_conv;
42089         this_ptr_conv.inner = untag_ptr(this_ptr);
42090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42092         this_ptr_conv.is_owned = false;
42093         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42094         memcpy(ret_arr->elems, *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
42095         return ret_arr;
42096 }
42097
42098 void  __attribute__((export_name("TS_AnnouncementSignatures_set_channel_id"))) TS_AnnouncementSignatures_set_channel_id(uint64_t this_ptr, int8_tArray val) {
42099         LDKAnnouncementSignatures this_ptr_conv;
42100         this_ptr_conv.inner = untag_ptr(this_ptr);
42101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42103         this_ptr_conv.is_owned = false;
42104         LDKThirtyTwoBytes val_ref;
42105         CHECK(val->arr_len == 32);
42106         memcpy(val_ref.data, val->elems, 32); FREE(val);
42107         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
42108 }
42109
42110 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_get_short_channel_id"))) TS_AnnouncementSignatures_get_short_channel_id(uint64_t this_ptr) {
42111         LDKAnnouncementSignatures this_ptr_conv;
42112         this_ptr_conv.inner = untag_ptr(this_ptr);
42113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42115         this_ptr_conv.is_owned = false;
42116         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
42117         return ret_conv;
42118 }
42119
42120 void  __attribute__((export_name("TS_AnnouncementSignatures_set_short_channel_id"))) TS_AnnouncementSignatures_set_short_channel_id(uint64_t this_ptr, int64_t val) {
42121         LDKAnnouncementSignatures this_ptr_conv;
42122         this_ptr_conv.inner = untag_ptr(this_ptr);
42123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42125         this_ptr_conv.is_owned = false;
42126         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
42127 }
42128
42129 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_node_signature"))) TS_AnnouncementSignatures_get_node_signature(uint64_t this_ptr) {
42130         LDKAnnouncementSignatures this_ptr_conv;
42131         this_ptr_conv.inner = untag_ptr(this_ptr);
42132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42134         this_ptr_conv.is_owned = false;
42135         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
42136         memcpy(ret_arr->elems, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
42137         return ret_arr;
42138 }
42139
42140 void  __attribute__((export_name("TS_AnnouncementSignatures_set_node_signature"))) TS_AnnouncementSignatures_set_node_signature(uint64_t this_ptr, int8_tArray val) {
42141         LDKAnnouncementSignatures this_ptr_conv;
42142         this_ptr_conv.inner = untag_ptr(this_ptr);
42143         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42145         this_ptr_conv.is_owned = false;
42146         LDKECDSASignature val_ref;
42147         CHECK(val->arr_len == 64);
42148         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
42149         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
42150 }
42151
42152 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_bitcoin_signature"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint64_t this_ptr) {
42153         LDKAnnouncementSignatures this_ptr_conv;
42154         this_ptr_conv.inner = untag_ptr(this_ptr);
42155         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42157         this_ptr_conv.is_owned = false;
42158         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
42159         memcpy(ret_arr->elems, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
42160         return ret_arr;
42161 }
42162
42163 void  __attribute__((export_name("TS_AnnouncementSignatures_set_bitcoin_signature"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint64_t this_ptr, int8_tArray val) {
42164         LDKAnnouncementSignatures this_ptr_conv;
42165         this_ptr_conv.inner = untag_ptr(this_ptr);
42166         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42168         this_ptr_conv.is_owned = false;
42169         LDKECDSASignature val_ref;
42170         CHECK(val->arr_len == 64);
42171         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
42172         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
42173 }
42174
42175 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) {
42176         LDKThirtyTwoBytes channel_id_arg_ref;
42177         CHECK(channel_id_arg->arr_len == 32);
42178         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
42179         LDKECDSASignature node_signature_arg_ref;
42180         CHECK(node_signature_arg->arr_len == 64);
42181         memcpy(node_signature_arg_ref.compact_form, node_signature_arg->elems, 64); FREE(node_signature_arg);
42182         LDKECDSASignature bitcoin_signature_arg_ref;
42183         CHECK(bitcoin_signature_arg->arr_len == 64);
42184         memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg->elems, 64); FREE(bitcoin_signature_arg);
42185         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
42186         uint64_t ret_ref = 0;
42187         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42188         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42189         return ret_ref;
42190 }
42191
42192 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
42193         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
42194         uint64_t ret_ref = 0;
42195         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42196         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42197         return ret_ref;
42198 }
42199 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone_ptr"))) TS_AnnouncementSignatures_clone_ptr(uint64_t arg) {
42200         LDKAnnouncementSignatures arg_conv;
42201         arg_conv.inner = untag_ptr(arg);
42202         arg_conv.is_owned = ptr_is_owned(arg);
42203         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42204         arg_conv.is_owned = false;
42205         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
42206         return ret_conv;
42207 }
42208
42209 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone"))) TS_AnnouncementSignatures_clone(uint64_t orig) {
42210         LDKAnnouncementSignatures orig_conv;
42211         orig_conv.inner = untag_ptr(orig);
42212         orig_conv.is_owned = ptr_is_owned(orig);
42213         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42214         orig_conv.is_owned = false;
42215         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
42216         uint64_t ret_ref = 0;
42217         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42218         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42219         return ret_ref;
42220 }
42221
42222 jboolean  __attribute__((export_name("TS_AnnouncementSignatures_eq"))) TS_AnnouncementSignatures_eq(uint64_t a, uint64_t b) {
42223         LDKAnnouncementSignatures a_conv;
42224         a_conv.inner = untag_ptr(a);
42225         a_conv.is_owned = ptr_is_owned(a);
42226         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42227         a_conv.is_owned = false;
42228         LDKAnnouncementSignatures b_conv;
42229         b_conv.inner = untag_ptr(b);
42230         b_conv.is_owned = ptr_is_owned(b);
42231         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42232         b_conv.is_owned = false;
42233         jboolean ret_conv = AnnouncementSignatures_eq(&a_conv, &b_conv);
42234         return ret_conv;
42235 }
42236
42237 void  __attribute__((export_name("TS_SocketAddress_free"))) TS_SocketAddress_free(uint64_t this_ptr) {
42238         if (!ptr_is_owned(this_ptr)) return;
42239         void* this_ptr_ptr = untag_ptr(this_ptr);
42240         CHECK_ACCESS(this_ptr_ptr);
42241         LDKSocketAddress this_ptr_conv = *(LDKSocketAddress*)(this_ptr_ptr);
42242         FREE(untag_ptr(this_ptr));
42243         SocketAddress_free(this_ptr_conv);
42244 }
42245
42246 static inline uint64_t SocketAddress_clone_ptr(LDKSocketAddress *NONNULL_PTR arg) {
42247         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
42248         *ret_copy = SocketAddress_clone(arg);
42249         uint64_t ret_ref = tag_ptr(ret_copy, true);
42250         return ret_ref;
42251 }
42252 int64_t  __attribute__((export_name("TS_SocketAddress_clone_ptr"))) TS_SocketAddress_clone_ptr(uint64_t arg) {
42253         LDKSocketAddress* arg_conv = (LDKSocketAddress*)untag_ptr(arg);
42254         int64_t ret_conv = SocketAddress_clone_ptr(arg_conv);
42255         return ret_conv;
42256 }
42257
42258 uint64_t  __attribute__((export_name("TS_SocketAddress_clone"))) TS_SocketAddress_clone(uint64_t orig) {
42259         LDKSocketAddress* orig_conv = (LDKSocketAddress*)untag_ptr(orig);
42260         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
42261         *ret_copy = SocketAddress_clone(orig_conv);
42262         uint64_t ret_ref = tag_ptr(ret_copy, true);
42263         return ret_ref;
42264 }
42265
42266 uint64_t  __attribute__((export_name("TS_SocketAddress_tcp_ip_v4"))) TS_SocketAddress_tcp_ip_v4(int8_tArray addr, int16_t port) {
42267         LDKFourBytes addr_ref;
42268         CHECK(addr->arr_len == 4);
42269         memcpy(addr_ref.data, addr->elems, 4); FREE(addr);
42270         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
42271         *ret_copy = SocketAddress_tcp_ip_v4(addr_ref, port);
42272         uint64_t ret_ref = tag_ptr(ret_copy, true);
42273         return ret_ref;
42274 }
42275
42276 uint64_t  __attribute__((export_name("TS_SocketAddress_tcp_ip_v6"))) TS_SocketAddress_tcp_ip_v6(int8_tArray addr, int16_t port) {
42277         LDKSixteenBytes addr_ref;
42278         CHECK(addr->arr_len == 16);
42279         memcpy(addr_ref.data, addr->elems, 16); FREE(addr);
42280         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
42281         *ret_copy = SocketAddress_tcp_ip_v6(addr_ref, port);
42282         uint64_t ret_ref = tag_ptr(ret_copy, true);
42283         return ret_ref;
42284 }
42285
42286 uint64_t  __attribute__((export_name("TS_SocketAddress_onion_v2"))) TS_SocketAddress_onion_v2(int8_tArray a) {
42287         LDKTwelveBytes a_ref;
42288         CHECK(a->arr_len == 12);
42289         memcpy(a_ref.data, a->elems, 12); FREE(a);
42290         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
42291         *ret_copy = SocketAddress_onion_v2(a_ref);
42292         uint64_t ret_ref = tag_ptr(ret_copy, true);
42293         return ret_ref;
42294 }
42295
42296 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) {
42297         LDKThirtyTwoBytes ed25519_pubkey_ref;
42298         CHECK(ed25519_pubkey->arr_len == 32);
42299         memcpy(ed25519_pubkey_ref.data, ed25519_pubkey->elems, 32); FREE(ed25519_pubkey);
42300         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
42301         *ret_copy = SocketAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
42302         uint64_t ret_ref = tag_ptr(ret_copy, true);
42303         return ret_ref;
42304 }
42305
42306 uint64_t  __attribute__((export_name("TS_SocketAddress_hostname"))) TS_SocketAddress_hostname(uint64_t hostname, int16_t port) {
42307         LDKHostname hostname_conv;
42308         hostname_conv.inner = untag_ptr(hostname);
42309         hostname_conv.is_owned = ptr_is_owned(hostname);
42310         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
42311         hostname_conv = Hostname_clone(&hostname_conv);
42312         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
42313         *ret_copy = SocketAddress_hostname(hostname_conv, port);
42314         uint64_t ret_ref = tag_ptr(ret_copy, true);
42315         return ret_ref;
42316 }
42317
42318 jboolean  __attribute__((export_name("TS_SocketAddress_eq"))) TS_SocketAddress_eq(uint64_t a, uint64_t b) {
42319         LDKSocketAddress* a_conv = (LDKSocketAddress*)untag_ptr(a);
42320         LDKSocketAddress* b_conv = (LDKSocketAddress*)untag_ptr(b);
42321         jboolean ret_conv = SocketAddress_eq(a_conv, b_conv);
42322         return ret_conv;
42323 }
42324
42325 int8_tArray  __attribute__((export_name("TS_SocketAddress_write"))) TS_SocketAddress_write(uint64_t obj) {
42326         LDKSocketAddress* obj_conv = (LDKSocketAddress*)untag_ptr(obj);
42327         LDKCVec_u8Z ret_var = SocketAddress_write(obj_conv);
42328         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42329         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42330         CVec_u8Z_free(ret_var);
42331         return ret_arr;
42332 }
42333
42334 uint64_t  __attribute__((export_name("TS_SocketAddress_read"))) TS_SocketAddress_read(int8_tArray ser) {
42335         LDKu8slice ser_ref;
42336         ser_ref.datalen = ser->arr_len;
42337         ser_ref.data = ser->elems;
42338         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
42339         *ret_conv = SocketAddress_read(ser_ref);
42340         FREE(ser);
42341         return tag_ptr(ret_conv, true);
42342 }
42343
42344 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_clone"))) TS_SocketAddressParseError_clone(uint64_t orig) {
42345         LDKSocketAddressParseError* orig_conv = (LDKSocketAddressParseError*)untag_ptr(orig);
42346         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_clone(orig_conv));
42347         return ret_conv;
42348 }
42349
42350 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_socket_addr_parse"))) TS_SocketAddressParseError_socket_addr_parse() {
42351         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_socket_addr_parse());
42352         return ret_conv;
42353 }
42354
42355 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_invalid_input"))) TS_SocketAddressParseError_invalid_input() {
42356         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_invalid_input());
42357         return ret_conv;
42358 }
42359
42360 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_invalid_port"))) TS_SocketAddressParseError_invalid_port() {
42361         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_invalid_port());
42362         return ret_conv;
42363 }
42364
42365 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_invalid_onion_v3"))) TS_SocketAddressParseError_invalid_onion_v3() {
42366         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_invalid_onion_v3());
42367         return ret_conv;
42368 }
42369
42370 jboolean  __attribute__((export_name("TS_SocketAddressParseError_eq"))) TS_SocketAddressParseError_eq(uint64_t a, uint64_t b) {
42371         LDKSocketAddressParseError* a_conv = (LDKSocketAddressParseError*)untag_ptr(a);
42372         LDKSocketAddressParseError* b_conv = (LDKSocketAddressParseError*)untag_ptr(b);
42373         jboolean ret_conv = SocketAddressParseError_eq(a_conv, b_conv);
42374         return ret_conv;
42375 }
42376
42377 uint64_t  __attribute__((export_name("TS_parse_onion_address"))) TS_parse_onion_address(jstring host, int16_t port) {
42378         LDKStr host_conv = str_ref_to_owned_c(host);
42379         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
42380         *ret_conv = parse_onion_address(host_conv, port);
42381         return tag_ptr(ret_conv, true);
42382 }
42383
42384 void  __attribute__((export_name("TS_UnsignedGossipMessage_free"))) TS_UnsignedGossipMessage_free(uint64_t this_ptr) {
42385         if (!ptr_is_owned(this_ptr)) return;
42386         void* this_ptr_ptr = untag_ptr(this_ptr);
42387         CHECK_ACCESS(this_ptr_ptr);
42388         LDKUnsignedGossipMessage this_ptr_conv = *(LDKUnsignedGossipMessage*)(this_ptr_ptr);
42389         FREE(untag_ptr(this_ptr));
42390         UnsignedGossipMessage_free(this_ptr_conv);
42391 }
42392
42393 static inline uint64_t UnsignedGossipMessage_clone_ptr(LDKUnsignedGossipMessage *NONNULL_PTR arg) {
42394         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
42395         *ret_copy = UnsignedGossipMessage_clone(arg);
42396         uint64_t ret_ref = tag_ptr(ret_copy, true);
42397         return ret_ref;
42398 }
42399 int64_t  __attribute__((export_name("TS_UnsignedGossipMessage_clone_ptr"))) TS_UnsignedGossipMessage_clone_ptr(uint64_t arg) {
42400         LDKUnsignedGossipMessage* arg_conv = (LDKUnsignedGossipMessage*)untag_ptr(arg);
42401         int64_t ret_conv = UnsignedGossipMessage_clone_ptr(arg_conv);
42402         return ret_conv;
42403 }
42404
42405 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_clone"))) TS_UnsignedGossipMessage_clone(uint64_t orig) {
42406         LDKUnsignedGossipMessage* orig_conv = (LDKUnsignedGossipMessage*)untag_ptr(orig);
42407         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
42408         *ret_copy = UnsignedGossipMessage_clone(orig_conv);
42409         uint64_t ret_ref = tag_ptr(ret_copy, true);
42410         return ret_ref;
42411 }
42412
42413 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_channel_announcement"))) TS_UnsignedGossipMessage_channel_announcement(uint64_t a) {
42414         LDKUnsignedChannelAnnouncement a_conv;
42415         a_conv.inner = untag_ptr(a);
42416         a_conv.is_owned = ptr_is_owned(a);
42417         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42418         a_conv = UnsignedChannelAnnouncement_clone(&a_conv);
42419         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
42420         *ret_copy = UnsignedGossipMessage_channel_announcement(a_conv);
42421         uint64_t ret_ref = tag_ptr(ret_copy, true);
42422         return ret_ref;
42423 }
42424
42425 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_channel_update"))) TS_UnsignedGossipMessage_channel_update(uint64_t a) {
42426         LDKUnsignedChannelUpdate a_conv;
42427         a_conv.inner = untag_ptr(a);
42428         a_conv.is_owned = ptr_is_owned(a);
42429         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42430         a_conv = UnsignedChannelUpdate_clone(&a_conv);
42431         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
42432         *ret_copy = UnsignedGossipMessage_channel_update(a_conv);
42433         uint64_t ret_ref = tag_ptr(ret_copy, true);
42434         return ret_ref;
42435 }
42436
42437 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_node_announcement"))) TS_UnsignedGossipMessage_node_announcement(uint64_t a) {
42438         LDKUnsignedNodeAnnouncement a_conv;
42439         a_conv.inner = untag_ptr(a);
42440         a_conv.is_owned = ptr_is_owned(a);
42441         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42442         a_conv = UnsignedNodeAnnouncement_clone(&a_conv);
42443         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
42444         *ret_copy = UnsignedGossipMessage_node_announcement(a_conv);
42445         uint64_t ret_ref = tag_ptr(ret_copy, true);
42446         return ret_ref;
42447 }
42448
42449 int8_tArray  __attribute__((export_name("TS_UnsignedGossipMessage_write"))) TS_UnsignedGossipMessage_write(uint64_t obj) {
42450         LDKUnsignedGossipMessage* obj_conv = (LDKUnsignedGossipMessage*)untag_ptr(obj);
42451         LDKCVec_u8Z ret_var = UnsignedGossipMessage_write(obj_conv);
42452         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42453         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42454         CVec_u8Z_free(ret_var);
42455         return ret_arr;
42456 }
42457
42458 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_free"))) TS_UnsignedNodeAnnouncement_free(uint64_t this_obj) {
42459         LDKUnsignedNodeAnnouncement this_obj_conv;
42460         this_obj_conv.inner = untag_ptr(this_obj);
42461         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42463         UnsignedNodeAnnouncement_free(this_obj_conv);
42464 }
42465
42466 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_features"))) TS_UnsignedNodeAnnouncement_get_features(uint64_t this_ptr) {
42467         LDKUnsignedNodeAnnouncement this_ptr_conv;
42468         this_ptr_conv.inner = untag_ptr(this_ptr);
42469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42471         this_ptr_conv.is_owned = false;
42472         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
42473         uint64_t ret_ref = 0;
42474         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42475         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42476         return ret_ref;
42477 }
42478
42479 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_features"))) TS_UnsignedNodeAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
42480         LDKUnsignedNodeAnnouncement this_ptr_conv;
42481         this_ptr_conv.inner = untag_ptr(this_ptr);
42482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42484         this_ptr_conv.is_owned = false;
42485         LDKNodeFeatures val_conv;
42486         val_conv.inner = untag_ptr(val);
42487         val_conv.is_owned = ptr_is_owned(val);
42488         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42489         val_conv = NodeFeatures_clone(&val_conv);
42490         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
42491 }
42492
42493 int32_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_timestamp"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint64_t this_ptr) {
42494         LDKUnsignedNodeAnnouncement this_ptr_conv;
42495         this_ptr_conv.inner = untag_ptr(this_ptr);
42496         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42498         this_ptr_conv.is_owned = false;
42499         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
42500         return ret_conv;
42501 }
42502
42503 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_timestamp"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint64_t this_ptr, int32_t val) {
42504         LDKUnsignedNodeAnnouncement this_ptr_conv;
42505         this_ptr_conv.inner = untag_ptr(this_ptr);
42506         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42508         this_ptr_conv.is_owned = false;
42509         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
42510 }
42511
42512 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_node_id"))) TS_UnsignedNodeAnnouncement_get_node_id(uint64_t this_ptr) {
42513         LDKUnsignedNodeAnnouncement this_ptr_conv;
42514         this_ptr_conv.inner = untag_ptr(this_ptr);
42515         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42517         this_ptr_conv.is_owned = false;
42518         LDKNodeId ret_var = UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv);
42519         uint64_t ret_ref = 0;
42520         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42521         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42522         return ret_ref;
42523 }
42524
42525 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_node_id"))) TS_UnsignedNodeAnnouncement_set_node_id(uint64_t this_ptr, uint64_t val) {
42526         LDKUnsignedNodeAnnouncement this_ptr_conv;
42527         this_ptr_conv.inner = untag_ptr(this_ptr);
42528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42530         this_ptr_conv.is_owned = false;
42531         LDKNodeId val_conv;
42532         val_conv.inner = untag_ptr(val);
42533         val_conv.is_owned = ptr_is_owned(val);
42534         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42535         val_conv = NodeId_clone(&val_conv);
42536         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_conv);
42537 }
42538
42539 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_rgb"))) TS_UnsignedNodeAnnouncement_get_rgb(uint64_t this_ptr) {
42540         LDKUnsignedNodeAnnouncement this_ptr_conv;
42541         this_ptr_conv.inner = untag_ptr(this_ptr);
42542         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42544         this_ptr_conv.is_owned = false;
42545         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
42546         memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
42547         return ret_arr;
42548 }
42549
42550 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_rgb"))) TS_UnsignedNodeAnnouncement_set_rgb(uint64_t this_ptr, int8_tArray val) {
42551         LDKUnsignedNodeAnnouncement this_ptr_conv;
42552         this_ptr_conv.inner = untag_ptr(this_ptr);
42553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42555         this_ptr_conv.is_owned = false;
42556         LDKThreeBytes val_ref;
42557         CHECK(val->arr_len == 3);
42558         memcpy(val_ref.data, val->elems, 3); FREE(val);
42559         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
42560 }
42561
42562 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_alias"))) TS_UnsignedNodeAnnouncement_get_alias(uint64_t this_ptr) {
42563         LDKUnsignedNodeAnnouncement this_ptr_conv;
42564         this_ptr_conv.inner = untag_ptr(this_ptr);
42565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42567         this_ptr_conv.is_owned = false;
42568         LDKNodeAlias ret_var = UnsignedNodeAnnouncement_get_alias(&this_ptr_conv);
42569         uint64_t ret_ref = 0;
42570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42572         return ret_ref;
42573 }
42574
42575 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_alias"))) TS_UnsignedNodeAnnouncement_set_alias(uint64_t this_ptr, uint64_t val) {
42576         LDKUnsignedNodeAnnouncement this_ptr_conv;
42577         this_ptr_conv.inner = untag_ptr(this_ptr);
42578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42580         this_ptr_conv.is_owned = false;
42581         LDKNodeAlias val_conv;
42582         val_conv.inner = untag_ptr(val);
42583         val_conv.is_owned = ptr_is_owned(val);
42584         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42585         val_conv = NodeAlias_clone(&val_conv);
42586         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_conv);
42587 }
42588
42589 uint64_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_addresses"))) TS_UnsignedNodeAnnouncement_get_addresses(uint64_t this_ptr) {
42590         LDKUnsignedNodeAnnouncement this_ptr_conv;
42591         this_ptr_conv.inner = untag_ptr(this_ptr);
42592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42594         this_ptr_conv.is_owned = false;
42595         LDKCVec_SocketAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
42596         uint64_tArray ret_arr = NULL;
42597         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
42598         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
42599         for (size_t p = 0; p < ret_var.datalen; p++) {
42600                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
42601                 *ret_conv_15_copy = ret_var.data[p];
42602                 uint64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
42603                 ret_arr_ptr[p] = ret_conv_15_ref;
42604         }
42605         
42606         FREE(ret_var.data);
42607         return ret_arr;
42608 }
42609
42610 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_addresses"))) TS_UnsignedNodeAnnouncement_set_addresses(uint64_t this_ptr, uint64_tArray val) {
42611         LDKUnsignedNodeAnnouncement this_ptr_conv;
42612         this_ptr_conv.inner = untag_ptr(this_ptr);
42613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42615         this_ptr_conv.is_owned = false;
42616         LDKCVec_SocketAddressZ val_constr;
42617         val_constr.datalen = val->arr_len;
42618         if (val_constr.datalen > 0)
42619                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
42620         else
42621                 val_constr.data = NULL;
42622         uint64_t* val_vals = val->elems;
42623         for (size_t p = 0; p < val_constr.datalen; p++) {
42624                 uint64_t val_conv_15 = val_vals[p];
42625                 void* val_conv_15_ptr = untag_ptr(val_conv_15);
42626                 CHECK_ACCESS(val_conv_15_ptr);
42627                 LDKSocketAddress val_conv_15_conv = *(LDKSocketAddress*)(val_conv_15_ptr);
42628                 val_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(val_conv_15));
42629                 val_constr.data[p] = val_conv_15_conv;
42630         }
42631         FREE(val);
42632         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
42633 }
42634
42635 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
42636         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
42637         uint64_t ret_ref = 0;
42638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42640         return ret_ref;
42641 }
42642 int64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone_ptr"))) TS_UnsignedNodeAnnouncement_clone_ptr(uint64_t arg) {
42643         LDKUnsignedNodeAnnouncement arg_conv;
42644         arg_conv.inner = untag_ptr(arg);
42645         arg_conv.is_owned = ptr_is_owned(arg);
42646         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42647         arg_conv.is_owned = false;
42648         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
42649         return ret_conv;
42650 }
42651
42652 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone"))) TS_UnsignedNodeAnnouncement_clone(uint64_t orig) {
42653         LDKUnsignedNodeAnnouncement orig_conv;
42654         orig_conv.inner = untag_ptr(orig);
42655         orig_conv.is_owned = ptr_is_owned(orig);
42656         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42657         orig_conv.is_owned = false;
42658         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
42659         uint64_t ret_ref = 0;
42660         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42661         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42662         return ret_ref;
42663 }
42664
42665 jboolean  __attribute__((export_name("TS_UnsignedNodeAnnouncement_eq"))) TS_UnsignedNodeAnnouncement_eq(uint64_t a, uint64_t b) {
42666         LDKUnsignedNodeAnnouncement a_conv;
42667         a_conv.inner = untag_ptr(a);
42668         a_conv.is_owned = ptr_is_owned(a);
42669         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42670         a_conv.is_owned = false;
42671         LDKUnsignedNodeAnnouncement b_conv;
42672         b_conv.inner = untag_ptr(b);
42673         b_conv.is_owned = ptr_is_owned(b);
42674         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42675         b_conv.is_owned = false;
42676         jboolean ret_conv = UnsignedNodeAnnouncement_eq(&a_conv, &b_conv);
42677         return ret_conv;
42678 }
42679
42680 void  __attribute__((export_name("TS_NodeAnnouncement_free"))) TS_NodeAnnouncement_free(uint64_t this_obj) {
42681         LDKNodeAnnouncement this_obj_conv;
42682         this_obj_conv.inner = untag_ptr(this_obj);
42683         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42685         NodeAnnouncement_free(this_obj_conv);
42686 }
42687
42688 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_get_signature"))) TS_NodeAnnouncement_get_signature(uint64_t this_ptr) {
42689         LDKNodeAnnouncement this_ptr_conv;
42690         this_ptr_conv.inner = untag_ptr(this_ptr);
42691         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42693         this_ptr_conv.is_owned = false;
42694         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
42695         memcpy(ret_arr->elems, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
42696         return ret_arr;
42697 }
42698
42699 void  __attribute__((export_name("TS_NodeAnnouncement_set_signature"))) TS_NodeAnnouncement_set_signature(uint64_t this_ptr, int8_tArray val) {
42700         LDKNodeAnnouncement this_ptr_conv;
42701         this_ptr_conv.inner = untag_ptr(this_ptr);
42702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42704         this_ptr_conv.is_owned = false;
42705         LDKECDSASignature val_ref;
42706         CHECK(val->arr_len == 64);
42707         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
42708         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
42709 }
42710
42711 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_get_contents"))) TS_NodeAnnouncement_get_contents(uint64_t this_ptr) {
42712         LDKNodeAnnouncement this_ptr_conv;
42713         this_ptr_conv.inner = untag_ptr(this_ptr);
42714         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42716         this_ptr_conv.is_owned = false;
42717         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
42718         uint64_t ret_ref = 0;
42719         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42720         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42721         return ret_ref;
42722 }
42723
42724 void  __attribute__((export_name("TS_NodeAnnouncement_set_contents"))) TS_NodeAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
42725         LDKNodeAnnouncement this_ptr_conv;
42726         this_ptr_conv.inner = untag_ptr(this_ptr);
42727         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42729         this_ptr_conv.is_owned = false;
42730         LDKUnsignedNodeAnnouncement val_conv;
42731         val_conv.inner = untag_ptr(val);
42732         val_conv.is_owned = ptr_is_owned(val);
42733         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42734         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
42735         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
42736 }
42737
42738 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_new"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint64_t contents_arg) {
42739         LDKECDSASignature signature_arg_ref;
42740         CHECK(signature_arg->arr_len == 64);
42741         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
42742         LDKUnsignedNodeAnnouncement contents_arg_conv;
42743         contents_arg_conv.inner = untag_ptr(contents_arg);
42744         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
42745         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
42746         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
42747         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
42748         uint64_t ret_ref = 0;
42749         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42750         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42751         return ret_ref;
42752 }
42753
42754 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
42755         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
42756         uint64_t ret_ref = 0;
42757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42759         return ret_ref;
42760 }
42761 int64_t  __attribute__((export_name("TS_NodeAnnouncement_clone_ptr"))) TS_NodeAnnouncement_clone_ptr(uint64_t arg) {
42762         LDKNodeAnnouncement arg_conv;
42763         arg_conv.inner = untag_ptr(arg);
42764         arg_conv.is_owned = ptr_is_owned(arg);
42765         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42766         arg_conv.is_owned = false;
42767         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
42768         return ret_conv;
42769 }
42770
42771 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_clone"))) TS_NodeAnnouncement_clone(uint64_t orig) {
42772         LDKNodeAnnouncement orig_conv;
42773         orig_conv.inner = untag_ptr(orig);
42774         orig_conv.is_owned = ptr_is_owned(orig);
42775         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42776         orig_conv.is_owned = false;
42777         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
42778         uint64_t ret_ref = 0;
42779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42781         return ret_ref;
42782 }
42783
42784 jboolean  __attribute__((export_name("TS_NodeAnnouncement_eq"))) TS_NodeAnnouncement_eq(uint64_t a, uint64_t b) {
42785         LDKNodeAnnouncement a_conv;
42786         a_conv.inner = untag_ptr(a);
42787         a_conv.is_owned = ptr_is_owned(a);
42788         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42789         a_conv.is_owned = false;
42790         LDKNodeAnnouncement b_conv;
42791         b_conv.inner = untag_ptr(b);
42792         b_conv.is_owned = ptr_is_owned(b);
42793         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42794         b_conv.is_owned = false;
42795         jboolean ret_conv = NodeAnnouncement_eq(&a_conv, &b_conv);
42796         return ret_conv;
42797 }
42798
42799 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_free"))) TS_UnsignedChannelAnnouncement_free(uint64_t this_obj) {
42800         LDKUnsignedChannelAnnouncement this_obj_conv;
42801         this_obj_conv.inner = untag_ptr(this_obj);
42802         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42804         UnsignedChannelAnnouncement_free(this_obj_conv);
42805 }
42806
42807 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_features"))) TS_UnsignedChannelAnnouncement_get_features(uint64_t this_ptr) {
42808         LDKUnsignedChannelAnnouncement this_ptr_conv;
42809         this_ptr_conv.inner = untag_ptr(this_ptr);
42810         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42812         this_ptr_conv.is_owned = false;
42813         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
42814         uint64_t ret_ref = 0;
42815         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42816         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42817         return ret_ref;
42818 }
42819
42820 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_features"))) TS_UnsignedChannelAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
42821         LDKUnsignedChannelAnnouncement this_ptr_conv;
42822         this_ptr_conv.inner = untag_ptr(this_ptr);
42823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42825         this_ptr_conv.is_owned = false;
42826         LDKChannelFeatures val_conv;
42827         val_conv.inner = untag_ptr(val);
42828         val_conv.is_owned = ptr_is_owned(val);
42829         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42830         val_conv = ChannelFeatures_clone(&val_conv);
42831         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
42832 }
42833
42834 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_chain_hash"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint64_t this_ptr) {
42835         LDKUnsignedChannelAnnouncement this_ptr_conv;
42836         this_ptr_conv.inner = untag_ptr(this_ptr);
42837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42839         this_ptr_conv.is_owned = false;
42840         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42841         memcpy(ret_arr->elems, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
42842         return ret_arr;
42843 }
42844
42845 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_chain_hash"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
42846         LDKUnsignedChannelAnnouncement this_ptr_conv;
42847         this_ptr_conv.inner = untag_ptr(this_ptr);
42848         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42850         this_ptr_conv.is_owned = false;
42851         LDKThirtyTwoBytes val_ref;
42852         CHECK(val->arr_len == 32);
42853         memcpy(val_ref.data, val->elems, 32); FREE(val);
42854         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
42855 }
42856
42857 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_short_channel_id"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint64_t this_ptr) {
42858         LDKUnsignedChannelAnnouncement this_ptr_conv;
42859         this_ptr_conv.inner = untag_ptr(this_ptr);
42860         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42862         this_ptr_conv.is_owned = false;
42863         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
42864         return ret_conv;
42865 }
42866
42867 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_short_channel_id"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint64_t this_ptr, int64_t val) {
42868         LDKUnsignedChannelAnnouncement this_ptr_conv;
42869         this_ptr_conv.inner = untag_ptr(this_ptr);
42870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42872         this_ptr_conv.is_owned = false;
42873         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
42874 }
42875
42876 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_1"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint64_t this_ptr) {
42877         LDKUnsignedChannelAnnouncement this_ptr_conv;
42878         this_ptr_conv.inner = untag_ptr(this_ptr);
42879         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42881         this_ptr_conv.is_owned = false;
42882         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv);
42883         uint64_t ret_ref = 0;
42884         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42885         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42886         return ret_ref;
42887 }
42888
42889 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_1"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint64_t this_ptr, uint64_t val) {
42890         LDKUnsignedChannelAnnouncement this_ptr_conv;
42891         this_ptr_conv.inner = untag_ptr(this_ptr);
42892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42894         this_ptr_conv.is_owned = false;
42895         LDKNodeId val_conv;
42896         val_conv.inner = untag_ptr(val);
42897         val_conv.is_owned = ptr_is_owned(val);
42898         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42899         val_conv = NodeId_clone(&val_conv);
42900         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_conv);
42901 }
42902
42903 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_2"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint64_t this_ptr) {
42904         LDKUnsignedChannelAnnouncement this_ptr_conv;
42905         this_ptr_conv.inner = untag_ptr(this_ptr);
42906         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42908         this_ptr_conv.is_owned = false;
42909         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv);
42910         uint64_t ret_ref = 0;
42911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42913         return ret_ref;
42914 }
42915
42916 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_2"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint64_t this_ptr, uint64_t val) {
42917         LDKUnsignedChannelAnnouncement this_ptr_conv;
42918         this_ptr_conv.inner = untag_ptr(this_ptr);
42919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42921         this_ptr_conv.is_owned = false;
42922         LDKNodeId val_conv;
42923         val_conv.inner = untag_ptr(val);
42924         val_conv.is_owned = ptr_is_owned(val);
42925         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42926         val_conv = NodeId_clone(&val_conv);
42927         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_conv);
42928 }
42929
42930 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint64_t this_ptr) {
42931         LDKUnsignedChannelAnnouncement this_ptr_conv;
42932         this_ptr_conv.inner = untag_ptr(this_ptr);
42933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42935         this_ptr_conv.is_owned = false;
42936         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv);
42937         uint64_t ret_ref = 0;
42938         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42939         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42940         return ret_ref;
42941 }
42942
42943 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint64_t this_ptr, uint64_t val) {
42944         LDKUnsignedChannelAnnouncement this_ptr_conv;
42945         this_ptr_conv.inner = untag_ptr(this_ptr);
42946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42948         this_ptr_conv.is_owned = false;
42949         LDKNodeId val_conv;
42950         val_conv.inner = untag_ptr(val);
42951         val_conv.is_owned = ptr_is_owned(val);
42952         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42953         val_conv = NodeId_clone(&val_conv);
42954         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_conv);
42955 }
42956
42957 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint64_t this_ptr) {
42958         LDKUnsignedChannelAnnouncement this_ptr_conv;
42959         this_ptr_conv.inner = untag_ptr(this_ptr);
42960         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42962         this_ptr_conv.is_owned = false;
42963         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv);
42964         uint64_t ret_ref = 0;
42965         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42966         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42967         return ret_ref;
42968 }
42969
42970 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint64_t this_ptr, uint64_t val) {
42971         LDKUnsignedChannelAnnouncement this_ptr_conv;
42972         this_ptr_conv.inner = untag_ptr(this_ptr);
42973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42975         this_ptr_conv.is_owned = false;
42976         LDKNodeId val_conv;
42977         val_conv.inner = untag_ptr(val);
42978         val_conv.is_owned = ptr_is_owned(val);
42979         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42980         val_conv = NodeId_clone(&val_conv);
42981         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_conv);
42982 }
42983
42984 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_excess_data"))) TS_UnsignedChannelAnnouncement_get_excess_data(uint64_t this_ptr) {
42985         LDKUnsignedChannelAnnouncement this_ptr_conv;
42986         this_ptr_conv.inner = untag_ptr(this_ptr);
42987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42989         this_ptr_conv.is_owned = false;
42990         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_get_excess_data(&this_ptr_conv);
42991         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42992         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42993         CVec_u8Z_free(ret_var);
42994         return ret_arr;
42995 }
42996
42997 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_excess_data"))) TS_UnsignedChannelAnnouncement_set_excess_data(uint64_t this_ptr, int8_tArray val) {
42998         LDKUnsignedChannelAnnouncement this_ptr_conv;
42999         this_ptr_conv.inner = untag_ptr(this_ptr);
43000         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43002         this_ptr_conv.is_owned = false;
43003         LDKCVec_u8Z val_ref;
43004         val_ref.datalen = val->arr_len;
43005         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
43006         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
43007         UnsignedChannelAnnouncement_set_excess_data(&this_ptr_conv, val_ref);
43008 }
43009
43010 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) {
43011         LDKChannelFeatures features_arg_conv;
43012         features_arg_conv.inner = untag_ptr(features_arg);
43013         features_arg_conv.is_owned = ptr_is_owned(features_arg);
43014         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
43015         features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
43016         LDKThirtyTwoBytes chain_hash_arg_ref;
43017         CHECK(chain_hash_arg->arr_len == 32);
43018         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
43019         LDKNodeId node_id_1_arg_conv;
43020         node_id_1_arg_conv.inner = untag_ptr(node_id_1_arg);
43021         node_id_1_arg_conv.is_owned = ptr_is_owned(node_id_1_arg);
43022         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_1_arg_conv);
43023         node_id_1_arg_conv = NodeId_clone(&node_id_1_arg_conv);
43024         LDKNodeId node_id_2_arg_conv;
43025         node_id_2_arg_conv.inner = untag_ptr(node_id_2_arg);
43026         node_id_2_arg_conv.is_owned = ptr_is_owned(node_id_2_arg);
43027         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_2_arg_conv);
43028         node_id_2_arg_conv = NodeId_clone(&node_id_2_arg_conv);
43029         LDKNodeId bitcoin_key_1_arg_conv;
43030         bitcoin_key_1_arg_conv.inner = untag_ptr(bitcoin_key_1_arg);
43031         bitcoin_key_1_arg_conv.is_owned = ptr_is_owned(bitcoin_key_1_arg);
43032         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_1_arg_conv);
43033         bitcoin_key_1_arg_conv = NodeId_clone(&bitcoin_key_1_arg_conv);
43034         LDKNodeId bitcoin_key_2_arg_conv;
43035         bitcoin_key_2_arg_conv.inner = untag_ptr(bitcoin_key_2_arg);
43036         bitcoin_key_2_arg_conv.is_owned = ptr_is_owned(bitcoin_key_2_arg);
43037         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_2_arg_conv);
43038         bitcoin_key_2_arg_conv = NodeId_clone(&bitcoin_key_2_arg_conv);
43039         LDKCVec_u8Z excess_data_arg_ref;
43040         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
43041         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
43042         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
43043         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);
43044         uint64_t ret_ref = 0;
43045         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43046         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43047         return ret_ref;
43048 }
43049
43050 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
43051         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
43052         uint64_t ret_ref = 0;
43053         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43054         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43055         return ret_ref;
43056 }
43057 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone_ptr"))) TS_UnsignedChannelAnnouncement_clone_ptr(uint64_t arg) {
43058         LDKUnsignedChannelAnnouncement arg_conv;
43059         arg_conv.inner = untag_ptr(arg);
43060         arg_conv.is_owned = ptr_is_owned(arg);
43061         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43062         arg_conv.is_owned = false;
43063         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
43064         return ret_conv;
43065 }
43066
43067 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone"))) TS_UnsignedChannelAnnouncement_clone(uint64_t orig) {
43068         LDKUnsignedChannelAnnouncement orig_conv;
43069         orig_conv.inner = untag_ptr(orig);
43070         orig_conv.is_owned = ptr_is_owned(orig);
43071         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43072         orig_conv.is_owned = false;
43073         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
43074         uint64_t ret_ref = 0;
43075         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43076         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43077         return ret_ref;
43078 }
43079
43080 jboolean  __attribute__((export_name("TS_UnsignedChannelAnnouncement_eq"))) TS_UnsignedChannelAnnouncement_eq(uint64_t a, uint64_t b) {
43081         LDKUnsignedChannelAnnouncement a_conv;
43082         a_conv.inner = untag_ptr(a);
43083         a_conv.is_owned = ptr_is_owned(a);
43084         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43085         a_conv.is_owned = false;
43086         LDKUnsignedChannelAnnouncement b_conv;
43087         b_conv.inner = untag_ptr(b);
43088         b_conv.is_owned = ptr_is_owned(b);
43089         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43090         b_conv.is_owned = false;
43091         jboolean ret_conv = UnsignedChannelAnnouncement_eq(&a_conv, &b_conv);
43092         return ret_conv;
43093 }
43094
43095 void  __attribute__((export_name("TS_ChannelAnnouncement_free"))) TS_ChannelAnnouncement_free(uint64_t this_obj) {
43096         LDKChannelAnnouncement this_obj_conv;
43097         this_obj_conv.inner = untag_ptr(this_obj);
43098         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43100         ChannelAnnouncement_free(this_obj_conv);
43101 }
43102
43103 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_1"))) TS_ChannelAnnouncement_get_node_signature_1(uint64_t this_ptr) {
43104         LDKChannelAnnouncement this_ptr_conv;
43105         this_ptr_conv.inner = untag_ptr(this_ptr);
43106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43108         this_ptr_conv.is_owned = false;
43109         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
43110         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
43111         return ret_arr;
43112 }
43113
43114 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_1"))) TS_ChannelAnnouncement_set_node_signature_1(uint64_t this_ptr, int8_tArray val) {
43115         LDKChannelAnnouncement this_ptr_conv;
43116         this_ptr_conv.inner = untag_ptr(this_ptr);
43117         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43119         this_ptr_conv.is_owned = false;
43120         LDKECDSASignature val_ref;
43121         CHECK(val->arr_len == 64);
43122         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
43123         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
43124 }
43125
43126 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_2"))) TS_ChannelAnnouncement_get_node_signature_2(uint64_t this_ptr) {
43127         LDKChannelAnnouncement this_ptr_conv;
43128         this_ptr_conv.inner = untag_ptr(this_ptr);
43129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43131         this_ptr_conv.is_owned = false;
43132         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
43133         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
43134         return ret_arr;
43135 }
43136
43137 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_2"))) TS_ChannelAnnouncement_set_node_signature_2(uint64_t this_ptr, int8_tArray val) {
43138         LDKChannelAnnouncement this_ptr_conv;
43139         this_ptr_conv.inner = untag_ptr(this_ptr);
43140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43142         this_ptr_conv.is_owned = false;
43143         LDKECDSASignature val_ref;
43144         CHECK(val->arr_len == 64);
43145         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
43146         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
43147 }
43148
43149 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_1"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint64_t this_ptr) {
43150         LDKChannelAnnouncement this_ptr_conv;
43151         this_ptr_conv.inner = untag_ptr(this_ptr);
43152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43154         this_ptr_conv.is_owned = false;
43155         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
43156         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
43157         return ret_arr;
43158 }
43159
43160 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_1"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint64_t this_ptr, int8_tArray val) {
43161         LDKChannelAnnouncement this_ptr_conv;
43162         this_ptr_conv.inner = untag_ptr(this_ptr);
43163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43165         this_ptr_conv.is_owned = false;
43166         LDKECDSASignature val_ref;
43167         CHECK(val->arr_len == 64);
43168         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
43169         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
43170 }
43171
43172 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_2"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint64_t this_ptr) {
43173         LDKChannelAnnouncement this_ptr_conv;
43174         this_ptr_conv.inner = untag_ptr(this_ptr);
43175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43177         this_ptr_conv.is_owned = false;
43178         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
43179         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
43180         return ret_arr;
43181 }
43182
43183 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_2"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint64_t this_ptr, int8_tArray val) {
43184         LDKChannelAnnouncement this_ptr_conv;
43185         this_ptr_conv.inner = untag_ptr(this_ptr);
43186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43188         this_ptr_conv.is_owned = false;
43189         LDKECDSASignature val_ref;
43190         CHECK(val->arr_len == 64);
43191         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
43192         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
43193 }
43194
43195 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_get_contents"))) TS_ChannelAnnouncement_get_contents(uint64_t this_ptr) {
43196         LDKChannelAnnouncement this_ptr_conv;
43197         this_ptr_conv.inner = untag_ptr(this_ptr);
43198         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43200         this_ptr_conv.is_owned = false;
43201         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
43202         uint64_t ret_ref = 0;
43203         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43204         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43205         return ret_ref;
43206 }
43207
43208 void  __attribute__((export_name("TS_ChannelAnnouncement_set_contents"))) TS_ChannelAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
43209         LDKChannelAnnouncement this_ptr_conv;
43210         this_ptr_conv.inner = untag_ptr(this_ptr);
43211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43213         this_ptr_conv.is_owned = false;
43214         LDKUnsignedChannelAnnouncement val_conv;
43215         val_conv.inner = untag_ptr(val);
43216         val_conv.is_owned = ptr_is_owned(val);
43217         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43218         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
43219         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
43220 }
43221
43222 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) {
43223         LDKECDSASignature node_signature_1_arg_ref;
43224         CHECK(node_signature_1_arg->arr_len == 64);
43225         memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg->elems, 64); FREE(node_signature_1_arg);
43226         LDKECDSASignature node_signature_2_arg_ref;
43227         CHECK(node_signature_2_arg->arr_len == 64);
43228         memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg->elems, 64); FREE(node_signature_2_arg);
43229         LDKECDSASignature bitcoin_signature_1_arg_ref;
43230         CHECK(bitcoin_signature_1_arg->arr_len == 64);
43231         memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg->elems, 64); FREE(bitcoin_signature_1_arg);
43232         LDKECDSASignature bitcoin_signature_2_arg_ref;
43233         CHECK(bitcoin_signature_2_arg->arr_len == 64);
43234         memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg->elems, 64); FREE(bitcoin_signature_2_arg);
43235         LDKUnsignedChannelAnnouncement contents_arg_conv;
43236         contents_arg_conv.inner = untag_ptr(contents_arg);
43237         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
43238         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
43239         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
43240         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);
43241         uint64_t ret_ref = 0;
43242         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43243         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43244         return ret_ref;
43245 }
43246
43247 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
43248         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
43249         uint64_t ret_ref = 0;
43250         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43251         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43252         return ret_ref;
43253 }
43254 int64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone_ptr"))) TS_ChannelAnnouncement_clone_ptr(uint64_t arg) {
43255         LDKChannelAnnouncement arg_conv;
43256         arg_conv.inner = untag_ptr(arg);
43257         arg_conv.is_owned = ptr_is_owned(arg);
43258         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43259         arg_conv.is_owned = false;
43260         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
43261         return ret_conv;
43262 }
43263
43264 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone"))) TS_ChannelAnnouncement_clone(uint64_t orig) {
43265         LDKChannelAnnouncement orig_conv;
43266         orig_conv.inner = untag_ptr(orig);
43267         orig_conv.is_owned = ptr_is_owned(orig);
43268         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43269         orig_conv.is_owned = false;
43270         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
43271         uint64_t ret_ref = 0;
43272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43274         return ret_ref;
43275 }
43276
43277 jboolean  __attribute__((export_name("TS_ChannelAnnouncement_eq"))) TS_ChannelAnnouncement_eq(uint64_t a, uint64_t b) {
43278         LDKChannelAnnouncement a_conv;
43279         a_conv.inner = untag_ptr(a);
43280         a_conv.is_owned = ptr_is_owned(a);
43281         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43282         a_conv.is_owned = false;
43283         LDKChannelAnnouncement b_conv;
43284         b_conv.inner = untag_ptr(b);
43285         b_conv.is_owned = ptr_is_owned(b);
43286         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43287         b_conv.is_owned = false;
43288         jboolean ret_conv = ChannelAnnouncement_eq(&a_conv, &b_conv);
43289         return ret_conv;
43290 }
43291
43292 void  __attribute__((export_name("TS_UnsignedChannelUpdate_free"))) TS_UnsignedChannelUpdate_free(uint64_t this_obj) {
43293         LDKUnsignedChannelUpdate this_obj_conv;
43294         this_obj_conv.inner = untag_ptr(this_obj);
43295         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43297         UnsignedChannelUpdate_free(this_obj_conv);
43298 }
43299
43300 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_chain_hash"))) TS_UnsignedChannelUpdate_get_chain_hash(uint64_t this_ptr) {
43301         LDKUnsignedChannelUpdate this_ptr_conv;
43302         this_ptr_conv.inner = untag_ptr(this_ptr);
43303         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43305         this_ptr_conv.is_owned = false;
43306         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43307         memcpy(ret_arr->elems, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
43308         return ret_arr;
43309 }
43310
43311 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_chain_hash"))) TS_UnsignedChannelUpdate_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
43312         LDKUnsignedChannelUpdate this_ptr_conv;
43313         this_ptr_conv.inner = untag_ptr(this_ptr);
43314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43316         this_ptr_conv.is_owned = false;
43317         LDKThirtyTwoBytes val_ref;
43318         CHECK(val->arr_len == 32);
43319         memcpy(val_ref.data, val->elems, 32); FREE(val);
43320         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
43321 }
43322
43323 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_short_channel_id"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint64_t this_ptr) {
43324         LDKUnsignedChannelUpdate this_ptr_conv;
43325         this_ptr_conv.inner = untag_ptr(this_ptr);
43326         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43328         this_ptr_conv.is_owned = false;
43329         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
43330         return ret_conv;
43331 }
43332
43333 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_short_channel_id"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint64_t this_ptr, int64_t val) {
43334         LDKUnsignedChannelUpdate this_ptr_conv;
43335         this_ptr_conv.inner = untag_ptr(this_ptr);
43336         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43338         this_ptr_conv.is_owned = false;
43339         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
43340 }
43341
43342 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_timestamp"))) TS_UnsignedChannelUpdate_get_timestamp(uint64_t this_ptr) {
43343         LDKUnsignedChannelUpdate this_ptr_conv;
43344         this_ptr_conv.inner = untag_ptr(this_ptr);
43345         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43347         this_ptr_conv.is_owned = false;
43348         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
43349         return ret_conv;
43350 }
43351
43352 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_timestamp"))) TS_UnsignedChannelUpdate_set_timestamp(uint64_t this_ptr, int32_t val) {
43353         LDKUnsignedChannelUpdate this_ptr_conv;
43354         this_ptr_conv.inner = untag_ptr(this_ptr);
43355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43357         this_ptr_conv.is_owned = false;
43358         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
43359 }
43360
43361 int8_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_flags"))) TS_UnsignedChannelUpdate_get_flags(uint64_t this_ptr) {
43362         LDKUnsignedChannelUpdate this_ptr_conv;
43363         this_ptr_conv.inner = untag_ptr(this_ptr);
43364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43366         this_ptr_conv.is_owned = false;
43367         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
43368         return ret_conv;
43369 }
43370
43371 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_flags"))) TS_UnsignedChannelUpdate_set_flags(uint64_t this_ptr, int8_t val) {
43372         LDKUnsignedChannelUpdate this_ptr_conv;
43373         this_ptr_conv.inner = untag_ptr(this_ptr);
43374         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43376         this_ptr_conv.is_owned = false;
43377         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
43378 }
43379
43380 int16_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint64_t this_ptr) {
43381         LDKUnsignedChannelUpdate this_ptr_conv;
43382         this_ptr_conv.inner = untag_ptr(this_ptr);
43383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43385         this_ptr_conv.is_owned = false;
43386         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
43387         return ret_conv;
43388 }
43389
43390 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
43391         LDKUnsignedChannelUpdate this_ptr_conv;
43392         this_ptr_conv.inner = untag_ptr(this_ptr);
43393         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43395         this_ptr_conv.is_owned = false;
43396         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
43397 }
43398
43399 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint64_t this_ptr) {
43400         LDKUnsignedChannelUpdate this_ptr_conv;
43401         this_ptr_conv.inner = untag_ptr(this_ptr);
43402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43404         this_ptr_conv.is_owned = false;
43405         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
43406         return ret_conv;
43407 }
43408
43409 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
43410         LDKUnsignedChannelUpdate this_ptr_conv;
43411         this_ptr_conv.inner = untag_ptr(this_ptr);
43412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43414         this_ptr_conv.is_owned = false;
43415         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
43416 }
43417
43418 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_get_htlc_maximum_msat(uint64_t this_ptr) {
43419         LDKUnsignedChannelUpdate this_ptr_conv;
43420         this_ptr_conv.inner = untag_ptr(this_ptr);
43421         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43423         this_ptr_conv.is_owned = false;
43424         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
43425         return ret_conv;
43426 }
43427
43428 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
43429         LDKUnsignedChannelUpdate this_ptr_conv;
43430         this_ptr_conv.inner = untag_ptr(this_ptr);
43431         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43433         this_ptr_conv.is_owned = false;
43434         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
43435 }
43436
43437 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_base_msat"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint64_t this_ptr) {
43438         LDKUnsignedChannelUpdate this_ptr_conv;
43439         this_ptr_conv.inner = untag_ptr(this_ptr);
43440         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43442         this_ptr_conv.is_owned = false;
43443         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
43444         return ret_conv;
43445 }
43446
43447 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_base_msat"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
43448         LDKUnsignedChannelUpdate this_ptr_conv;
43449         this_ptr_conv.inner = untag_ptr(this_ptr);
43450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43452         this_ptr_conv.is_owned = false;
43453         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
43454 }
43455
43456 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint64_t this_ptr) {
43457         LDKUnsignedChannelUpdate this_ptr_conv;
43458         this_ptr_conv.inner = untag_ptr(this_ptr);
43459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43461         this_ptr_conv.is_owned = false;
43462         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
43463         return ret_conv;
43464 }
43465
43466 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
43467         LDKUnsignedChannelUpdate this_ptr_conv;
43468         this_ptr_conv.inner = untag_ptr(this_ptr);
43469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43471         this_ptr_conv.is_owned = false;
43472         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
43473 }
43474
43475 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_excess_data"))) TS_UnsignedChannelUpdate_get_excess_data(uint64_t this_ptr) {
43476         LDKUnsignedChannelUpdate this_ptr_conv;
43477         this_ptr_conv.inner = untag_ptr(this_ptr);
43478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43480         this_ptr_conv.is_owned = false;
43481         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
43482         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43483         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43484         CVec_u8Z_free(ret_var);
43485         return ret_arr;
43486 }
43487
43488 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_excess_data"))) TS_UnsignedChannelUpdate_set_excess_data(uint64_t this_ptr, int8_tArray val) {
43489         LDKUnsignedChannelUpdate this_ptr_conv;
43490         this_ptr_conv.inner = untag_ptr(this_ptr);
43491         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43493         this_ptr_conv.is_owned = false;
43494         LDKCVec_u8Z val_ref;
43495         val_ref.datalen = val->arr_len;
43496         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
43497         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
43498         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
43499 }
43500
43501 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) {
43502         LDKThirtyTwoBytes chain_hash_arg_ref;
43503         CHECK(chain_hash_arg->arr_len == 32);
43504         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
43505         LDKCVec_u8Z excess_data_arg_ref;
43506         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
43507         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
43508         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
43509         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);
43510         uint64_t ret_ref = 0;
43511         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43512         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43513         return ret_ref;
43514 }
43515
43516 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
43517         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
43518         uint64_t ret_ref = 0;
43519         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43520         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43521         return ret_ref;
43522 }
43523 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone_ptr"))) TS_UnsignedChannelUpdate_clone_ptr(uint64_t arg) {
43524         LDKUnsignedChannelUpdate arg_conv;
43525         arg_conv.inner = untag_ptr(arg);
43526         arg_conv.is_owned = ptr_is_owned(arg);
43527         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43528         arg_conv.is_owned = false;
43529         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
43530         return ret_conv;
43531 }
43532
43533 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone"))) TS_UnsignedChannelUpdate_clone(uint64_t orig) {
43534         LDKUnsignedChannelUpdate orig_conv;
43535         orig_conv.inner = untag_ptr(orig);
43536         orig_conv.is_owned = ptr_is_owned(orig);
43537         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43538         orig_conv.is_owned = false;
43539         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
43540         uint64_t ret_ref = 0;
43541         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43542         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43543         return ret_ref;
43544 }
43545
43546 jboolean  __attribute__((export_name("TS_UnsignedChannelUpdate_eq"))) TS_UnsignedChannelUpdate_eq(uint64_t a, uint64_t b) {
43547         LDKUnsignedChannelUpdate a_conv;
43548         a_conv.inner = untag_ptr(a);
43549         a_conv.is_owned = ptr_is_owned(a);
43550         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43551         a_conv.is_owned = false;
43552         LDKUnsignedChannelUpdate b_conv;
43553         b_conv.inner = untag_ptr(b);
43554         b_conv.is_owned = ptr_is_owned(b);
43555         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43556         b_conv.is_owned = false;
43557         jboolean ret_conv = UnsignedChannelUpdate_eq(&a_conv, &b_conv);
43558         return ret_conv;
43559 }
43560
43561 void  __attribute__((export_name("TS_ChannelUpdate_free"))) TS_ChannelUpdate_free(uint64_t this_obj) {
43562         LDKChannelUpdate this_obj_conv;
43563         this_obj_conv.inner = untag_ptr(this_obj);
43564         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43566         ChannelUpdate_free(this_obj_conv);
43567 }
43568
43569 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_get_signature"))) TS_ChannelUpdate_get_signature(uint64_t this_ptr) {
43570         LDKChannelUpdate this_ptr_conv;
43571         this_ptr_conv.inner = untag_ptr(this_ptr);
43572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43574         this_ptr_conv.is_owned = false;
43575         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
43576         memcpy(ret_arr->elems, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
43577         return ret_arr;
43578 }
43579
43580 void  __attribute__((export_name("TS_ChannelUpdate_set_signature"))) TS_ChannelUpdate_set_signature(uint64_t this_ptr, int8_tArray val) {
43581         LDKChannelUpdate this_ptr_conv;
43582         this_ptr_conv.inner = untag_ptr(this_ptr);
43583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43585         this_ptr_conv.is_owned = false;
43586         LDKECDSASignature val_ref;
43587         CHECK(val->arr_len == 64);
43588         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
43589         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
43590 }
43591
43592 uint64_t  __attribute__((export_name("TS_ChannelUpdate_get_contents"))) TS_ChannelUpdate_get_contents(uint64_t this_ptr) {
43593         LDKChannelUpdate this_ptr_conv;
43594         this_ptr_conv.inner = untag_ptr(this_ptr);
43595         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43597         this_ptr_conv.is_owned = false;
43598         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
43599         uint64_t ret_ref = 0;
43600         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43601         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43602         return ret_ref;
43603 }
43604
43605 void  __attribute__((export_name("TS_ChannelUpdate_set_contents"))) TS_ChannelUpdate_set_contents(uint64_t this_ptr, uint64_t val) {
43606         LDKChannelUpdate this_ptr_conv;
43607         this_ptr_conv.inner = untag_ptr(this_ptr);
43608         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43610         this_ptr_conv.is_owned = false;
43611         LDKUnsignedChannelUpdate val_conv;
43612         val_conv.inner = untag_ptr(val);
43613         val_conv.is_owned = ptr_is_owned(val);
43614         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43615         val_conv = UnsignedChannelUpdate_clone(&val_conv);
43616         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
43617 }
43618
43619 uint64_t  __attribute__((export_name("TS_ChannelUpdate_new"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint64_t contents_arg) {
43620         LDKECDSASignature signature_arg_ref;
43621         CHECK(signature_arg->arr_len == 64);
43622         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
43623         LDKUnsignedChannelUpdate contents_arg_conv;
43624         contents_arg_conv.inner = untag_ptr(contents_arg);
43625         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
43626         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
43627         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
43628         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
43629         uint64_t ret_ref = 0;
43630         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43631         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43632         return ret_ref;
43633 }
43634
43635 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
43636         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
43637         uint64_t ret_ref = 0;
43638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43640         return ret_ref;
43641 }
43642 int64_t  __attribute__((export_name("TS_ChannelUpdate_clone_ptr"))) TS_ChannelUpdate_clone_ptr(uint64_t arg) {
43643         LDKChannelUpdate arg_conv;
43644         arg_conv.inner = untag_ptr(arg);
43645         arg_conv.is_owned = ptr_is_owned(arg);
43646         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43647         arg_conv.is_owned = false;
43648         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
43649         return ret_conv;
43650 }
43651
43652 uint64_t  __attribute__((export_name("TS_ChannelUpdate_clone"))) TS_ChannelUpdate_clone(uint64_t orig) {
43653         LDKChannelUpdate orig_conv;
43654         orig_conv.inner = untag_ptr(orig);
43655         orig_conv.is_owned = ptr_is_owned(orig);
43656         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43657         orig_conv.is_owned = false;
43658         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
43659         uint64_t ret_ref = 0;
43660         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43661         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43662         return ret_ref;
43663 }
43664
43665 jboolean  __attribute__((export_name("TS_ChannelUpdate_eq"))) TS_ChannelUpdate_eq(uint64_t a, uint64_t b) {
43666         LDKChannelUpdate a_conv;
43667         a_conv.inner = untag_ptr(a);
43668         a_conv.is_owned = ptr_is_owned(a);
43669         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43670         a_conv.is_owned = false;
43671         LDKChannelUpdate b_conv;
43672         b_conv.inner = untag_ptr(b);
43673         b_conv.is_owned = ptr_is_owned(b);
43674         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43675         b_conv.is_owned = false;
43676         jboolean ret_conv = ChannelUpdate_eq(&a_conv, &b_conv);
43677         return ret_conv;
43678 }
43679
43680 void  __attribute__((export_name("TS_QueryChannelRange_free"))) TS_QueryChannelRange_free(uint64_t this_obj) {
43681         LDKQueryChannelRange this_obj_conv;
43682         this_obj_conv.inner = untag_ptr(this_obj);
43683         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43685         QueryChannelRange_free(this_obj_conv);
43686 }
43687
43688 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_get_chain_hash"))) TS_QueryChannelRange_get_chain_hash(uint64_t this_ptr) {
43689         LDKQueryChannelRange this_ptr_conv;
43690         this_ptr_conv.inner = untag_ptr(this_ptr);
43691         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43693         this_ptr_conv.is_owned = false;
43694         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43695         memcpy(ret_arr->elems, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
43696         return ret_arr;
43697 }
43698
43699 void  __attribute__((export_name("TS_QueryChannelRange_set_chain_hash"))) TS_QueryChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
43700         LDKQueryChannelRange this_ptr_conv;
43701         this_ptr_conv.inner = untag_ptr(this_ptr);
43702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43704         this_ptr_conv.is_owned = false;
43705         LDKThirtyTwoBytes val_ref;
43706         CHECK(val->arr_len == 32);
43707         memcpy(val_ref.data, val->elems, 32); FREE(val);
43708         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
43709 }
43710
43711 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_first_blocknum"))) TS_QueryChannelRange_get_first_blocknum(uint64_t this_ptr) {
43712         LDKQueryChannelRange this_ptr_conv;
43713         this_ptr_conv.inner = untag_ptr(this_ptr);
43714         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43716         this_ptr_conv.is_owned = false;
43717         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
43718         return ret_conv;
43719 }
43720
43721 void  __attribute__((export_name("TS_QueryChannelRange_set_first_blocknum"))) TS_QueryChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
43722         LDKQueryChannelRange this_ptr_conv;
43723         this_ptr_conv.inner = untag_ptr(this_ptr);
43724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43726         this_ptr_conv.is_owned = false;
43727         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
43728 }
43729
43730 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_number_of_blocks"))) TS_QueryChannelRange_get_number_of_blocks(uint64_t this_ptr) {
43731         LDKQueryChannelRange this_ptr_conv;
43732         this_ptr_conv.inner = untag_ptr(this_ptr);
43733         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43735         this_ptr_conv.is_owned = false;
43736         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
43737         return ret_conv;
43738 }
43739
43740 void  __attribute__((export_name("TS_QueryChannelRange_set_number_of_blocks"))) TS_QueryChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
43741         LDKQueryChannelRange this_ptr_conv;
43742         this_ptr_conv.inner = untag_ptr(this_ptr);
43743         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43745         this_ptr_conv.is_owned = false;
43746         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
43747 }
43748
43749 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) {
43750         LDKThirtyTwoBytes chain_hash_arg_ref;
43751         CHECK(chain_hash_arg->arr_len == 32);
43752         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
43753         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
43754         uint64_t ret_ref = 0;
43755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43757         return ret_ref;
43758 }
43759
43760 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
43761         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
43762         uint64_t ret_ref = 0;
43763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43765         return ret_ref;
43766 }
43767 int64_t  __attribute__((export_name("TS_QueryChannelRange_clone_ptr"))) TS_QueryChannelRange_clone_ptr(uint64_t arg) {
43768         LDKQueryChannelRange arg_conv;
43769         arg_conv.inner = untag_ptr(arg);
43770         arg_conv.is_owned = ptr_is_owned(arg);
43771         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43772         arg_conv.is_owned = false;
43773         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
43774         return ret_conv;
43775 }
43776
43777 uint64_t  __attribute__((export_name("TS_QueryChannelRange_clone"))) TS_QueryChannelRange_clone(uint64_t orig) {
43778         LDKQueryChannelRange orig_conv;
43779         orig_conv.inner = untag_ptr(orig);
43780         orig_conv.is_owned = ptr_is_owned(orig);
43781         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43782         orig_conv.is_owned = false;
43783         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
43784         uint64_t ret_ref = 0;
43785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43787         return ret_ref;
43788 }
43789
43790 jboolean  __attribute__((export_name("TS_QueryChannelRange_eq"))) TS_QueryChannelRange_eq(uint64_t a, uint64_t b) {
43791         LDKQueryChannelRange a_conv;
43792         a_conv.inner = untag_ptr(a);
43793         a_conv.is_owned = ptr_is_owned(a);
43794         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43795         a_conv.is_owned = false;
43796         LDKQueryChannelRange b_conv;
43797         b_conv.inner = untag_ptr(b);
43798         b_conv.is_owned = ptr_is_owned(b);
43799         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43800         b_conv.is_owned = false;
43801         jboolean ret_conv = QueryChannelRange_eq(&a_conv, &b_conv);
43802         return ret_conv;
43803 }
43804
43805 void  __attribute__((export_name("TS_ReplyChannelRange_free"))) TS_ReplyChannelRange_free(uint64_t this_obj) {
43806         LDKReplyChannelRange this_obj_conv;
43807         this_obj_conv.inner = untag_ptr(this_obj);
43808         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43810         ReplyChannelRange_free(this_obj_conv);
43811 }
43812
43813 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_chain_hash"))) TS_ReplyChannelRange_get_chain_hash(uint64_t this_ptr) {
43814         LDKReplyChannelRange this_ptr_conv;
43815         this_ptr_conv.inner = untag_ptr(this_ptr);
43816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43818         this_ptr_conv.is_owned = false;
43819         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43820         memcpy(ret_arr->elems, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
43821         return ret_arr;
43822 }
43823
43824 void  __attribute__((export_name("TS_ReplyChannelRange_set_chain_hash"))) TS_ReplyChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
43825         LDKReplyChannelRange this_ptr_conv;
43826         this_ptr_conv.inner = untag_ptr(this_ptr);
43827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43829         this_ptr_conv.is_owned = false;
43830         LDKThirtyTwoBytes val_ref;
43831         CHECK(val->arr_len == 32);
43832         memcpy(val_ref.data, val->elems, 32); FREE(val);
43833         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
43834 }
43835
43836 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_first_blocknum"))) TS_ReplyChannelRange_get_first_blocknum(uint64_t this_ptr) {
43837         LDKReplyChannelRange this_ptr_conv;
43838         this_ptr_conv.inner = untag_ptr(this_ptr);
43839         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43841         this_ptr_conv.is_owned = false;
43842         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
43843         return ret_conv;
43844 }
43845
43846 void  __attribute__((export_name("TS_ReplyChannelRange_set_first_blocknum"))) TS_ReplyChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
43847         LDKReplyChannelRange this_ptr_conv;
43848         this_ptr_conv.inner = untag_ptr(this_ptr);
43849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43851         this_ptr_conv.is_owned = false;
43852         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
43853 }
43854
43855 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_number_of_blocks"))) TS_ReplyChannelRange_get_number_of_blocks(uint64_t this_ptr) {
43856         LDKReplyChannelRange this_ptr_conv;
43857         this_ptr_conv.inner = untag_ptr(this_ptr);
43858         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43860         this_ptr_conv.is_owned = false;
43861         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
43862         return ret_conv;
43863 }
43864
43865 void  __attribute__((export_name("TS_ReplyChannelRange_set_number_of_blocks"))) TS_ReplyChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
43866         LDKReplyChannelRange this_ptr_conv;
43867         this_ptr_conv.inner = untag_ptr(this_ptr);
43868         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43870         this_ptr_conv.is_owned = false;
43871         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
43872 }
43873
43874 jboolean  __attribute__((export_name("TS_ReplyChannelRange_get_sync_complete"))) TS_ReplyChannelRange_get_sync_complete(uint64_t this_ptr) {
43875         LDKReplyChannelRange this_ptr_conv;
43876         this_ptr_conv.inner = untag_ptr(this_ptr);
43877         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43879         this_ptr_conv.is_owned = false;
43880         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
43881         return ret_conv;
43882 }
43883
43884 void  __attribute__((export_name("TS_ReplyChannelRange_set_sync_complete"))) TS_ReplyChannelRange_set_sync_complete(uint64_t this_ptr, jboolean val) {
43885         LDKReplyChannelRange this_ptr_conv;
43886         this_ptr_conv.inner = untag_ptr(this_ptr);
43887         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43889         this_ptr_conv.is_owned = false;
43890         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
43891 }
43892
43893 int64_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_short_channel_ids"))) TS_ReplyChannelRange_get_short_channel_ids(uint64_t this_ptr) {
43894         LDKReplyChannelRange this_ptr_conv;
43895         this_ptr_conv.inner = untag_ptr(this_ptr);
43896         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43898         this_ptr_conv.is_owned = false;
43899         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
43900         int64_tArray ret_arr = NULL;
43901         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
43902         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
43903         for (size_t i = 0; i < ret_var.datalen; i++) {
43904                 int64_t ret_conv_8_conv = ret_var.data[i];
43905                 ret_arr_ptr[i] = ret_conv_8_conv;
43906         }
43907         
43908         FREE(ret_var.data);
43909         return ret_arr;
43910 }
43911
43912 void  __attribute__((export_name("TS_ReplyChannelRange_set_short_channel_ids"))) TS_ReplyChannelRange_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
43913         LDKReplyChannelRange this_ptr_conv;
43914         this_ptr_conv.inner = untag_ptr(this_ptr);
43915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43917         this_ptr_conv.is_owned = false;
43918         LDKCVec_u64Z val_constr;
43919         val_constr.datalen = val->arr_len;
43920         if (val_constr.datalen > 0)
43921                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
43922         else
43923                 val_constr.data = NULL;
43924         int64_t* val_vals = val->elems;
43925         for (size_t i = 0; i < val_constr.datalen; i++) {
43926                 int64_t val_conv_8 = val_vals[i];
43927                 val_constr.data[i] = val_conv_8;
43928         }
43929         FREE(val);
43930         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
43931 }
43932
43933 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) {
43934         LDKThirtyTwoBytes chain_hash_arg_ref;
43935         CHECK(chain_hash_arg->arr_len == 32);
43936         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
43937         LDKCVec_u64Z short_channel_ids_arg_constr;
43938         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
43939         if (short_channel_ids_arg_constr.datalen > 0)
43940                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
43941         else
43942                 short_channel_ids_arg_constr.data = NULL;
43943         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
43944         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
43945                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
43946                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
43947         }
43948         FREE(short_channel_ids_arg);
43949         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
43950         uint64_t ret_ref = 0;
43951         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43952         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43953         return ret_ref;
43954 }
43955
43956 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
43957         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
43958         uint64_t ret_ref = 0;
43959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43960         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43961         return ret_ref;
43962 }
43963 int64_t  __attribute__((export_name("TS_ReplyChannelRange_clone_ptr"))) TS_ReplyChannelRange_clone_ptr(uint64_t arg) {
43964         LDKReplyChannelRange arg_conv;
43965         arg_conv.inner = untag_ptr(arg);
43966         arg_conv.is_owned = ptr_is_owned(arg);
43967         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43968         arg_conv.is_owned = false;
43969         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
43970         return ret_conv;
43971 }
43972
43973 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_clone"))) TS_ReplyChannelRange_clone(uint64_t orig) {
43974         LDKReplyChannelRange orig_conv;
43975         orig_conv.inner = untag_ptr(orig);
43976         orig_conv.is_owned = ptr_is_owned(orig);
43977         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43978         orig_conv.is_owned = false;
43979         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
43980         uint64_t ret_ref = 0;
43981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43983         return ret_ref;
43984 }
43985
43986 jboolean  __attribute__((export_name("TS_ReplyChannelRange_eq"))) TS_ReplyChannelRange_eq(uint64_t a, uint64_t b) {
43987         LDKReplyChannelRange a_conv;
43988         a_conv.inner = untag_ptr(a);
43989         a_conv.is_owned = ptr_is_owned(a);
43990         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43991         a_conv.is_owned = false;
43992         LDKReplyChannelRange b_conv;
43993         b_conv.inner = untag_ptr(b);
43994         b_conv.is_owned = ptr_is_owned(b);
43995         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43996         b_conv.is_owned = false;
43997         jboolean ret_conv = ReplyChannelRange_eq(&a_conv, &b_conv);
43998         return ret_conv;
43999 }
44000
44001 void  __attribute__((export_name("TS_QueryShortChannelIds_free"))) TS_QueryShortChannelIds_free(uint64_t this_obj) {
44002         LDKQueryShortChannelIds this_obj_conv;
44003         this_obj_conv.inner = untag_ptr(this_obj);
44004         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44006         QueryShortChannelIds_free(this_obj_conv);
44007 }
44008
44009 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_chain_hash"))) TS_QueryShortChannelIds_get_chain_hash(uint64_t this_ptr) {
44010         LDKQueryShortChannelIds this_ptr_conv;
44011         this_ptr_conv.inner = untag_ptr(this_ptr);
44012         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44014         this_ptr_conv.is_owned = false;
44015         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44016         memcpy(ret_arr->elems, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
44017         return ret_arr;
44018 }
44019
44020 void  __attribute__((export_name("TS_QueryShortChannelIds_set_chain_hash"))) TS_QueryShortChannelIds_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
44021         LDKQueryShortChannelIds this_ptr_conv;
44022         this_ptr_conv.inner = untag_ptr(this_ptr);
44023         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44025         this_ptr_conv.is_owned = false;
44026         LDKThirtyTwoBytes val_ref;
44027         CHECK(val->arr_len == 32);
44028         memcpy(val_ref.data, val->elems, 32); FREE(val);
44029         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
44030 }
44031
44032 int64_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_short_channel_ids"))) TS_QueryShortChannelIds_get_short_channel_ids(uint64_t this_ptr) {
44033         LDKQueryShortChannelIds this_ptr_conv;
44034         this_ptr_conv.inner = untag_ptr(this_ptr);
44035         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44037         this_ptr_conv.is_owned = false;
44038         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
44039         int64_tArray ret_arr = NULL;
44040         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
44041         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
44042         for (size_t i = 0; i < ret_var.datalen; i++) {
44043                 int64_t ret_conv_8_conv = ret_var.data[i];
44044                 ret_arr_ptr[i] = ret_conv_8_conv;
44045         }
44046         
44047         FREE(ret_var.data);
44048         return ret_arr;
44049 }
44050
44051 void  __attribute__((export_name("TS_QueryShortChannelIds_set_short_channel_ids"))) TS_QueryShortChannelIds_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
44052         LDKQueryShortChannelIds this_ptr_conv;
44053         this_ptr_conv.inner = untag_ptr(this_ptr);
44054         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44056         this_ptr_conv.is_owned = false;
44057         LDKCVec_u64Z val_constr;
44058         val_constr.datalen = val->arr_len;
44059         if (val_constr.datalen > 0)
44060                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
44061         else
44062                 val_constr.data = NULL;
44063         int64_t* val_vals = val->elems;
44064         for (size_t i = 0; i < val_constr.datalen; i++) {
44065                 int64_t val_conv_8 = val_vals[i];
44066                 val_constr.data[i] = val_conv_8;
44067         }
44068         FREE(val);
44069         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
44070 }
44071
44072 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_new"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
44073         LDKThirtyTwoBytes chain_hash_arg_ref;
44074         CHECK(chain_hash_arg->arr_len == 32);
44075         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
44076         LDKCVec_u64Z short_channel_ids_arg_constr;
44077         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
44078         if (short_channel_ids_arg_constr.datalen > 0)
44079                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
44080         else
44081                 short_channel_ids_arg_constr.data = NULL;
44082         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
44083         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
44084                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
44085                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
44086         }
44087         FREE(short_channel_ids_arg);
44088         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
44089         uint64_t ret_ref = 0;
44090         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44091         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44092         return ret_ref;
44093 }
44094
44095 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
44096         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
44097         uint64_t ret_ref = 0;
44098         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44099         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44100         return ret_ref;
44101 }
44102 int64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone_ptr"))) TS_QueryShortChannelIds_clone_ptr(uint64_t arg) {
44103         LDKQueryShortChannelIds arg_conv;
44104         arg_conv.inner = untag_ptr(arg);
44105         arg_conv.is_owned = ptr_is_owned(arg);
44106         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44107         arg_conv.is_owned = false;
44108         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
44109         return ret_conv;
44110 }
44111
44112 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone"))) TS_QueryShortChannelIds_clone(uint64_t orig) {
44113         LDKQueryShortChannelIds orig_conv;
44114         orig_conv.inner = untag_ptr(orig);
44115         orig_conv.is_owned = ptr_is_owned(orig);
44116         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44117         orig_conv.is_owned = false;
44118         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
44119         uint64_t ret_ref = 0;
44120         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44121         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44122         return ret_ref;
44123 }
44124
44125 jboolean  __attribute__((export_name("TS_QueryShortChannelIds_eq"))) TS_QueryShortChannelIds_eq(uint64_t a, uint64_t b) {
44126         LDKQueryShortChannelIds a_conv;
44127         a_conv.inner = untag_ptr(a);
44128         a_conv.is_owned = ptr_is_owned(a);
44129         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44130         a_conv.is_owned = false;
44131         LDKQueryShortChannelIds b_conv;
44132         b_conv.inner = untag_ptr(b);
44133         b_conv.is_owned = ptr_is_owned(b);
44134         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44135         b_conv.is_owned = false;
44136         jboolean ret_conv = QueryShortChannelIds_eq(&a_conv, &b_conv);
44137         return ret_conv;
44138 }
44139
44140 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_free"))) TS_ReplyShortChannelIdsEnd_free(uint64_t this_obj) {
44141         LDKReplyShortChannelIdsEnd this_obj_conv;
44142         this_obj_conv.inner = untag_ptr(this_obj);
44143         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44145         ReplyShortChannelIdsEnd_free(this_obj_conv);
44146 }
44147
44148 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_chain_hash"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint64_t this_ptr) {
44149         LDKReplyShortChannelIdsEnd this_ptr_conv;
44150         this_ptr_conv.inner = untag_ptr(this_ptr);
44151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44153         this_ptr_conv.is_owned = false;
44154         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44155         memcpy(ret_arr->elems, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
44156         return ret_arr;
44157 }
44158
44159 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_chain_hash"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
44160         LDKReplyShortChannelIdsEnd this_ptr_conv;
44161         this_ptr_conv.inner = untag_ptr(this_ptr);
44162         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44164         this_ptr_conv.is_owned = false;
44165         LDKThirtyTwoBytes val_ref;
44166         CHECK(val->arr_len == 32);
44167         memcpy(val_ref.data, val->elems, 32); FREE(val);
44168         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
44169 }
44170
44171 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_full_information"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint64_t this_ptr) {
44172         LDKReplyShortChannelIdsEnd this_ptr_conv;
44173         this_ptr_conv.inner = untag_ptr(this_ptr);
44174         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44176         this_ptr_conv.is_owned = false;
44177         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
44178         return ret_conv;
44179 }
44180
44181 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_full_information"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint64_t this_ptr, jboolean val) {
44182         LDKReplyShortChannelIdsEnd this_ptr_conv;
44183         this_ptr_conv.inner = untag_ptr(this_ptr);
44184         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44186         this_ptr_conv.is_owned = false;
44187         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
44188 }
44189
44190 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_new"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
44191         LDKThirtyTwoBytes chain_hash_arg_ref;
44192         CHECK(chain_hash_arg->arr_len == 32);
44193         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
44194         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
44195         uint64_t ret_ref = 0;
44196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44198         return ret_ref;
44199 }
44200
44201 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
44202         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
44203         uint64_t ret_ref = 0;
44204         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44205         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44206         return ret_ref;
44207 }
44208 int64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone_ptr"))) TS_ReplyShortChannelIdsEnd_clone_ptr(uint64_t arg) {
44209         LDKReplyShortChannelIdsEnd arg_conv;
44210         arg_conv.inner = untag_ptr(arg);
44211         arg_conv.is_owned = ptr_is_owned(arg);
44212         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44213         arg_conv.is_owned = false;
44214         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
44215         return ret_conv;
44216 }
44217
44218 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone"))) TS_ReplyShortChannelIdsEnd_clone(uint64_t orig) {
44219         LDKReplyShortChannelIdsEnd orig_conv;
44220         orig_conv.inner = untag_ptr(orig);
44221         orig_conv.is_owned = ptr_is_owned(orig);
44222         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44223         orig_conv.is_owned = false;
44224         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
44225         uint64_t ret_ref = 0;
44226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44228         return ret_ref;
44229 }
44230
44231 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_eq"))) TS_ReplyShortChannelIdsEnd_eq(uint64_t a, uint64_t b) {
44232         LDKReplyShortChannelIdsEnd a_conv;
44233         a_conv.inner = untag_ptr(a);
44234         a_conv.is_owned = ptr_is_owned(a);
44235         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44236         a_conv.is_owned = false;
44237         LDKReplyShortChannelIdsEnd b_conv;
44238         b_conv.inner = untag_ptr(b);
44239         b_conv.is_owned = ptr_is_owned(b);
44240         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44241         b_conv.is_owned = false;
44242         jboolean ret_conv = ReplyShortChannelIdsEnd_eq(&a_conv, &b_conv);
44243         return ret_conv;
44244 }
44245
44246 void  __attribute__((export_name("TS_GossipTimestampFilter_free"))) TS_GossipTimestampFilter_free(uint64_t this_obj) {
44247         LDKGossipTimestampFilter this_obj_conv;
44248         this_obj_conv.inner = untag_ptr(this_obj);
44249         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44251         GossipTimestampFilter_free(this_obj_conv);
44252 }
44253
44254 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_get_chain_hash"))) TS_GossipTimestampFilter_get_chain_hash(uint64_t this_ptr) {
44255         LDKGossipTimestampFilter this_ptr_conv;
44256         this_ptr_conv.inner = untag_ptr(this_ptr);
44257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44259         this_ptr_conv.is_owned = false;
44260         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44261         memcpy(ret_arr->elems, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
44262         return ret_arr;
44263 }
44264
44265 void  __attribute__((export_name("TS_GossipTimestampFilter_set_chain_hash"))) TS_GossipTimestampFilter_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
44266         LDKGossipTimestampFilter this_ptr_conv;
44267         this_ptr_conv.inner = untag_ptr(this_ptr);
44268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44270         this_ptr_conv.is_owned = false;
44271         LDKThirtyTwoBytes val_ref;
44272         CHECK(val->arr_len == 32);
44273         memcpy(val_ref.data, val->elems, 32); FREE(val);
44274         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
44275 }
44276
44277 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_first_timestamp"))) TS_GossipTimestampFilter_get_first_timestamp(uint64_t this_ptr) {
44278         LDKGossipTimestampFilter this_ptr_conv;
44279         this_ptr_conv.inner = untag_ptr(this_ptr);
44280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44282         this_ptr_conv.is_owned = false;
44283         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
44284         return ret_conv;
44285 }
44286
44287 void  __attribute__((export_name("TS_GossipTimestampFilter_set_first_timestamp"))) TS_GossipTimestampFilter_set_first_timestamp(uint64_t this_ptr, int32_t val) {
44288         LDKGossipTimestampFilter this_ptr_conv;
44289         this_ptr_conv.inner = untag_ptr(this_ptr);
44290         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44292         this_ptr_conv.is_owned = false;
44293         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
44294 }
44295
44296 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_timestamp_range"))) TS_GossipTimestampFilter_get_timestamp_range(uint64_t this_ptr) {
44297         LDKGossipTimestampFilter this_ptr_conv;
44298         this_ptr_conv.inner = untag_ptr(this_ptr);
44299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44301         this_ptr_conv.is_owned = false;
44302         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
44303         return ret_conv;
44304 }
44305
44306 void  __attribute__((export_name("TS_GossipTimestampFilter_set_timestamp_range"))) TS_GossipTimestampFilter_set_timestamp_range(uint64_t this_ptr, int32_t val) {
44307         LDKGossipTimestampFilter this_ptr_conv;
44308         this_ptr_conv.inner = untag_ptr(this_ptr);
44309         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44311         this_ptr_conv.is_owned = false;
44312         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
44313 }
44314
44315 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) {
44316         LDKThirtyTwoBytes chain_hash_arg_ref;
44317         CHECK(chain_hash_arg->arr_len == 32);
44318         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
44319         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
44320         uint64_t ret_ref = 0;
44321         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44322         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44323         return ret_ref;
44324 }
44325
44326 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
44327         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
44328         uint64_t ret_ref = 0;
44329         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44330         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44331         return ret_ref;
44332 }
44333 int64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone_ptr"))) TS_GossipTimestampFilter_clone_ptr(uint64_t arg) {
44334         LDKGossipTimestampFilter arg_conv;
44335         arg_conv.inner = untag_ptr(arg);
44336         arg_conv.is_owned = ptr_is_owned(arg);
44337         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44338         arg_conv.is_owned = false;
44339         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
44340         return ret_conv;
44341 }
44342
44343 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone"))) TS_GossipTimestampFilter_clone(uint64_t orig) {
44344         LDKGossipTimestampFilter orig_conv;
44345         orig_conv.inner = untag_ptr(orig);
44346         orig_conv.is_owned = ptr_is_owned(orig);
44347         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44348         orig_conv.is_owned = false;
44349         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
44350         uint64_t ret_ref = 0;
44351         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44352         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44353         return ret_ref;
44354 }
44355
44356 jboolean  __attribute__((export_name("TS_GossipTimestampFilter_eq"))) TS_GossipTimestampFilter_eq(uint64_t a, uint64_t b) {
44357         LDKGossipTimestampFilter a_conv;
44358         a_conv.inner = untag_ptr(a);
44359         a_conv.is_owned = ptr_is_owned(a);
44360         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44361         a_conv.is_owned = false;
44362         LDKGossipTimestampFilter b_conv;
44363         b_conv.inner = untag_ptr(b);
44364         b_conv.is_owned = ptr_is_owned(b);
44365         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44366         b_conv.is_owned = false;
44367         jboolean ret_conv = GossipTimestampFilter_eq(&a_conv, &b_conv);
44368         return ret_conv;
44369 }
44370
44371 void  __attribute__((export_name("TS_ErrorAction_free"))) TS_ErrorAction_free(uint64_t this_ptr) {
44372         if (!ptr_is_owned(this_ptr)) return;
44373         void* this_ptr_ptr = untag_ptr(this_ptr);
44374         CHECK_ACCESS(this_ptr_ptr);
44375         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
44376         FREE(untag_ptr(this_ptr));
44377         ErrorAction_free(this_ptr_conv);
44378 }
44379
44380 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
44381         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
44382         *ret_copy = ErrorAction_clone(arg);
44383         uint64_t ret_ref = tag_ptr(ret_copy, true);
44384         return ret_ref;
44385 }
44386 int64_t  __attribute__((export_name("TS_ErrorAction_clone_ptr"))) TS_ErrorAction_clone_ptr(uint64_t arg) {
44387         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
44388         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
44389         return ret_conv;
44390 }
44391
44392 uint64_t  __attribute__((export_name("TS_ErrorAction_clone"))) TS_ErrorAction_clone(uint64_t orig) {
44393         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
44394         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
44395         *ret_copy = ErrorAction_clone(orig_conv);
44396         uint64_t ret_ref = tag_ptr(ret_copy, true);
44397         return ret_ref;
44398 }
44399
44400 uint64_t  __attribute__((export_name("TS_ErrorAction_disconnect_peer"))) TS_ErrorAction_disconnect_peer(uint64_t msg) {
44401         LDKErrorMessage msg_conv;
44402         msg_conv.inner = untag_ptr(msg);
44403         msg_conv.is_owned = ptr_is_owned(msg);
44404         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
44405         msg_conv = ErrorMessage_clone(&msg_conv);
44406         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
44407         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
44408         uint64_t ret_ref = tag_ptr(ret_copy, true);
44409         return ret_ref;
44410 }
44411
44412 uint64_t  __attribute__((export_name("TS_ErrorAction_disconnect_peer_with_warning"))) TS_ErrorAction_disconnect_peer_with_warning(uint64_t msg) {
44413         LDKWarningMessage msg_conv;
44414         msg_conv.inner = untag_ptr(msg);
44415         msg_conv.is_owned = ptr_is_owned(msg);
44416         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
44417         msg_conv = WarningMessage_clone(&msg_conv);
44418         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
44419         *ret_copy = ErrorAction_disconnect_peer_with_warning(msg_conv);
44420         uint64_t ret_ref = tag_ptr(ret_copy, true);
44421         return ret_ref;
44422 }
44423
44424 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_error"))) TS_ErrorAction_ignore_error() {
44425         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
44426         *ret_copy = ErrorAction_ignore_error();
44427         uint64_t ret_ref = tag_ptr(ret_copy, true);
44428         return ret_ref;
44429 }
44430
44431 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_and_log"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
44432         LDKLevel a_conv = LDKLevel_from_js(a);
44433         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
44434         *ret_copy = ErrorAction_ignore_and_log(a_conv);
44435         uint64_t ret_ref = tag_ptr(ret_copy, true);
44436         return ret_ref;
44437 }
44438
44439 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_duplicate_gossip"))) TS_ErrorAction_ignore_duplicate_gossip() {
44440         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
44441         *ret_copy = ErrorAction_ignore_duplicate_gossip();
44442         uint64_t ret_ref = tag_ptr(ret_copy, true);
44443         return ret_ref;
44444 }
44445
44446 uint64_t  __attribute__((export_name("TS_ErrorAction_send_error_message"))) TS_ErrorAction_send_error_message(uint64_t msg) {
44447         LDKErrorMessage msg_conv;
44448         msg_conv.inner = untag_ptr(msg);
44449         msg_conv.is_owned = ptr_is_owned(msg);
44450         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
44451         msg_conv = ErrorMessage_clone(&msg_conv);
44452         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
44453         *ret_copy = ErrorAction_send_error_message(msg_conv);
44454         uint64_t ret_ref = tag_ptr(ret_copy, true);
44455         return ret_ref;
44456 }
44457
44458 uint64_t  __attribute__((export_name("TS_ErrorAction_send_warning_message"))) TS_ErrorAction_send_warning_message(uint64_t msg, uint32_t log_level) {
44459         LDKWarningMessage msg_conv;
44460         msg_conv.inner = untag_ptr(msg);
44461         msg_conv.is_owned = ptr_is_owned(msg);
44462         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
44463         msg_conv = WarningMessage_clone(&msg_conv);
44464         LDKLevel log_level_conv = LDKLevel_from_js(log_level);
44465         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
44466         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
44467         uint64_t ret_ref = tag_ptr(ret_copy, true);
44468         return ret_ref;
44469 }
44470
44471 void  __attribute__((export_name("TS_LightningError_free"))) TS_LightningError_free(uint64_t this_obj) {
44472         LDKLightningError this_obj_conv;
44473         this_obj_conv.inner = untag_ptr(this_obj);
44474         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44476         LightningError_free(this_obj_conv);
44477 }
44478
44479 jstring  __attribute__((export_name("TS_LightningError_get_err"))) TS_LightningError_get_err(uint64_t this_ptr) {
44480         LDKLightningError this_ptr_conv;
44481         this_ptr_conv.inner = untag_ptr(this_ptr);
44482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44484         this_ptr_conv.is_owned = false;
44485         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
44486         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
44487         Str_free(ret_str);
44488         return ret_conv;
44489 }
44490
44491 void  __attribute__((export_name("TS_LightningError_set_err"))) TS_LightningError_set_err(uint64_t this_ptr, jstring val) {
44492         LDKLightningError this_ptr_conv;
44493         this_ptr_conv.inner = untag_ptr(this_ptr);
44494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44496         this_ptr_conv.is_owned = false;
44497         LDKStr val_conv = str_ref_to_owned_c(val);
44498         LightningError_set_err(&this_ptr_conv, val_conv);
44499 }
44500
44501 uint64_t  __attribute__((export_name("TS_LightningError_get_action"))) TS_LightningError_get_action(uint64_t this_ptr) {
44502         LDKLightningError this_ptr_conv;
44503         this_ptr_conv.inner = untag_ptr(this_ptr);
44504         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44506         this_ptr_conv.is_owned = false;
44507         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
44508         *ret_copy = LightningError_get_action(&this_ptr_conv);
44509         uint64_t ret_ref = tag_ptr(ret_copy, true);
44510         return ret_ref;
44511 }
44512
44513 void  __attribute__((export_name("TS_LightningError_set_action"))) TS_LightningError_set_action(uint64_t this_ptr, uint64_t val) {
44514         LDKLightningError this_ptr_conv;
44515         this_ptr_conv.inner = untag_ptr(this_ptr);
44516         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44518         this_ptr_conv.is_owned = false;
44519         void* val_ptr = untag_ptr(val);
44520         CHECK_ACCESS(val_ptr);
44521         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
44522         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
44523         LightningError_set_action(&this_ptr_conv, val_conv);
44524 }
44525
44526 uint64_t  __attribute__((export_name("TS_LightningError_new"))) TS_LightningError_new(jstring err_arg, uint64_t action_arg) {
44527         LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
44528         void* action_arg_ptr = untag_ptr(action_arg);
44529         CHECK_ACCESS(action_arg_ptr);
44530         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
44531         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
44532         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
44533         uint64_t ret_ref = 0;
44534         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44535         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44536         return ret_ref;
44537 }
44538
44539 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
44540         LDKLightningError ret_var = LightningError_clone(arg);
44541         uint64_t ret_ref = 0;
44542         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44543         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44544         return ret_ref;
44545 }
44546 int64_t  __attribute__((export_name("TS_LightningError_clone_ptr"))) TS_LightningError_clone_ptr(uint64_t arg) {
44547         LDKLightningError arg_conv;
44548         arg_conv.inner = untag_ptr(arg);
44549         arg_conv.is_owned = ptr_is_owned(arg);
44550         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44551         arg_conv.is_owned = false;
44552         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
44553         return ret_conv;
44554 }
44555
44556 uint64_t  __attribute__((export_name("TS_LightningError_clone"))) TS_LightningError_clone(uint64_t orig) {
44557         LDKLightningError orig_conv;
44558         orig_conv.inner = untag_ptr(orig);
44559         orig_conv.is_owned = ptr_is_owned(orig);
44560         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44561         orig_conv.is_owned = false;
44562         LDKLightningError ret_var = LightningError_clone(&orig_conv);
44563         uint64_t ret_ref = 0;
44564         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44565         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44566         return ret_ref;
44567 }
44568
44569 void  __attribute__((export_name("TS_CommitmentUpdate_free"))) TS_CommitmentUpdate_free(uint64_t this_obj) {
44570         LDKCommitmentUpdate this_obj_conv;
44571         this_obj_conv.inner = untag_ptr(this_obj);
44572         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44574         CommitmentUpdate_free(this_obj_conv);
44575 }
44576
44577 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_add_htlcs"))) TS_CommitmentUpdate_get_update_add_htlcs(uint64_t this_ptr) {
44578         LDKCommitmentUpdate this_ptr_conv;
44579         this_ptr_conv.inner = untag_ptr(this_ptr);
44580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44582         this_ptr_conv.is_owned = false;
44583         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
44584         uint64_tArray ret_arr = NULL;
44585         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
44586         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
44587         for (size_t p = 0; p < ret_var.datalen; p++) {
44588                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
44589                 uint64_t ret_conv_15_ref = 0;
44590                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
44591                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
44592                 ret_arr_ptr[p] = ret_conv_15_ref;
44593         }
44594         
44595         FREE(ret_var.data);
44596         return ret_arr;
44597 }
44598
44599 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_add_htlcs"))) TS_CommitmentUpdate_set_update_add_htlcs(uint64_t this_ptr, uint64_tArray val) {
44600         LDKCommitmentUpdate this_ptr_conv;
44601         this_ptr_conv.inner = untag_ptr(this_ptr);
44602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44604         this_ptr_conv.is_owned = false;
44605         LDKCVec_UpdateAddHTLCZ val_constr;
44606         val_constr.datalen = val->arr_len;
44607         if (val_constr.datalen > 0)
44608                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
44609         else
44610                 val_constr.data = NULL;
44611         uint64_t* val_vals = val->elems;
44612         for (size_t p = 0; p < val_constr.datalen; p++) {
44613                 uint64_t val_conv_15 = val_vals[p];
44614                 LDKUpdateAddHTLC val_conv_15_conv;
44615                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
44616                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
44617                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
44618                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
44619                 val_constr.data[p] = val_conv_15_conv;
44620         }
44621         FREE(val);
44622         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
44623 }
44624
44625 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fulfill_htlcs"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint64_t this_ptr) {
44626         LDKCommitmentUpdate this_ptr_conv;
44627         this_ptr_conv.inner = untag_ptr(this_ptr);
44628         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44630         this_ptr_conv.is_owned = false;
44631         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
44632         uint64_tArray ret_arr = NULL;
44633         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
44634         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
44635         for (size_t t = 0; t < ret_var.datalen; t++) {
44636                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
44637                 uint64_t ret_conv_19_ref = 0;
44638                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
44639                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
44640                 ret_arr_ptr[t] = ret_conv_19_ref;
44641         }
44642         
44643         FREE(ret_var.data);
44644         return ret_arr;
44645 }
44646
44647 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fulfill_htlcs"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint64_t this_ptr, uint64_tArray val) {
44648         LDKCommitmentUpdate this_ptr_conv;
44649         this_ptr_conv.inner = untag_ptr(this_ptr);
44650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44652         this_ptr_conv.is_owned = false;
44653         LDKCVec_UpdateFulfillHTLCZ val_constr;
44654         val_constr.datalen = val->arr_len;
44655         if (val_constr.datalen > 0)
44656                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
44657         else
44658                 val_constr.data = NULL;
44659         uint64_t* val_vals = val->elems;
44660         for (size_t t = 0; t < val_constr.datalen; t++) {
44661                 uint64_t val_conv_19 = val_vals[t];
44662                 LDKUpdateFulfillHTLC val_conv_19_conv;
44663                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
44664                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
44665                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
44666                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
44667                 val_constr.data[t] = val_conv_19_conv;
44668         }
44669         FREE(val);
44670         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
44671 }
44672
44673 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_htlcs"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint64_t this_ptr) {
44674         LDKCommitmentUpdate this_ptr_conv;
44675         this_ptr_conv.inner = untag_ptr(this_ptr);
44676         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44678         this_ptr_conv.is_owned = false;
44679         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
44680         uint64_tArray ret_arr = NULL;
44681         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
44682         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
44683         for (size_t q = 0; q < ret_var.datalen; q++) {
44684                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
44685                 uint64_t ret_conv_16_ref = 0;
44686                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
44687                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
44688                 ret_arr_ptr[q] = ret_conv_16_ref;
44689         }
44690         
44691         FREE(ret_var.data);
44692         return ret_arr;
44693 }
44694
44695 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fail_htlcs"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint64_t this_ptr, uint64_tArray val) {
44696         LDKCommitmentUpdate this_ptr_conv;
44697         this_ptr_conv.inner = untag_ptr(this_ptr);
44698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44700         this_ptr_conv.is_owned = false;
44701         LDKCVec_UpdateFailHTLCZ val_constr;
44702         val_constr.datalen = val->arr_len;
44703         if (val_constr.datalen > 0)
44704                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
44705         else
44706                 val_constr.data = NULL;
44707         uint64_t* val_vals = val->elems;
44708         for (size_t q = 0; q < val_constr.datalen; q++) {
44709                 uint64_t val_conv_16 = val_vals[q];
44710                 LDKUpdateFailHTLC val_conv_16_conv;
44711                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
44712                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
44713                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
44714                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
44715                 val_constr.data[q] = val_conv_16_conv;
44716         }
44717         FREE(val);
44718         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
44719 }
44720
44721 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_malformed_htlcs"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint64_t this_ptr) {
44722         LDKCommitmentUpdate this_ptr_conv;
44723         this_ptr_conv.inner = untag_ptr(this_ptr);
44724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44726         this_ptr_conv.is_owned = false;
44727         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
44728         uint64_tArray ret_arr = NULL;
44729         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
44730         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
44731         for (size_t z = 0; z < ret_var.datalen; z++) {
44732                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
44733                 uint64_t ret_conv_25_ref = 0;
44734                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
44735                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
44736                 ret_arr_ptr[z] = ret_conv_25_ref;
44737         }
44738         
44739         FREE(ret_var.data);
44740         return ret_arr;
44741 }
44742
44743 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) {
44744         LDKCommitmentUpdate this_ptr_conv;
44745         this_ptr_conv.inner = untag_ptr(this_ptr);
44746         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44748         this_ptr_conv.is_owned = false;
44749         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
44750         val_constr.datalen = val->arr_len;
44751         if (val_constr.datalen > 0)
44752                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
44753         else
44754                 val_constr.data = NULL;
44755         uint64_t* val_vals = val->elems;
44756         for (size_t z = 0; z < val_constr.datalen; z++) {
44757                 uint64_t val_conv_25 = val_vals[z];
44758                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
44759                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
44760                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
44761                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
44762                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
44763                 val_constr.data[z] = val_conv_25_conv;
44764         }
44765         FREE(val);
44766         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
44767 }
44768
44769 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_update_fee"))) TS_CommitmentUpdate_get_update_fee(uint64_t this_ptr) {
44770         LDKCommitmentUpdate this_ptr_conv;
44771         this_ptr_conv.inner = untag_ptr(this_ptr);
44772         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44774         this_ptr_conv.is_owned = false;
44775         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
44776         uint64_t ret_ref = 0;
44777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44779         return ret_ref;
44780 }
44781
44782 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fee"))) TS_CommitmentUpdate_set_update_fee(uint64_t this_ptr, uint64_t val) {
44783         LDKCommitmentUpdate this_ptr_conv;
44784         this_ptr_conv.inner = untag_ptr(this_ptr);
44785         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44787         this_ptr_conv.is_owned = false;
44788         LDKUpdateFee val_conv;
44789         val_conv.inner = untag_ptr(val);
44790         val_conv.is_owned = ptr_is_owned(val);
44791         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44792         val_conv = UpdateFee_clone(&val_conv);
44793         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
44794 }
44795
44796 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_commitment_signed"))) TS_CommitmentUpdate_get_commitment_signed(uint64_t this_ptr) {
44797         LDKCommitmentUpdate this_ptr_conv;
44798         this_ptr_conv.inner = untag_ptr(this_ptr);
44799         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44801         this_ptr_conv.is_owned = false;
44802         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
44803         uint64_t ret_ref = 0;
44804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44806         return ret_ref;
44807 }
44808
44809 void  __attribute__((export_name("TS_CommitmentUpdate_set_commitment_signed"))) TS_CommitmentUpdate_set_commitment_signed(uint64_t this_ptr, uint64_t val) {
44810         LDKCommitmentUpdate this_ptr_conv;
44811         this_ptr_conv.inner = untag_ptr(this_ptr);
44812         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44814         this_ptr_conv.is_owned = false;
44815         LDKCommitmentSigned val_conv;
44816         val_conv.inner = untag_ptr(val);
44817         val_conv.is_owned = ptr_is_owned(val);
44818         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44819         val_conv = CommitmentSigned_clone(&val_conv);
44820         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
44821 }
44822
44823 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) {
44824         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
44825         update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg->arr_len;
44826         if (update_add_htlcs_arg_constr.datalen > 0)
44827                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
44828         else
44829                 update_add_htlcs_arg_constr.data = NULL;
44830         uint64_t* update_add_htlcs_arg_vals = update_add_htlcs_arg->elems;
44831         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
44832                 uint64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
44833                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
44834                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
44835                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
44836                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
44837                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
44838                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
44839         }
44840         FREE(update_add_htlcs_arg);
44841         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
44842         update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg->arr_len;
44843         if (update_fulfill_htlcs_arg_constr.datalen > 0)
44844                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
44845         else
44846                 update_fulfill_htlcs_arg_constr.data = NULL;
44847         uint64_t* update_fulfill_htlcs_arg_vals = update_fulfill_htlcs_arg->elems;
44848         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
44849                 uint64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
44850                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
44851                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
44852                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
44853                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
44854                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
44855                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
44856         }
44857         FREE(update_fulfill_htlcs_arg);
44858         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
44859         update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg->arr_len;
44860         if (update_fail_htlcs_arg_constr.datalen > 0)
44861                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
44862         else
44863                 update_fail_htlcs_arg_constr.data = NULL;
44864         uint64_t* update_fail_htlcs_arg_vals = update_fail_htlcs_arg->elems;
44865         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
44866                 uint64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
44867                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
44868                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
44869                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
44870                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
44871                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
44872                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
44873         }
44874         FREE(update_fail_htlcs_arg);
44875         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
44876         update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg->arr_len;
44877         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
44878                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
44879         else
44880                 update_fail_malformed_htlcs_arg_constr.data = NULL;
44881         uint64_t* update_fail_malformed_htlcs_arg_vals = update_fail_malformed_htlcs_arg->elems;
44882         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
44883                 uint64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
44884                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
44885                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
44886                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
44887                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
44888                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
44889                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
44890         }
44891         FREE(update_fail_malformed_htlcs_arg);
44892         LDKUpdateFee update_fee_arg_conv;
44893         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
44894         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
44895         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
44896         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
44897         LDKCommitmentSigned commitment_signed_arg_conv;
44898         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
44899         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
44900         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
44901         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
44902         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);
44903         uint64_t ret_ref = 0;
44904         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44905         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44906         return ret_ref;
44907 }
44908
44909 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
44910         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
44911         uint64_t ret_ref = 0;
44912         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44913         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44914         return ret_ref;
44915 }
44916 int64_t  __attribute__((export_name("TS_CommitmentUpdate_clone_ptr"))) TS_CommitmentUpdate_clone_ptr(uint64_t arg) {
44917         LDKCommitmentUpdate arg_conv;
44918         arg_conv.inner = untag_ptr(arg);
44919         arg_conv.is_owned = ptr_is_owned(arg);
44920         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44921         arg_conv.is_owned = false;
44922         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
44923         return ret_conv;
44924 }
44925
44926 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_clone"))) TS_CommitmentUpdate_clone(uint64_t orig) {
44927         LDKCommitmentUpdate orig_conv;
44928         orig_conv.inner = untag_ptr(orig);
44929         orig_conv.is_owned = ptr_is_owned(orig);
44930         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44931         orig_conv.is_owned = false;
44932         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
44933         uint64_t ret_ref = 0;
44934         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44935         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44936         return ret_ref;
44937 }
44938
44939 jboolean  __attribute__((export_name("TS_CommitmentUpdate_eq"))) TS_CommitmentUpdate_eq(uint64_t a, uint64_t b) {
44940         LDKCommitmentUpdate a_conv;
44941         a_conv.inner = untag_ptr(a);
44942         a_conv.is_owned = ptr_is_owned(a);
44943         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44944         a_conv.is_owned = false;
44945         LDKCommitmentUpdate b_conv;
44946         b_conv.inner = untag_ptr(b);
44947         b_conv.is_owned = ptr_is_owned(b);
44948         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44949         b_conv.is_owned = false;
44950         jboolean ret_conv = CommitmentUpdate_eq(&a_conv, &b_conv);
44951         return ret_conv;
44952 }
44953
44954 void  __attribute__((export_name("TS_ChannelMessageHandler_free"))) TS_ChannelMessageHandler_free(uint64_t this_ptr) {
44955         if (!ptr_is_owned(this_ptr)) return;
44956         void* this_ptr_ptr = untag_ptr(this_ptr);
44957         CHECK_ACCESS(this_ptr_ptr);
44958         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
44959         FREE(untag_ptr(this_ptr));
44960         ChannelMessageHandler_free(this_ptr_conv);
44961 }
44962
44963 void  __attribute__((export_name("TS_RoutingMessageHandler_free"))) TS_RoutingMessageHandler_free(uint64_t this_ptr) {
44964         if (!ptr_is_owned(this_ptr)) return;
44965         void* this_ptr_ptr = untag_ptr(this_ptr);
44966         CHECK_ACCESS(this_ptr_ptr);
44967         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
44968         FREE(untag_ptr(this_ptr));
44969         RoutingMessageHandler_free(this_ptr_conv);
44970 }
44971
44972 void  __attribute__((export_name("TS_OnionMessageHandler_free"))) TS_OnionMessageHandler_free(uint64_t this_ptr) {
44973         if (!ptr_is_owned(this_ptr)) return;
44974         void* this_ptr_ptr = untag_ptr(this_ptr);
44975         CHECK_ACCESS(this_ptr_ptr);
44976         LDKOnionMessageHandler this_ptr_conv = *(LDKOnionMessageHandler*)(this_ptr_ptr);
44977         FREE(untag_ptr(this_ptr));
44978         OnionMessageHandler_free(this_ptr_conv);
44979 }
44980
44981 int8_tArray  __attribute__((export_name("TS_AcceptChannel_write"))) TS_AcceptChannel_write(uint64_t obj) {
44982         LDKAcceptChannel obj_conv;
44983         obj_conv.inner = untag_ptr(obj);
44984         obj_conv.is_owned = ptr_is_owned(obj);
44985         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44986         obj_conv.is_owned = false;
44987         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
44988         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44989         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44990         CVec_u8Z_free(ret_var);
44991         return ret_arr;
44992 }
44993
44994 uint64_t  __attribute__((export_name("TS_AcceptChannel_read"))) TS_AcceptChannel_read(int8_tArray ser) {
44995         LDKu8slice ser_ref;
44996         ser_ref.datalen = ser->arr_len;
44997         ser_ref.data = ser->elems;
44998         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
44999         *ret_conv = AcceptChannel_read(ser_ref);
45000         FREE(ser);
45001         return tag_ptr(ret_conv, true);
45002 }
45003
45004 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_write"))) TS_AcceptChannelV2_write(uint64_t obj) {
45005         LDKAcceptChannelV2 obj_conv;
45006         obj_conv.inner = untag_ptr(obj);
45007         obj_conv.is_owned = ptr_is_owned(obj);
45008         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45009         obj_conv.is_owned = false;
45010         LDKCVec_u8Z ret_var = AcceptChannelV2_write(&obj_conv);
45011         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45012         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45013         CVec_u8Z_free(ret_var);
45014         return ret_arr;
45015 }
45016
45017 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_read"))) TS_AcceptChannelV2_read(int8_tArray ser) {
45018         LDKu8slice ser_ref;
45019         ser_ref.datalen = ser->arr_len;
45020         ser_ref.data = ser->elems;
45021         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
45022         *ret_conv = AcceptChannelV2_read(ser_ref);
45023         FREE(ser);
45024         return tag_ptr(ret_conv, true);
45025 }
45026
45027 int8_tArray  __attribute__((export_name("TS_TxAddInput_write"))) TS_TxAddInput_write(uint64_t obj) {
45028         LDKTxAddInput obj_conv;
45029         obj_conv.inner = untag_ptr(obj);
45030         obj_conv.is_owned = ptr_is_owned(obj);
45031         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45032         obj_conv.is_owned = false;
45033         LDKCVec_u8Z ret_var = TxAddInput_write(&obj_conv);
45034         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45035         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45036         CVec_u8Z_free(ret_var);
45037         return ret_arr;
45038 }
45039
45040 uint64_t  __attribute__((export_name("TS_TxAddInput_read"))) TS_TxAddInput_read(int8_tArray ser) {
45041         LDKu8slice ser_ref;
45042         ser_ref.datalen = ser->arr_len;
45043         ser_ref.data = ser->elems;
45044         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
45045         *ret_conv = TxAddInput_read(ser_ref);
45046         FREE(ser);
45047         return tag_ptr(ret_conv, true);
45048 }
45049
45050 int8_tArray  __attribute__((export_name("TS_TxAddOutput_write"))) TS_TxAddOutput_write(uint64_t obj) {
45051         LDKTxAddOutput obj_conv;
45052         obj_conv.inner = untag_ptr(obj);
45053         obj_conv.is_owned = ptr_is_owned(obj);
45054         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45055         obj_conv.is_owned = false;
45056         LDKCVec_u8Z ret_var = TxAddOutput_write(&obj_conv);
45057         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45058         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45059         CVec_u8Z_free(ret_var);
45060         return ret_arr;
45061 }
45062
45063 uint64_t  __attribute__((export_name("TS_TxAddOutput_read"))) TS_TxAddOutput_read(int8_tArray ser) {
45064         LDKu8slice ser_ref;
45065         ser_ref.datalen = ser->arr_len;
45066         ser_ref.data = ser->elems;
45067         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
45068         *ret_conv = TxAddOutput_read(ser_ref);
45069         FREE(ser);
45070         return tag_ptr(ret_conv, true);
45071 }
45072
45073 int8_tArray  __attribute__((export_name("TS_TxRemoveInput_write"))) TS_TxRemoveInput_write(uint64_t obj) {
45074         LDKTxRemoveInput obj_conv;
45075         obj_conv.inner = untag_ptr(obj);
45076         obj_conv.is_owned = ptr_is_owned(obj);
45077         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45078         obj_conv.is_owned = false;
45079         LDKCVec_u8Z ret_var = TxRemoveInput_write(&obj_conv);
45080         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45081         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45082         CVec_u8Z_free(ret_var);
45083         return ret_arr;
45084 }
45085
45086 uint64_t  __attribute__((export_name("TS_TxRemoveInput_read"))) TS_TxRemoveInput_read(int8_tArray ser) {
45087         LDKu8slice ser_ref;
45088         ser_ref.datalen = ser->arr_len;
45089         ser_ref.data = ser->elems;
45090         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
45091         *ret_conv = TxRemoveInput_read(ser_ref);
45092         FREE(ser);
45093         return tag_ptr(ret_conv, true);
45094 }
45095
45096 int8_tArray  __attribute__((export_name("TS_TxRemoveOutput_write"))) TS_TxRemoveOutput_write(uint64_t obj) {
45097         LDKTxRemoveOutput obj_conv;
45098         obj_conv.inner = untag_ptr(obj);
45099         obj_conv.is_owned = ptr_is_owned(obj);
45100         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45101         obj_conv.is_owned = false;
45102         LDKCVec_u8Z ret_var = TxRemoveOutput_write(&obj_conv);
45103         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45104         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45105         CVec_u8Z_free(ret_var);
45106         return ret_arr;
45107 }
45108
45109 uint64_t  __attribute__((export_name("TS_TxRemoveOutput_read"))) TS_TxRemoveOutput_read(int8_tArray ser) {
45110         LDKu8slice ser_ref;
45111         ser_ref.datalen = ser->arr_len;
45112         ser_ref.data = ser->elems;
45113         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
45114         *ret_conv = TxRemoveOutput_read(ser_ref);
45115         FREE(ser);
45116         return tag_ptr(ret_conv, true);
45117 }
45118
45119 int8_tArray  __attribute__((export_name("TS_TxComplete_write"))) TS_TxComplete_write(uint64_t obj) {
45120         LDKTxComplete obj_conv;
45121         obj_conv.inner = untag_ptr(obj);
45122         obj_conv.is_owned = ptr_is_owned(obj);
45123         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45124         obj_conv.is_owned = false;
45125         LDKCVec_u8Z ret_var = TxComplete_write(&obj_conv);
45126         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45127         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45128         CVec_u8Z_free(ret_var);
45129         return ret_arr;
45130 }
45131
45132 uint64_t  __attribute__((export_name("TS_TxComplete_read"))) TS_TxComplete_read(int8_tArray ser) {
45133         LDKu8slice ser_ref;
45134         ser_ref.datalen = ser->arr_len;
45135         ser_ref.data = ser->elems;
45136         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
45137         *ret_conv = TxComplete_read(ser_ref);
45138         FREE(ser);
45139         return tag_ptr(ret_conv, true);
45140 }
45141
45142 int8_tArray  __attribute__((export_name("TS_TxSignatures_write"))) TS_TxSignatures_write(uint64_t obj) {
45143         LDKTxSignatures obj_conv;
45144         obj_conv.inner = untag_ptr(obj);
45145         obj_conv.is_owned = ptr_is_owned(obj);
45146         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45147         obj_conv.is_owned = false;
45148         LDKCVec_u8Z ret_var = TxSignatures_write(&obj_conv);
45149         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45150         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45151         CVec_u8Z_free(ret_var);
45152         return ret_arr;
45153 }
45154
45155 uint64_t  __attribute__((export_name("TS_TxSignatures_read"))) TS_TxSignatures_read(int8_tArray ser) {
45156         LDKu8slice ser_ref;
45157         ser_ref.datalen = ser->arr_len;
45158         ser_ref.data = ser->elems;
45159         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
45160         *ret_conv = TxSignatures_read(ser_ref);
45161         FREE(ser);
45162         return tag_ptr(ret_conv, true);
45163 }
45164
45165 int8_tArray  __attribute__((export_name("TS_TxInitRbf_write"))) TS_TxInitRbf_write(uint64_t obj) {
45166         LDKTxInitRbf obj_conv;
45167         obj_conv.inner = untag_ptr(obj);
45168         obj_conv.is_owned = ptr_is_owned(obj);
45169         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45170         obj_conv.is_owned = false;
45171         LDKCVec_u8Z ret_var = TxInitRbf_write(&obj_conv);
45172         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45173         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45174         CVec_u8Z_free(ret_var);
45175         return ret_arr;
45176 }
45177
45178 uint64_t  __attribute__((export_name("TS_TxInitRbf_read"))) TS_TxInitRbf_read(int8_tArray ser) {
45179         LDKu8slice ser_ref;
45180         ser_ref.datalen = ser->arr_len;
45181         ser_ref.data = ser->elems;
45182         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
45183         *ret_conv = TxInitRbf_read(ser_ref);
45184         FREE(ser);
45185         return tag_ptr(ret_conv, true);
45186 }
45187
45188 int8_tArray  __attribute__((export_name("TS_TxAckRbf_write"))) TS_TxAckRbf_write(uint64_t obj) {
45189         LDKTxAckRbf obj_conv;
45190         obj_conv.inner = untag_ptr(obj);
45191         obj_conv.is_owned = ptr_is_owned(obj);
45192         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45193         obj_conv.is_owned = false;
45194         LDKCVec_u8Z ret_var = TxAckRbf_write(&obj_conv);
45195         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45196         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45197         CVec_u8Z_free(ret_var);
45198         return ret_arr;
45199 }
45200
45201 uint64_t  __attribute__((export_name("TS_TxAckRbf_read"))) TS_TxAckRbf_read(int8_tArray ser) {
45202         LDKu8slice ser_ref;
45203         ser_ref.datalen = ser->arr_len;
45204         ser_ref.data = ser->elems;
45205         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
45206         *ret_conv = TxAckRbf_read(ser_ref);
45207         FREE(ser);
45208         return tag_ptr(ret_conv, true);
45209 }
45210
45211 int8_tArray  __attribute__((export_name("TS_TxAbort_write"))) TS_TxAbort_write(uint64_t obj) {
45212         LDKTxAbort obj_conv;
45213         obj_conv.inner = untag_ptr(obj);
45214         obj_conv.is_owned = ptr_is_owned(obj);
45215         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45216         obj_conv.is_owned = false;
45217         LDKCVec_u8Z ret_var = TxAbort_write(&obj_conv);
45218         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45219         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45220         CVec_u8Z_free(ret_var);
45221         return ret_arr;
45222 }
45223
45224 uint64_t  __attribute__((export_name("TS_TxAbort_read"))) TS_TxAbort_read(int8_tArray ser) {
45225         LDKu8slice ser_ref;
45226         ser_ref.datalen = ser->arr_len;
45227         ser_ref.data = ser->elems;
45228         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
45229         *ret_conv = TxAbort_read(ser_ref);
45230         FREE(ser);
45231         return tag_ptr(ret_conv, true);
45232 }
45233
45234 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_write"))) TS_AnnouncementSignatures_write(uint64_t obj) {
45235         LDKAnnouncementSignatures obj_conv;
45236         obj_conv.inner = untag_ptr(obj);
45237         obj_conv.is_owned = ptr_is_owned(obj);
45238         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45239         obj_conv.is_owned = false;
45240         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
45241         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45242         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45243         CVec_u8Z_free(ret_var);
45244         return ret_arr;
45245 }
45246
45247 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_read"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
45248         LDKu8slice ser_ref;
45249         ser_ref.datalen = ser->arr_len;
45250         ser_ref.data = ser->elems;
45251         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
45252         *ret_conv = AnnouncementSignatures_read(ser_ref);
45253         FREE(ser);
45254         return tag_ptr(ret_conv, true);
45255 }
45256
45257 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_write"))) TS_ChannelReestablish_write(uint64_t obj) {
45258         LDKChannelReestablish obj_conv;
45259         obj_conv.inner = untag_ptr(obj);
45260         obj_conv.is_owned = ptr_is_owned(obj);
45261         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45262         obj_conv.is_owned = false;
45263         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
45264         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45265         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45266         CVec_u8Z_free(ret_var);
45267         return ret_arr;
45268 }
45269
45270 uint64_t  __attribute__((export_name("TS_ChannelReestablish_read"))) TS_ChannelReestablish_read(int8_tArray ser) {
45271         LDKu8slice ser_ref;
45272         ser_ref.datalen = ser->arr_len;
45273         ser_ref.data = ser->elems;
45274         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
45275         *ret_conv = ChannelReestablish_read(ser_ref);
45276         FREE(ser);
45277         return tag_ptr(ret_conv, true);
45278 }
45279
45280 int8_tArray  __attribute__((export_name("TS_ClosingSigned_write"))) TS_ClosingSigned_write(uint64_t obj) {
45281         LDKClosingSigned obj_conv;
45282         obj_conv.inner = untag_ptr(obj);
45283         obj_conv.is_owned = ptr_is_owned(obj);
45284         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45285         obj_conv.is_owned = false;
45286         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
45287         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45288         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45289         CVec_u8Z_free(ret_var);
45290         return ret_arr;
45291 }
45292
45293 uint64_t  __attribute__((export_name("TS_ClosingSigned_read"))) TS_ClosingSigned_read(int8_tArray ser) {
45294         LDKu8slice ser_ref;
45295         ser_ref.datalen = ser->arr_len;
45296         ser_ref.data = ser->elems;
45297         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
45298         *ret_conv = ClosingSigned_read(ser_ref);
45299         FREE(ser);
45300         return tag_ptr(ret_conv, true);
45301 }
45302
45303 int8_tArray  __attribute__((export_name("TS_ClosingSignedFeeRange_write"))) TS_ClosingSignedFeeRange_write(uint64_t obj) {
45304         LDKClosingSignedFeeRange obj_conv;
45305         obj_conv.inner = untag_ptr(obj);
45306         obj_conv.is_owned = ptr_is_owned(obj);
45307         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45308         obj_conv.is_owned = false;
45309         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
45310         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45311         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45312         CVec_u8Z_free(ret_var);
45313         return ret_arr;
45314 }
45315
45316 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_read"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
45317         LDKu8slice ser_ref;
45318         ser_ref.datalen = ser->arr_len;
45319         ser_ref.data = ser->elems;
45320         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
45321         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
45322         FREE(ser);
45323         return tag_ptr(ret_conv, true);
45324 }
45325
45326 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_write"))) TS_CommitmentSigned_write(uint64_t obj) {
45327         LDKCommitmentSigned obj_conv;
45328         obj_conv.inner = untag_ptr(obj);
45329         obj_conv.is_owned = ptr_is_owned(obj);
45330         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45331         obj_conv.is_owned = false;
45332         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
45333         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45334         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45335         CVec_u8Z_free(ret_var);
45336         return ret_arr;
45337 }
45338
45339 uint64_t  __attribute__((export_name("TS_CommitmentSigned_read"))) TS_CommitmentSigned_read(int8_tArray ser) {
45340         LDKu8slice ser_ref;
45341         ser_ref.datalen = ser->arr_len;
45342         ser_ref.data = ser->elems;
45343         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
45344         *ret_conv = CommitmentSigned_read(ser_ref);
45345         FREE(ser);
45346         return tag_ptr(ret_conv, true);
45347 }
45348
45349 int8_tArray  __attribute__((export_name("TS_FundingCreated_write"))) TS_FundingCreated_write(uint64_t obj) {
45350         LDKFundingCreated obj_conv;
45351         obj_conv.inner = untag_ptr(obj);
45352         obj_conv.is_owned = ptr_is_owned(obj);
45353         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45354         obj_conv.is_owned = false;
45355         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
45356         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45357         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45358         CVec_u8Z_free(ret_var);
45359         return ret_arr;
45360 }
45361
45362 uint64_t  __attribute__((export_name("TS_FundingCreated_read"))) TS_FundingCreated_read(int8_tArray ser) {
45363         LDKu8slice ser_ref;
45364         ser_ref.datalen = ser->arr_len;
45365         ser_ref.data = ser->elems;
45366         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
45367         *ret_conv = FundingCreated_read(ser_ref);
45368         FREE(ser);
45369         return tag_ptr(ret_conv, true);
45370 }
45371
45372 int8_tArray  __attribute__((export_name("TS_FundingSigned_write"))) TS_FundingSigned_write(uint64_t obj) {
45373         LDKFundingSigned obj_conv;
45374         obj_conv.inner = untag_ptr(obj);
45375         obj_conv.is_owned = ptr_is_owned(obj);
45376         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45377         obj_conv.is_owned = false;
45378         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
45379         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45380         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45381         CVec_u8Z_free(ret_var);
45382         return ret_arr;
45383 }
45384
45385 uint64_t  __attribute__((export_name("TS_FundingSigned_read"))) TS_FundingSigned_read(int8_tArray ser) {
45386         LDKu8slice ser_ref;
45387         ser_ref.datalen = ser->arr_len;
45388         ser_ref.data = ser->elems;
45389         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
45390         *ret_conv = FundingSigned_read(ser_ref);
45391         FREE(ser);
45392         return tag_ptr(ret_conv, true);
45393 }
45394
45395 int8_tArray  __attribute__((export_name("TS_ChannelReady_write"))) TS_ChannelReady_write(uint64_t obj) {
45396         LDKChannelReady obj_conv;
45397         obj_conv.inner = untag_ptr(obj);
45398         obj_conv.is_owned = ptr_is_owned(obj);
45399         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45400         obj_conv.is_owned = false;
45401         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
45402         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45403         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45404         CVec_u8Z_free(ret_var);
45405         return ret_arr;
45406 }
45407
45408 uint64_t  __attribute__((export_name("TS_ChannelReady_read"))) TS_ChannelReady_read(int8_tArray ser) {
45409         LDKu8slice ser_ref;
45410         ser_ref.datalen = ser->arr_len;
45411         ser_ref.data = ser->elems;
45412         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
45413         *ret_conv = ChannelReady_read(ser_ref);
45414         FREE(ser);
45415         return tag_ptr(ret_conv, true);
45416 }
45417
45418 int8_tArray  __attribute__((export_name("TS_Init_write"))) TS_Init_write(uint64_t obj) {
45419         LDKInit obj_conv;
45420         obj_conv.inner = untag_ptr(obj);
45421         obj_conv.is_owned = ptr_is_owned(obj);
45422         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45423         obj_conv.is_owned = false;
45424         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
45425         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45426         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45427         CVec_u8Z_free(ret_var);
45428         return ret_arr;
45429 }
45430
45431 uint64_t  __attribute__((export_name("TS_Init_read"))) TS_Init_read(int8_tArray ser) {
45432         LDKu8slice ser_ref;
45433         ser_ref.datalen = ser->arr_len;
45434         ser_ref.data = ser->elems;
45435         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
45436         *ret_conv = Init_read(ser_ref);
45437         FREE(ser);
45438         return tag_ptr(ret_conv, true);
45439 }
45440
45441 int8_tArray  __attribute__((export_name("TS_OpenChannel_write"))) TS_OpenChannel_write(uint64_t obj) {
45442         LDKOpenChannel obj_conv;
45443         obj_conv.inner = untag_ptr(obj);
45444         obj_conv.is_owned = ptr_is_owned(obj);
45445         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45446         obj_conv.is_owned = false;
45447         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
45448         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45449         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45450         CVec_u8Z_free(ret_var);
45451         return ret_arr;
45452 }
45453
45454 uint64_t  __attribute__((export_name("TS_OpenChannel_read"))) TS_OpenChannel_read(int8_tArray ser) {
45455         LDKu8slice ser_ref;
45456         ser_ref.datalen = ser->arr_len;
45457         ser_ref.data = ser->elems;
45458         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
45459         *ret_conv = OpenChannel_read(ser_ref);
45460         FREE(ser);
45461         return tag_ptr(ret_conv, true);
45462 }
45463
45464 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_write"))) TS_OpenChannelV2_write(uint64_t obj) {
45465         LDKOpenChannelV2 obj_conv;
45466         obj_conv.inner = untag_ptr(obj);
45467         obj_conv.is_owned = ptr_is_owned(obj);
45468         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45469         obj_conv.is_owned = false;
45470         LDKCVec_u8Z ret_var = OpenChannelV2_write(&obj_conv);
45471         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45472         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45473         CVec_u8Z_free(ret_var);
45474         return ret_arr;
45475 }
45476
45477 uint64_t  __attribute__((export_name("TS_OpenChannelV2_read"))) TS_OpenChannelV2_read(int8_tArray ser) {
45478         LDKu8slice ser_ref;
45479         ser_ref.datalen = ser->arr_len;
45480         ser_ref.data = ser->elems;
45481         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
45482         *ret_conv = OpenChannelV2_read(ser_ref);
45483         FREE(ser);
45484         return tag_ptr(ret_conv, true);
45485 }
45486
45487 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_write"))) TS_RevokeAndACK_write(uint64_t obj) {
45488         LDKRevokeAndACK obj_conv;
45489         obj_conv.inner = untag_ptr(obj);
45490         obj_conv.is_owned = ptr_is_owned(obj);
45491         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45492         obj_conv.is_owned = false;
45493         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
45494         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45495         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45496         CVec_u8Z_free(ret_var);
45497         return ret_arr;
45498 }
45499
45500 uint64_t  __attribute__((export_name("TS_RevokeAndACK_read"))) TS_RevokeAndACK_read(int8_tArray ser) {
45501         LDKu8slice ser_ref;
45502         ser_ref.datalen = ser->arr_len;
45503         ser_ref.data = ser->elems;
45504         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
45505         *ret_conv = RevokeAndACK_read(ser_ref);
45506         FREE(ser);
45507         return tag_ptr(ret_conv, true);
45508 }
45509
45510 int8_tArray  __attribute__((export_name("TS_Shutdown_write"))) TS_Shutdown_write(uint64_t obj) {
45511         LDKShutdown obj_conv;
45512         obj_conv.inner = untag_ptr(obj);
45513         obj_conv.is_owned = ptr_is_owned(obj);
45514         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45515         obj_conv.is_owned = false;
45516         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
45517         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45518         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45519         CVec_u8Z_free(ret_var);
45520         return ret_arr;
45521 }
45522
45523 uint64_t  __attribute__((export_name("TS_Shutdown_read"))) TS_Shutdown_read(int8_tArray ser) {
45524         LDKu8slice ser_ref;
45525         ser_ref.datalen = ser->arr_len;
45526         ser_ref.data = ser->elems;
45527         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
45528         *ret_conv = Shutdown_read(ser_ref);
45529         FREE(ser);
45530         return tag_ptr(ret_conv, true);
45531 }
45532
45533 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_write"))) TS_UpdateFailHTLC_write(uint64_t obj) {
45534         LDKUpdateFailHTLC obj_conv;
45535         obj_conv.inner = untag_ptr(obj);
45536         obj_conv.is_owned = ptr_is_owned(obj);
45537         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45538         obj_conv.is_owned = false;
45539         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
45540         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45541         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45542         CVec_u8Z_free(ret_var);
45543         return ret_arr;
45544 }
45545
45546 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_read"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
45547         LDKu8slice ser_ref;
45548         ser_ref.datalen = ser->arr_len;
45549         ser_ref.data = ser->elems;
45550         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
45551         *ret_conv = UpdateFailHTLC_read(ser_ref);
45552         FREE(ser);
45553         return tag_ptr(ret_conv, true);
45554 }
45555
45556 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_write"))) TS_UpdateFailMalformedHTLC_write(uint64_t obj) {
45557         LDKUpdateFailMalformedHTLC obj_conv;
45558         obj_conv.inner = untag_ptr(obj);
45559         obj_conv.is_owned = ptr_is_owned(obj);
45560         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45561         obj_conv.is_owned = false;
45562         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
45563         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45564         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45565         CVec_u8Z_free(ret_var);
45566         return ret_arr;
45567 }
45568
45569 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_read"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
45570         LDKu8slice ser_ref;
45571         ser_ref.datalen = ser->arr_len;
45572         ser_ref.data = ser->elems;
45573         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
45574         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
45575         FREE(ser);
45576         return tag_ptr(ret_conv, true);
45577 }
45578
45579 int8_tArray  __attribute__((export_name("TS_UpdateFee_write"))) TS_UpdateFee_write(uint64_t obj) {
45580         LDKUpdateFee obj_conv;
45581         obj_conv.inner = untag_ptr(obj);
45582         obj_conv.is_owned = ptr_is_owned(obj);
45583         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45584         obj_conv.is_owned = false;
45585         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
45586         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45587         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45588         CVec_u8Z_free(ret_var);
45589         return ret_arr;
45590 }
45591
45592 uint64_t  __attribute__((export_name("TS_UpdateFee_read"))) TS_UpdateFee_read(int8_tArray ser) {
45593         LDKu8slice ser_ref;
45594         ser_ref.datalen = ser->arr_len;
45595         ser_ref.data = ser->elems;
45596         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
45597         *ret_conv = UpdateFee_read(ser_ref);
45598         FREE(ser);
45599         return tag_ptr(ret_conv, true);
45600 }
45601
45602 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_write"))) TS_UpdateFulfillHTLC_write(uint64_t obj) {
45603         LDKUpdateFulfillHTLC obj_conv;
45604         obj_conv.inner = untag_ptr(obj);
45605         obj_conv.is_owned = ptr_is_owned(obj);
45606         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45607         obj_conv.is_owned = false;
45608         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
45609         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45610         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45611         CVec_u8Z_free(ret_var);
45612         return ret_arr;
45613 }
45614
45615 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_read"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
45616         LDKu8slice ser_ref;
45617         ser_ref.datalen = ser->arr_len;
45618         ser_ref.data = ser->elems;
45619         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
45620         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
45621         FREE(ser);
45622         return tag_ptr(ret_conv, true);
45623 }
45624
45625 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_write"))) TS_UpdateAddHTLC_write(uint64_t obj) {
45626         LDKUpdateAddHTLC obj_conv;
45627         obj_conv.inner = untag_ptr(obj);
45628         obj_conv.is_owned = ptr_is_owned(obj);
45629         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45630         obj_conv.is_owned = false;
45631         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
45632         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45633         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45634         CVec_u8Z_free(ret_var);
45635         return ret_arr;
45636 }
45637
45638 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_read"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
45639         LDKu8slice ser_ref;
45640         ser_ref.datalen = ser->arr_len;
45641         ser_ref.data = ser->elems;
45642         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
45643         *ret_conv = UpdateAddHTLC_read(ser_ref);
45644         FREE(ser);
45645         return tag_ptr(ret_conv, true);
45646 }
45647
45648 uint64_t  __attribute__((export_name("TS_OnionMessage_read"))) TS_OnionMessage_read(int8_tArray ser) {
45649         LDKu8slice ser_ref;
45650         ser_ref.datalen = ser->arr_len;
45651         ser_ref.data = ser->elems;
45652         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
45653         *ret_conv = OnionMessage_read(ser_ref);
45654         FREE(ser);
45655         return tag_ptr(ret_conv, true);
45656 }
45657
45658 int8_tArray  __attribute__((export_name("TS_OnionMessage_write"))) TS_OnionMessage_write(uint64_t obj) {
45659         LDKOnionMessage obj_conv;
45660         obj_conv.inner = untag_ptr(obj);
45661         obj_conv.is_owned = ptr_is_owned(obj);
45662         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45663         obj_conv.is_owned = false;
45664         LDKCVec_u8Z ret_var = OnionMessage_write(&obj_conv);
45665         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45666         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45667         CVec_u8Z_free(ret_var);
45668         return ret_arr;
45669 }
45670
45671 int8_tArray  __attribute__((export_name("TS_Ping_write"))) TS_Ping_write(uint64_t obj) {
45672         LDKPing obj_conv;
45673         obj_conv.inner = untag_ptr(obj);
45674         obj_conv.is_owned = ptr_is_owned(obj);
45675         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45676         obj_conv.is_owned = false;
45677         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
45678         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45679         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45680         CVec_u8Z_free(ret_var);
45681         return ret_arr;
45682 }
45683
45684 uint64_t  __attribute__((export_name("TS_Ping_read"))) TS_Ping_read(int8_tArray ser) {
45685         LDKu8slice ser_ref;
45686         ser_ref.datalen = ser->arr_len;
45687         ser_ref.data = ser->elems;
45688         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
45689         *ret_conv = Ping_read(ser_ref);
45690         FREE(ser);
45691         return tag_ptr(ret_conv, true);
45692 }
45693
45694 int8_tArray  __attribute__((export_name("TS_Pong_write"))) TS_Pong_write(uint64_t obj) {
45695         LDKPong obj_conv;
45696         obj_conv.inner = untag_ptr(obj);
45697         obj_conv.is_owned = ptr_is_owned(obj);
45698         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45699         obj_conv.is_owned = false;
45700         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
45701         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45702         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45703         CVec_u8Z_free(ret_var);
45704         return ret_arr;
45705 }
45706
45707 uint64_t  __attribute__((export_name("TS_Pong_read"))) TS_Pong_read(int8_tArray ser) {
45708         LDKu8slice ser_ref;
45709         ser_ref.datalen = ser->arr_len;
45710         ser_ref.data = ser->elems;
45711         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
45712         *ret_conv = Pong_read(ser_ref);
45713         FREE(ser);
45714         return tag_ptr(ret_conv, true);
45715 }
45716
45717 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_write"))) TS_UnsignedChannelAnnouncement_write(uint64_t obj) {
45718         LDKUnsignedChannelAnnouncement obj_conv;
45719         obj_conv.inner = untag_ptr(obj);
45720         obj_conv.is_owned = ptr_is_owned(obj);
45721         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45722         obj_conv.is_owned = false;
45723         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
45724         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45725         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45726         CVec_u8Z_free(ret_var);
45727         return ret_arr;
45728 }
45729
45730 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_read"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
45731         LDKu8slice ser_ref;
45732         ser_ref.datalen = ser->arr_len;
45733         ser_ref.data = ser->elems;
45734         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
45735         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
45736         FREE(ser);
45737         return tag_ptr(ret_conv, true);
45738 }
45739
45740 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_write"))) TS_ChannelAnnouncement_write(uint64_t obj) {
45741         LDKChannelAnnouncement obj_conv;
45742         obj_conv.inner = untag_ptr(obj);
45743         obj_conv.is_owned = ptr_is_owned(obj);
45744         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45745         obj_conv.is_owned = false;
45746         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
45747         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45748         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45749         CVec_u8Z_free(ret_var);
45750         return ret_arr;
45751 }
45752
45753 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_read"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
45754         LDKu8slice ser_ref;
45755         ser_ref.datalen = ser->arr_len;
45756         ser_ref.data = ser->elems;
45757         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
45758         *ret_conv = ChannelAnnouncement_read(ser_ref);
45759         FREE(ser);
45760         return tag_ptr(ret_conv, true);
45761 }
45762
45763 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_write"))) TS_UnsignedChannelUpdate_write(uint64_t obj) {
45764         LDKUnsignedChannelUpdate obj_conv;
45765         obj_conv.inner = untag_ptr(obj);
45766         obj_conv.is_owned = ptr_is_owned(obj);
45767         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45768         obj_conv.is_owned = false;
45769         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
45770         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45771         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45772         CVec_u8Z_free(ret_var);
45773         return ret_arr;
45774 }
45775
45776 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_read"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
45777         LDKu8slice ser_ref;
45778         ser_ref.datalen = ser->arr_len;
45779         ser_ref.data = ser->elems;
45780         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
45781         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
45782         FREE(ser);
45783         return tag_ptr(ret_conv, true);
45784 }
45785
45786 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_write"))) TS_ChannelUpdate_write(uint64_t obj) {
45787         LDKChannelUpdate obj_conv;
45788         obj_conv.inner = untag_ptr(obj);
45789         obj_conv.is_owned = ptr_is_owned(obj);
45790         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45791         obj_conv.is_owned = false;
45792         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
45793         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45794         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45795         CVec_u8Z_free(ret_var);
45796         return ret_arr;
45797 }
45798
45799 uint64_t  __attribute__((export_name("TS_ChannelUpdate_read"))) TS_ChannelUpdate_read(int8_tArray ser) {
45800         LDKu8slice ser_ref;
45801         ser_ref.datalen = ser->arr_len;
45802         ser_ref.data = ser->elems;
45803         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
45804         *ret_conv = ChannelUpdate_read(ser_ref);
45805         FREE(ser);
45806         return tag_ptr(ret_conv, true);
45807 }
45808
45809 int8_tArray  __attribute__((export_name("TS_ErrorMessage_write"))) TS_ErrorMessage_write(uint64_t obj) {
45810         LDKErrorMessage obj_conv;
45811         obj_conv.inner = untag_ptr(obj);
45812         obj_conv.is_owned = ptr_is_owned(obj);
45813         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45814         obj_conv.is_owned = false;
45815         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
45816         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45817         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45818         CVec_u8Z_free(ret_var);
45819         return ret_arr;
45820 }
45821
45822 uint64_t  __attribute__((export_name("TS_ErrorMessage_read"))) TS_ErrorMessage_read(int8_tArray ser) {
45823         LDKu8slice ser_ref;
45824         ser_ref.datalen = ser->arr_len;
45825         ser_ref.data = ser->elems;
45826         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
45827         *ret_conv = ErrorMessage_read(ser_ref);
45828         FREE(ser);
45829         return tag_ptr(ret_conv, true);
45830 }
45831
45832 int8_tArray  __attribute__((export_name("TS_WarningMessage_write"))) TS_WarningMessage_write(uint64_t obj) {
45833         LDKWarningMessage obj_conv;
45834         obj_conv.inner = untag_ptr(obj);
45835         obj_conv.is_owned = ptr_is_owned(obj);
45836         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45837         obj_conv.is_owned = false;
45838         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
45839         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45840         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45841         CVec_u8Z_free(ret_var);
45842         return ret_arr;
45843 }
45844
45845 uint64_t  __attribute__((export_name("TS_WarningMessage_read"))) TS_WarningMessage_read(int8_tArray ser) {
45846         LDKu8slice ser_ref;
45847         ser_ref.datalen = ser->arr_len;
45848         ser_ref.data = ser->elems;
45849         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
45850         *ret_conv = WarningMessage_read(ser_ref);
45851         FREE(ser);
45852         return tag_ptr(ret_conv, true);
45853 }
45854
45855 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_write"))) TS_UnsignedNodeAnnouncement_write(uint64_t obj) {
45856         LDKUnsignedNodeAnnouncement obj_conv;
45857         obj_conv.inner = untag_ptr(obj);
45858         obj_conv.is_owned = ptr_is_owned(obj);
45859         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45860         obj_conv.is_owned = false;
45861         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
45862         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45863         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45864         CVec_u8Z_free(ret_var);
45865         return ret_arr;
45866 }
45867
45868 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_read"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
45869         LDKu8slice ser_ref;
45870         ser_ref.datalen = ser->arr_len;
45871         ser_ref.data = ser->elems;
45872         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
45873         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
45874         FREE(ser);
45875         return tag_ptr(ret_conv, true);
45876 }
45877
45878 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_write"))) TS_NodeAnnouncement_write(uint64_t obj) {
45879         LDKNodeAnnouncement obj_conv;
45880         obj_conv.inner = untag_ptr(obj);
45881         obj_conv.is_owned = ptr_is_owned(obj);
45882         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45883         obj_conv.is_owned = false;
45884         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
45885         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45886         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45887         CVec_u8Z_free(ret_var);
45888         return ret_arr;
45889 }
45890
45891 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_read"))) TS_NodeAnnouncement_read(int8_tArray ser) {
45892         LDKu8slice ser_ref;
45893         ser_ref.datalen = ser->arr_len;
45894         ser_ref.data = ser->elems;
45895         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
45896         *ret_conv = NodeAnnouncement_read(ser_ref);
45897         FREE(ser);
45898         return tag_ptr(ret_conv, true);
45899 }
45900
45901 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_read"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
45902         LDKu8slice ser_ref;
45903         ser_ref.datalen = ser->arr_len;
45904         ser_ref.data = ser->elems;
45905         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
45906         *ret_conv = QueryShortChannelIds_read(ser_ref);
45907         FREE(ser);
45908         return tag_ptr(ret_conv, true);
45909 }
45910
45911 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_write"))) TS_QueryShortChannelIds_write(uint64_t obj) {
45912         LDKQueryShortChannelIds obj_conv;
45913         obj_conv.inner = untag_ptr(obj);
45914         obj_conv.is_owned = ptr_is_owned(obj);
45915         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45916         obj_conv.is_owned = false;
45917         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
45918         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45919         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45920         CVec_u8Z_free(ret_var);
45921         return ret_arr;
45922 }
45923
45924 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_write"))) TS_ReplyShortChannelIdsEnd_write(uint64_t obj) {
45925         LDKReplyShortChannelIdsEnd obj_conv;
45926         obj_conv.inner = untag_ptr(obj);
45927         obj_conv.is_owned = ptr_is_owned(obj);
45928         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45929         obj_conv.is_owned = false;
45930         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
45931         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45932         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45933         CVec_u8Z_free(ret_var);
45934         return ret_arr;
45935 }
45936
45937 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_read"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
45938         LDKu8slice ser_ref;
45939         ser_ref.datalen = ser->arr_len;
45940         ser_ref.data = ser->elems;
45941         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
45942         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
45943         FREE(ser);
45944         return tag_ptr(ret_conv, true);
45945 }
45946
45947 int32_t  __attribute__((export_name("TS_QueryChannelRange_end_blocknum"))) TS_QueryChannelRange_end_blocknum(uint64_t this_arg) {
45948         LDKQueryChannelRange this_arg_conv;
45949         this_arg_conv.inner = untag_ptr(this_arg);
45950         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45952         this_arg_conv.is_owned = false;
45953         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
45954         return ret_conv;
45955 }
45956
45957 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_write"))) TS_QueryChannelRange_write(uint64_t obj) {
45958         LDKQueryChannelRange obj_conv;
45959         obj_conv.inner = untag_ptr(obj);
45960         obj_conv.is_owned = ptr_is_owned(obj);
45961         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45962         obj_conv.is_owned = false;
45963         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
45964         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45965         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45966         CVec_u8Z_free(ret_var);
45967         return ret_arr;
45968 }
45969
45970 uint64_t  __attribute__((export_name("TS_QueryChannelRange_read"))) TS_QueryChannelRange_read(int8_tArray ser) {
45971         LDKu8slice ser_ref;
45972         ser_ref.datalen = ser->arr_len;
45973         ser_ref.data = ser->elems;
45974         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
45975         *ret_conv = QueryChannelRange_read(ser_ref);
45976         FREE(ser);
45977         return tag_ptr(ret_conv, true);
45978 }
45979
45980 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_read"))) TS_ReplyChannelRange_read(int8_tArray ser) {
45981         LDKu8slice ser_ref;
45982         ser_ref.datalen = ser->arr_len;
45983         ser_ref.data = ser->elems;
45984         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
45985         *ret_conv = ReplyChannelRange_read(ser_ref);
45986         FREE(ser);
45987         return tag_ptr(ret_conv, true);
45988 }
45989
45990 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_write"))) TS_ReplyChannelRange_write(uint64_t obj) {
45991         LDKReplyChannelRange obj_conv;
45992         obj_conv.inner = untag_ptr(obj);
45993         obj_conv.is_owned = ptr_is_owned(obj);
45994         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45995         obj_conv.is_owned = false;
45996         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
45997         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45998         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45999         CVec_u8Z_free(ret_var);
46000         return ret_arr;
46001 }
46002
46003 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_write"))) TS_GossipTimestampFilter_write(uint64_t obj) {
46004         LDKGossipTimestampFilter obj_conv;
46005         obj_conv.inner = untag_ptr(obj);
46006         obj_conv.is_owned = ptr_is_owned(obj);
46007         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46008         obj_conv.is_owned = false;
46009         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
46010         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46011         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46012         CVec_u8Z_free(ret_var);
46013         return ret_arr;
46014 }
46015
46016 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_read"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
46017         LDKu8slice ser_ref;
46018         ser_ref.datalen = ser->arr_len;
46019         ser_ref.data = ser->elems;
46020         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
46021         *ret_conv = GossipTimestampFilter_read(ser_ref);
46022         FREE(ser);
46023         return tag_ptr(ret_conv, true);
46024 }
46025
46026 void  __attribute__((export_name("TS_CustomMessageHandler_free"))) TS_CustomMessageHandler_free(uint64_t this_ptr) {
46027         if (!ptr_is_owned(this_ptr)) return;
46028         void* this_ptr_ptr = untag_ptr(this_ptr);
46029         CHECK_ACCESS(this_ptr_ptr);
46030         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
46031         FREE(untag_ptr(this_ptr));
46032         CustomMessageHandler_free(this_ptr_conv);
46033 }
46034
46035 void  __attribute__((export_name("TS_IgnoringMessageHandler_free"))) TS_IgnoringMessageHandler_free(uint64_t this_obj) {
46036         LDKIgnoringMessageHandler this_obj_conv;
46037         this_obj_conv.inner = untag_ptr(this_obj);
46038         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46040         IgnoringMessageHandler_free(this_obj_conv);
46041 }
46042
46043 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_new"))) TS_IgnoringMessageHandler_new() {
46044         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
46045         uint64_t ret_ref = 0;
46046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46048         return ret_ref;
46049 }
46050
46051 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_MessageSendEventsProvider"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
46052         LDKIgnoringMessageHandler this_arg_conv;
46053         this_arg_conv.inner = untag_ptr(this_arg);
46054         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46056         this_arg_conv.is_owned = false;
46057         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
46058         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
46059         return tag_ptr(ret_ret, true);
46060 }
46061
46062 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_RoutingMessageHandler"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint64_t this_arg) {
46063         LDKIgnoringMessageHandler this_arg_conv;
46064         this_arg_conv.inner = untag_ptr(this_arg);
46065         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46067         this_arg_conv.is_owned = false;
46068         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
46069         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
46070         return tag_ptr(ret_ret, true);
46071 }
46072
46073 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OnionMessageProvider"))) TS_IgnoringMessageHandler_as_OnionMessageProvider(uint64_t this_arg) {
46074         LDKIgnoringMessageHandler this_arg_conv;
46075         this_arg_conv.inner = untag_ptr(this_arg);
46076         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46078         this_arg_conv.is_owned = false;
46079         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
46080         *ret_ret = IgnoringMessageHandler_as_OnionMessageProvider(&this_arg_conv);
46081         return tag_ptr(ret_ret, true);
46082 }
46083
46084 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OnionMessageHandler"))) TS_IgnoringMessageHandler_as_OnionMessageHandler(uint64_t this_arg) {
46085         LDKIgnoringMessageHandler this_arg_conv;
46086         this_arg_conv.inner = untag_ptr(this_arg);
46087         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46089         this_arg_conv.is_owned = false;
46090         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
46091         *ret_ret = IgnoringMessageHandler_as_OnionMessageHandler(&this_arg_conv);
46092         return tag_ptr(ret_ret, true);
46093 }
46094
46095 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OffersMessageHandler"))) TS_IgnoringMessageHandler_as_OffersMessageHandler(uint64_t this_arg) {
46096         LDKIgnoringMessageHandler this_arg_conv;
46097         this_arg_conv.inner = untag_ptr(this_arg);
46098         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46100         this_arg_conv.is_owned = false;
46101         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
46102         *ret_ret = IgnoringMessageHandler_as_OffersMessageHandler(&this_arg_conv);
46103         return tag_ptr(ret_ret, true);
46104 }
46105
46106 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomOnionMessageHandler"))) TS_IgnoringMessageHandler_as_CustomOnionMessageHandler(uint64_t this_arg) {
46107         LDKIgnoringMessageHandler this_arg_conv;
46108         this_arg_conv.inner = untag_ptr(this_arg);
46109         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46111         this_arg_conv.is_owned = false;
46112         LDKCustomOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
46113         *ret_ret = IgnoringMessageHandler_as_CustomOnionMessageHandler(&this_arg_conv);
46114         return tag_ptr(ret_ret, true);
46115 }
46116
46117 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageReader"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint64_t this_arg) {
46118         LDKIgnoringMessageHandler this_arg_conv;
46119         this_arg_conv.inner = untag_ptr(this_arg);
46120         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46122         this_arg_conv.is_owned = false;
46123         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
46124         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
46125         return tag_ptr(ret_ret, true);
46126 }
46127
46128 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageHandler"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint64_t this_arg) {
46129         LDKIgnoringMessageHandler this_arg_conv;
46130         this_arg_conv.inner = untag_ptr(this_arg);
46131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46133         this_arg_conv.is_owned = false;
46134         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
46135         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
46136         return tag_ptr(ret_ret, true);
46137 }
46138
46139 void  __attribute__((export_name("TS_ErroringMessageHandler_free"))) TS_ErroringMessageHandler_free(uint64_t this_obj) {
46140         LDKErroringMessageHandler this_obj_conv;
46141         this_obj_conv.inner = untag_ptr(this_obj);
46142         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46144         ErroringMessageHandler_free(this_obj_conv);
46145 }
46146
46147 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_new"))) TS_ErroringMessageHandler_new() {
46148         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
46149         uint64_t ret_ref = 0;
46150         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46151         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46152         return ret_ref;
46153 }
46154
46155 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_MessageSendEventsProvider"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
46156         LDKErroringMessageHandler this_arg_conv;
46157         this_arg_conv.inner = untag_ptr(this_arg);
46158         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46160         this_arg_conv.is_owned = false;
46161         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
46162         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
46163         return tag_ptr(ret_ret, true);
46164 }
46165
46166 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_ChannelMessageHandler"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint64_t this_arg) {
46167         LDKErroringMessageHandler this_arg_conv;
46168         this_arg_conv.inner = untag_ptr(this_arg);
46169         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46171         this_arg_conv.is_owned = false;
46172         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
46173         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
46174         return tag_ptr(ret_ret, true);
46175 }
46176
46177 void  __attribute__((export_name("TS_MessageHandler_free"))) TS_MessageHandler_free(uint64_t this_obj) {
46178         LDKMessageHandler this_obj_conv;
46179         this_obj_conv.inner = untag_ptr(this_obj);
46180         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46182         MessageHandler_free(this_obj_conv);
46183 }
46184
46185 uint64_t  __attribute__((export_name("TS_MessageHandler_get_chan_handler"))) TS_MessageHandler_get_chan_handler(uint64_t this_ptr) {
46186         LDKMessageHandler this_ptr_conv;
46187         this_ptr_conv.inner = untag_ptr(this_ptr);
46188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46190         this_ptr_conv.is_owned = false;
46191         // WARNING: This object doesn't live past this scope, needs clone!
46192         uint64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
46193         return ret_ret;
46194 }
46195
46196 void  __attribute__((export_name("TS_MessageHandler_set_chan_handler"))) TS_MessageHandler_set_chan_handler(uint64_t this_ptr, uint64_t val) {
46197         LDKMessageHandler this_ptr_conv;
46198         this_ptr_conv.inner = untag_ptr(this_ptr);
46199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46201         this_ptr_conv.is_owned = false;
46202         void* val_ptr = untag_ptr(val);
46203         CHECK_ACCESS(val_ptr);
46204         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
46205         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
46206                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46207                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
46208         }
46209         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
46210 }
46211
46212 uint64_t  __attribute__((export_name("TS_MessageHandler_get_route_handler"))) TS_MessageHandler_get_route_handler(uint64_t this_ptr) {
46213         LDKMessageHandler this_ptr_conv;
46214         this_ptr_conv.inner = untag_ptr(this_ptr);
46215         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46217         this_ptr_conv.is_owned = false;
46218         // WARNING: This object doesn't live past this scope, needs clone!
46219         uint64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
46220         return ret_ret;
46221 }
46222
46223 void  __attribute__((export_name("TS_MessageHandler_set_route_handler"))) TS_MessageHandler_set_route_handler(uint64_t this_ptr, uint64_t val) {
46224         LDKMessageHandler this_ptr_conv;
46225         this_ptr_conv.inner = untag_ptr(this_ptr);
46226         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46228         this_ptr_conv.is_owned = false;
46229         void* val_ptr = untag_ptr(val);
46230         CHECK_ACCESS(val_ptr);
46231         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
46232         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
46233                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46234                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
46235         }
46236         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
46237 }
46238
46239 uint64_t  __attribute__((export_name("TS_MessageHandler_get_onion_message_handler"))) TS_MessageHandler_get_onion_message_handler(uint64_t this_ptr) {
46240         LDKMessageHandler this_ptr_conv;
46241         this_ptr_conv.inner = untag_ptr(this_ptr);
46242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46244         this_ptr_conv.is_owned = false;
46245         // WARNING: This object doesn't live past this scope, needs clone!
46246         uint64_t ret_ret = tag_ptr(MessageHandler_get_onion_message_handler(&this_ptr_conv), false);
46247         return ret_ret;
46248 }
46249
46250 void  __attribute__((export_name("TS_MessageHandler_set_onion_message_handler"))) TS_MessageHandler_set_onion_message_handler(uint64_t this_ptr, uint64_t val) {
46251         LDKMessageHandler this_ptr_conv;
46252         this_ptr_conv.inner = untag_ptr(this_ptr);
46253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46255         this_ptr_conv.is_owned = false;
46256         void* val_ptr = untag_ptr(val);
46257         CHECK_ACCESS(val_ptr);
46258         LDKOnionMessageHandler val_conv = *(LDKOnionMessageHandler*)(val_ptr);
46259         if (val_conv.free == LDKOnionMessageHandler_JCalls_free) {
46260                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46261                 LDKOnionMessageHandler_JCalls_cloned(&val_conv);
46262         }
46263         MessageHandler_set_onion_message_handler(&this_ptr_conv, val_conv);
46264 }
46265
46266 uint64_t  __attribute__((export_name("TS_MessageHandler_get_custom_message_handler"))) TS_MessageHandler_get_custom_message_handler(uint64_t this_ptr) {
46267         LDKMessageHandler this_ptr_conv;
46268         this_ptr_conv.inner = untag_ptr(this_ptr);
46269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46271         this_ptr_conv.is_owned = false;
46272         // WARNING: This object doesn't live past this scope, needs clone!
46273         uint64_t ret_ret = tag_ptr(MessageHandler_get_custom_message_handler(&this_ptr_conv), false);
46274         return ret_ret;
46275 }
46276
46277 void  __attribute__((export_name("TS_MessageHandler_set_custom_message_handler"))) TS_MessageHandler_set_custom_message_handler(uint64_t this_ptr, uint64_t val) {
46278         LDKMessageHandler this_ptr_conv;
46279         this_ptr_conv.inner = untag_ptr(this_ptr);
46280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46282         this_ptr_conv.is_owned = false;
46283         void* val_ptr = untag_ptr(val);
46284         CHECK_ACCESS(val_ptr);
46285         LDKCustomMessageHandler val_conv = *(LDKCustomMessageHandler*)(val_ptr);
46286         if (val_conv.free == LDKCustomMessageHandler_JCalls_free) {
46287                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46288                 LDKCustomMessageHandler_JCalls_cloned(&val_conv);
46289         }
46290         MessageHandler_set_custom_message_handler(&this_ptr_conv, val_conv);
46291 }
46292
46293 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) {
46294         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
46295         CHECK_ACCESS(chan_handler_arg_ptr);
46296         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
46297         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
46298                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46299                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
46300         }
46301         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
46302         CHECK_ACCESS(route_handler_arg_ptr);
46303         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
46304         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
46305                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46306                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
46307         }
46308         void* onion_message_handler_arg_ptr = untag_ptr(onion_message_handler_arg);
46309         CHECK_ACCESS(onion_message_handler_arg_ptr);
46310         LDKOnionMessageHandler onion_message_handler_arg_conv = *(LDKOnionMessageHandler*)(onion_message_handler_arg_ptr);
46311         if (onion_message_handler_arg_conv.free == LDKOnionMessageHandler_JCalls_free) {
46312                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46313                 LDKOnionMessageHandler_JCalls_cloned(&onion_message_handler_arg_conv);
46314         }
46315         void* custom_message_handler_arg_ptr = untag_ptr(custom_message_handler_arg);
46316         CHECK_ACCESS(custom_message_handler_arg_ptr);
46317         LDKCustomMessageHandler custom_message_handler_arg_conv = *(LDKCustomMessageHandler*)(custom_message_handler_arg_ptr);
46318         if (custom_message_handler_arg_conv.free == LDKCustomMessageHandler_JCalls_free) {
46319                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46320                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_arg_conv);
46321         }
46322         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv, onion_message_handler_arg_conv, custom_message_handler_arg_conv);
46323         uint64_t ret_ref = 0;
46324         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46325         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46326         return ret_ref;
46327 }
46328
46329 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
46330         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
46331         *ret_ret = SocketDescriptor_clone(arg);
46332         return tag_ptr(ret_ret, true);
46333 }
46334 int64_t  __attribute__((export_name("TS_SocketDescriptor_clone_ptr"))) TS_SocketDescriptor_clone_ptr(uint64_t arg) {
46335         void* arg_ptr = untag_ptr(arg);
46336         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
46337         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
46338         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
46339         return ret_conv;
46340 }
46341
46342 uint64_t  __attribute__((export_name("TS_SocketDescriptor_clone"))) TS_SocketDescriptor_clone(uint64_t orig) {
46343         void* orig_ptr = untag_ptr(orig);
46344         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
46345         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
46346         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
46347         *ret_ret = SocketDescriptor_clone(orig_conv);
46348         return tag_ptr(ret_ret, true);
46349 }
46350
46351 void  __attribute__((export_name("TS_SocketDescriptor_free"))) TS_SocketDescriptor_free(uint64_t this_ptr) {
46352         if (!ptr_is_owned(this_ptr)) return;
46353         void* this_ptr_ptr = untag_ptr(this_ptr);
46354         CHECK_ACCESS(this_ptr_ptr);
46355         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
46356         FREE(untag_ptr(this_ptr));
46357         SocketDescriptor_free(this_ptr_conv);
46358 }
46359
46360 void  __attribute__((export_name("TS_PeerHandleError_free"))) TS_PeerHandleError_free(uint64_t this_obj) {
46361         LDKPeerHandleError this_obj_conv;
46362         this_obj_conv.inner = untag_ptr(this_obj);
46363         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46365         PeerHandleError_free(this_obj_conv);
46366 }
46367
46368 uint64_t  __attribute__((export_name("TS_PeerHandleError_new"))) TS_PeerHandleError_new() {
46369         LDKPeerHandleError ret_var = PeerHandleError_new();
46370         uint64_t ret_ref = 0;
46371         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46372         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46373         return ret_ref;
46374 }
46375
46376 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
46377         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
46378         uint64_t ret_ref = 0;
46379         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46380         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46381         return ret_ref;
46382 }
46383 int64_t  __attribute__((export_name("TS_PeerHandleError_clone_ptr"))) TS_PeerHandleError_clone_ptr(uint64_t arg) {
46384         LDKPeerHandleError arg_conv;
46385         arg_conv.inner = untag_ptr(arg);
46386         arg_conv.is_owned = ptr_is_owned(arg);
46387         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46388         arg_conv.is_owned = false;
46389         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
46390         return ret_conv;
46391 }
46392
46393 uint64_t  __attribute__((export_name("TS_PeerHandleError_clone"))) TS_PeerHandleError_clone(uint64_t orig) {
46394         LDKPeerHandleError orig_conv;
46395         orig_conv.inner = untag_ptr(orig);
46396         orig_conv.is_owned = ptr_is_owned(orig);
46397         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46398         orig_conv.is_owned = false;
46399         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
46400         uint64_t ret_ref = 0;
46401         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46402         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46403         return ret_ref;
46404 }
46405
46406 void  __attribute__((export_name("TS_PeerManager_free"))) TS_PeerManager_free(uint64_t this_obj) {
46407         LDKPeerManager this_obj_conv;
46408         this_obj_conv.inner = untag_ptr(this_obj);
46409         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46411         PeerManager_free(this_obj_conv);
46412 }
46413
46414 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) {
46415         LDKMessageHandler message_handler_conv;
46416         message_handler_conv.inner = untag_ptr(message_handler);
46417         message_handler_conv.is_owned = ptr_is_owned(message_handler);
46418         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
46419         // WARNING: we need a move here but no clone is available for LDKMessageHandler
46420         
46421         uint8_t ephemeral_random_data_arr[32];
46422         CHECK(ephemeral_random_data->arr_len == 32);
46423         memcpy(ephemeral_random_data_arr, ephemeral_random_data->elems, 32); FREE(ephemeral_random_data);
46424         uint8_t (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
46425         void* logger_ptr = untag_ptr(logger);
46426         CHECK_ACCESS(logger_ptr);
46427         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
46428         if (logger_conv.free == LDKLogger_JCalls_free) {
46429                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46430                 LDKLogger_JCalls_cloned(&logger_conv);
46431         }
46432         void* node_signer_ptr = untag_ptr(node_signer);
46433         CHECK_ACCESS(node_signer_ptr);
46434         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
46435         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
46436                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46437                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
46438         }
46439         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, current_time, ephemeral_random_data_ref, logger_conv, node_signer_conv);
46440         uint64_t ret_ref = 0;
46441         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46442         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46443         return ret_ref;
46444 }
46445
46446 uint64_tArray  __attribute__((export_name("TS_PeerManager_get_peer_node_ids"))) TS_PeerManager_get_peer_node_ids(uint64_t this_arg) {
46447         LDKPeerManager this_arg_conv;
46448         this_arg_conv.inner = untag_ptr(this_arg);
46449         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46451         this_arg_conv.is_owned = false;
46452         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
46453         uint64_tArray ret_arr = NULL;
46454         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
46455         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
46456         for (size_t r = 0; r < ret_var.datalen; r++) {
46457                 LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv_43_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
46458                 *ret_conv_43_conv = ret_var.data[r];
46459                 ret_arr_ptr[r] = tag_ptr(ret_conv_43_conv, true);
46460         }
46461         
46462         FREE(ret_var.data);
46463         return ret_arr;
46464 }
46465
46466 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) {
46467         LDKPeerManager this_arg_conv;
46468         this_arg_conv.inner = untag_ptr(this_arg);
46469         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46471         this_arg_conv.is_owned = false;
46472         LDKPublicKey their_node_id_ref;
46473         CHECK(their_node_id->arr_len == 33);
46474         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
46475         void* descriptor_ptr = untag_ptr(descriptor);
46476         CHECK_ACCESS(descriptor_ptr);
46477         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
46478         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
46479                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46480                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
46481         }
46482         void* remote_network_address_ptr = untag_ptr(remote_network_address);
46483         CHECK_ACCESS(remote_network_address_ptr);
46484         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
46485         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
46486         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
46487         return tag_ptr(ret_conv, true);
46488 }
46489
46490 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) {
46491         LDKPeerManager this_arg_conv;
46492         this_arg_conv.inner = untag_ptr(this_arg);
46493         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46495         this_arg_conv.is_owned = false;
46496         void* descriptor_ptr = untag_ptr(descriptor);
46497         CHECK_ACCESS(descriptor_ptr);
46498         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
46499         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
46500                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46501                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
46502         }
46503         void* remote_network_address_ptr = untag_ptr(remote_network_address);
46504         CHECK_ACCESS(remote_network_address_ptr);
46505         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
46506         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
46507         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
46508         return tag_ptr(ret_conv, true);
46509 }
46510
46511 uint64_t  __attribute__((export_name("TS_PeerManager_write_buffer_space_avail"))) TS_PeerManager_write_buffer_space_avail(uint64_t this_arg, uint64_t descriptor) {
46512         LDKPeerManager this_arg_conv;
46513         this_arg_conv.inner = untag_ptr(this_arg);
46514         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46516         this_arg_conv.is_owned = false;
46517         void* descriptor_ptr = untag_ptr(descriptor);
46518         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
46519         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
46520         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
46521         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
46522         return tag_ptr(ret_conv, true);
46523 }
46524
46525 uint64_t  __attribute__((export_name("TS_PeerManager_read_event"))) TS_PeerManager_read_event(uint64_t this_arg, uint64_t peer_descriptor, int8_tArray data) {
46526         LDKPeerManager this_arg_conv;
46527         this_arg_conv.inner = untag_ptr(this_arg);
46528         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46530         this_arg_conv.is_owned = false;
46531         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
46532         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
46533         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
46534         LDKu8slice data_ref;
46535         data_ref.datalen = data->arr_len;
46536         data_ref.data = data->elems;
46537         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
46538         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
46539         FREE(data);
46540         return tag_ptr(ret_conv, true);
46541 }
46542
46543 void  __attribute__((export_name("TS_PeerManager_process_events"))) TS_PeerManager_process_events(uint64_t this_arg) {
46544         LDKPeerManager this_arg_conv;
46545         this_arg_conv.inner = untag_ptr(this_arg);
46546         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46548         this_arg_conv.is_owned = false;
46549         PeerManager_process_events(&this_arg_conv);
46550 }
46551
46552 void  __attribute__((export_name("TS_PeerManager_socket_disconnected"))) TS_PeerManager_socket_disconnected(uint64_t this_arg, uint64_t descriptor) {
46553         LDKPeerManager this_arg_conv;
46554         this_arg_conv.inner = untag_ptr(this_arg);
46555         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46557         this_arg_conv.is_owned = false;
46558         void* descriptor_ptr = untag_ptr(descriptor);
46559         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
46560         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
46561         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
46562 }
46563
46564 void  __attribute__((export_name("TS_PeerManager_disconnect_by_node_id"))) TS_PeerManager_disconnect_by_node_id(uint64_t this_arg, int8_tArray node_id) {
46565         LDKPeerManager this_arg_conv;
46566         this_arg_conv.inner = untag_ptr(this_arg);
46567         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46569         this_arg_conv.is_owned = false;
46570         LDKPublicKey node_id_ref;
46571         CHECK(node_id->arr_len == 33);
46572         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
46573         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref);
46574 }
46575
46576 void  __attribute__((export_name("TS_PeerManager_disconnect_all_peers"))) TS_PeerManager_disconnect_all_peers(uint64_t this_arg) {
46577         LDKPeerManager this_arg_conv;
46578         this_arg_conv.inner = untag_ptr(this_arg);
46579         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46581         this_arg_conv.is_owned = false;
46582         PeerManager_disconnect_all_peers(&this_arg_conv);
46583 }
46584
46585 void  __attribute__((export_name("TS_PeerManager_timer_tick_occurred"))) TS_PeerManager_timer_tick_occurred(uint64_t this_arg) {
46586         LDKPeerManager this_arg_conv;
46587         this_arg_conv.inner = untag_ptr(this_arg);
46588         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46590         this_arg_conv.is_owned = false;
46591         PeerManager_timer_tick_occurred(&this_arg_conv);
46592 }
46593
46594 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) {
46595         LDKPeerManager this_arg_conv;
46596         this_arg_conv.inner = untag_ptr(this_arg);
46597         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46599         this_arg_conv.is_owned = false;
46600         LDKThreeBytes rgb_ref;
46601         CHECK(rgb->arr_len == 3);
46602         memcpy(rgb_ref.data, rgb->elems, 3); FREE(rgb);
46603         LDKThirtyTwoBytes alias_ref;
46604         CHECK(alias->arr_len == 32);
46605         memcpy(alias_ref.data, alias->elems, 32); FREE(alias);
46606         LDKCVec_SocketAddressZ addresses_constr;
46607         addresses_constr.datalen = addresses->arr_len;
46608         if (addresses_constr.datalen > 0)
46609                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
46610         else
46611                 addresses_constr.data = NULL;
46612         uint64_t* addresses_vals = addresses->elems;
46613         for (size_t p = 0; p < addresses_constr.datalen; p++) {
46614                 uint64_t addresses_conv_15 = addresses_vals[p];
46615                 void* addresses_conv_15_ptr = untag_ptr(addresses_conv_15);
46616                 CHECK_ACCESS(addresses_conv_15_ptr);
46617                 LDKSocketAddress addresses_conv_15_conv = *(LDKSocketAddress*)(addresses_conv_15_ptr);
46618                 addresses_constr.data[p] = addresses_conv_15_conv;
46619         }
46620         FREE(addresses);
46621         PeerManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
46622 }
46623
46624 int64_t  __attribute__((export_name("TS_htlc_success_tx_weight"))) TS_htlc_success_tx_weight(uint64_t channel_type_features) {
46625         LDKChannelTypeFeatures channel_type_features_conv;
46626         channel_type_features_conv.inner = untag_ptr(channel_type_features);
46627         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
46628         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
46629         channel_type_features_conv.is_owned = false;
46630         int64_t ret_conv = htlc_success_tx_weight(&channel_type_features_conv);
46631         return ret_conv;
46632 }
46633
46634 int64_t  __attribute__((export_name("TS_htlc_timeout_tx_weight"))) TS_htlc_timeout_tx_weight(uint64_t channel_type_features) {
46635         LDKChannelTypeFeatures channel_type_features_conv;
46636         channel_type_features_conv.inner = untag_ptr(channel_type_features);
46637         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
46638         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
46639         channel_type_features_conv.is_owned = false;
46640         int64_t ret_conv = htlc_timeout_tx_weight(&channel_type_features_conv);
46641         return ret_conv;
46642 }
46643
46644 uint32_t  __attribute__((export_name("TS_HTLCClaim_clone"))) TS_HTLCClaim_clone(uint64_t orig) {
46645         LDKHTLCClaim* orig_conv = (LDKHTLCClaim*)untag_ptr(orig);
46646         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_clone(orig_conv));
46647         return ret_conv;
46648 }
46649
46650 uint32_t  __attribute__((export_name("TS_HTLCClaim_offered_timeout"))) TS_HTLCClaim_offered_timeout() {
46651         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_offered_timeout());
46652         return ret_conv;
46653 }
46654
46655 uint32_t  __attribute__((export_name("TS_HTLCClaim_offered_preimage"))) TS_HTLCClaim_offered_preimage() {
46656         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_offered_preimage());
46657         return ret_conv;
46658 }
46659
46660 uint32_t  __attribute__((export_name("TS_HTLCClaim_accepted_timeout"))) TS_HTLCClaim_accepted_timeout() {
46661         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_accepted_timeout());
46662         return ret_conv;
46663 }
46664
46665 uint32_t  __attribute__((export_name("TS_HTLCClaim_accepted_preimage"))) TS_HTLCClaim_accepted_preimage() {
46666         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_accepted_preimage());
46667         return ret_conv;
46668 }
46669
46670 uint32_t  __attribute__((export_name("TS_HTLCClaim_revocation"))) TS_HTLCClaim_revocation() {
46671         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_revocation());
46672         return ret_conv;
46673 }
46674
46675 jboolean  __attribute__((export_name("TS_HTLCClaim_eq"))) TS_HTLCClaim_eq(uint64_t a, uint64_t b) {
46676         LDKHTLCClaim* a_conv = (LDKHTLCClaim*)untag_ptr(a);
46677         LDKHTLCClaim* b_conv = (LDKHTLCClaim*)untag_ptr(b);
46678         jboolean ret_conv = HTLCClaim_eq(a_conv, b_conv);
46679         return ret_conv;
46680 }
46681
46682 uint64_t  __attribute__((export_name("TS_HTLCClaim_from_witness"))) TS_HTLCClaim_from_witness(int8_tArray witness) {
46683         LDKWitness witness_ref;
46684         witness_ref.datalen = witness->arr_len;
46685         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
46686         memcpy(witness_ref.data, witness->elems, witness_ref.datalen); FREE(witness);
46687         witness_ref.data_is_owned = true;
46688         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
46689         *ret_copy = HTLCClaim_from_witness(witness_ref);
46690         uint64_t ret_ref = tag_ptr(ret_copy, true);
46691         return ret_ref;
46692 }
46693
46694 int8_tArray  __attribute__((export_name("TS_build_commitment_secret"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
46695         uint8_t commitment_seed_arr[32];
46696         CHECK(commitment_seed->arr_len == 32);
46697         memcpy(commitment_seed_arr, commitment_seed->elems, 32); FREE(commitment_seed);
46698         uint8_t (*commitment_seed_ref)[32] = &commitment_seed_arr;
46699         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46700         memcpy(ret_arr->elems, build_commitment_secret(commitment_seed_ref, idx).data, 32);
46701         return ret_arr;
46702 }
46703
46704 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) {
46705         LDKCVec_u8Z to_holder_script_ref;
46706         to_holder_script_ref.datalen = to_holder_script->arr_len;
46707         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
46708         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
46709         LDKCVec_u8Z to_counterparty_script_ref;
46710         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
46711         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
46712         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
46713         LDKOutPoint funding_outpoint_conv;
46714         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
46715         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
46716         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
46717         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
46718         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);
46719         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46720         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46721         Transaction_free(ret_var);
46722         return ret_arr;
46723 }
46724
46725 void  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_free"))) TS_CounterpartyCommitmentSecrets_free(uint64_t this_obj) {
46726         LDKCounterpartyCommitmentSecrets this_obj_conv;
46727         this_obj_conv.inner = untag_ptr(this_obj);
46728         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46730         CounterpartyCommitmentSecrets_free(this_obj_conv);
46731 }
46732
46733 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
46734         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
46735         uint64_t ret_ref = 0;
46736         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46737         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46738         return ret_ref;
46739 }
46740 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone_ptr"))) TS_CounterpartyCommitmentSecrets_clone_ptr(uint64_t arg) {
46741         LDKCounterpartyCommitmentSecrets arg_conv;
46742         arg_conv.inner = untag_ptr(arg);
46743         arg_conv.is_owned = ptr_is_owned(arg);
46744         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46745         arg_conv.is_owned = false;
46746         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
46747         return ret_conv;
46748 }
46749
46750 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone"))) TS_CounterpartyCommitmentSecrets_clone(uint64_t orig) {
46751         LDKCounterpartyCommitmentSecrets orig_conv;
46752         orig_conv.inner = untag_ptr(orig);
46753         orig_conv.is_owned = ptr_is_owned(orig);
46754         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46755         orig_conv.is_owned = false;
46756         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
46757         uint64_t ret_ref = 0;
46758         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46759         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46760         return ret_ref;
46761 }
46762
46763 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_new"))) TS_CounterpartyCommitmentSecrets_new() {
46764         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
46765         uint64_t ret_ref = 0;
46766         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46767         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46768         return ret_ref;
46769 }
46770
46771 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_min_seen_secret"))) TS_CounterpartyCommitmentSecrets_get_min_seen_secret(uint64_t this_arg) {
46772         LDKCounterpartyCommitmentSecrets this_arg_conv;
46773         this_arg_conv.inner = untag_ptr(this_arg);
46774         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46776         this_arg_conv.is_owned = false;
46777         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
46778         return ret_conv;
46779 }
46780
46781 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_provide_secret"))) TS_CounterpartyCommitmentSecrets_provide_secret(uint64_t this_arg, int64_t idx, int8_tArray secret) {
46782         LDKCounterpartyCommitmentSecrets this_arg_conv;
46783         this_arg_conv.inner = untag_ptr(this_arg);
46784         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46786         this_arg_conv.is_owned = false;
46787         LDKThirtyTwoBytes secret_ref;
46788         CHECK(secret->arr_len == 32);
46789         memcpy(secret_ref.data, secret->elems, 32); FREE(secret);
46790         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
46791         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
46792         return tag_ptr(ret_conv, true);
46793 }
46794
46795 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_secret"))) TS_CounterpartyCommitmentSecrets_get_secret(uint64_t this_arg, int64_t idx) {
46796         LDKCounterpartyCommitmentSecrets this_arg_conv;
46797         this_arg_conv.inner = untag_ptr(this_arg);
46798         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46800         this_arg_conv.is_owned = false;
46801         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46802         memcpy(ret_arr->elems, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data, 32);
46803         return ret_arr;
46804 }
46805
46806 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_write"))) TS_CounterpartyCommitmentSecrets_write(uint64_t obj) {
46807         LDKCounterpartyCommitmentSecrets obj_conv;
46808         obj_conv.inner = untag_ptr(obj);
46809         obj_conv.is_owned = ptr_is_owned(obj);
46810         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46811         obj_conv.is_owned = false;
46812         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
46813         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46814         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46815         CVec_u8Z_free(ret_var);
46816         return ret_arr;
46817 }
46818
46819 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_read"))) TS_CounterpartyCommitmentSecrets_read(int8_tArray ser) {
46820         LDKu8slice ser_ref;
46821         ser_ref.datalen = ser->arr_len;
46822         ser_ref.data = ser->elems;
46823         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
46824         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
46825         FREE(ser);
46826         return tag_ptr(ret_conv, true);
46827 }
46828
46829 int8_tArray  __attribute__((export_name("TS_derive_private_key"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
46830         LDKPublicKey per_commitment_point_ref;
46831         CHECK(per_commitment_point->arr_len == 33);
46832         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
46833         uint8_t base_secret_arr[32];
46834         CHECK(base_secret->arr_len == 32);
46835         memcpy(base_secret_arr, base_secret->elems, 32); FREE(base_secret);
46836         uint8_t (*base_secret_ref)[32] = &base_secret_arr;
46837         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46838         memcpy(ret_arr->elems, derive_private_key(per_commitment_point_ref, base_secret_ref).bytes, 32);
46839         return ret_arr;
46840 }
46841
46842 int8_tArray  __attribute__((export_name("TS_derive_public_key"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
46843         LDKPublicKey per_commitment_point_ref;
46844         CHECK(per_commitment_point->arr_len == 33);
46845         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
46846         LDKPublicKey base_point_ref;
46847         CHECK(base_point->arr_len == 33);
46848         memcpy(base_point_ref.compressed_form, base_point->elems, 33); FREE(base_point);
46849         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46850         memcpy(ret_arr->elems, derive_public_key(per_commitment_point_ref, base_point_ref).compressed_form, 33);
46851         return ret_arr;
46852 }
46853
46854 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) {
46855         uint8_t per_commitment_secret_arr[32];
46856         CHECK(per_commitment_secret->arr_len == 32);
46857         memcpy(per_commitment_secret_arr, per_commitment_secret->elems, 32); FREE(per_commitment_secret);
46858         uint8_t (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
46859         uint8_t countersignatory_revocation_base_secret_arr[32];
46860         CHECK(countersignatory_revocation_base_secret->arr_len == 32);
46861         memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret->elems, 32); FREE(countersignatory_revocation_base_secret);
46862         uint8_t (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
46863         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46864         memcpy(ret_arr->elems, derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref).bytes, 32);
46865         return ret_arr;
46866 }
46867
46868 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) {
46869         LDKPublicKey per_commitment_point_ref;
46870         CHECK(per_commitment_point->arr_len == 33);
46871         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
46872         LDKPublicKey countersignatory_revocation_base_point_ref;
46873         CHECK(countersignatory_revocation_base_point->arr_len == 33);
46874         memcpy(countersignatory_revocation_base_point_ref.compressed_form, countersignatory_revocation_base_point->elems, 33); FREE(countersignatory_revocation_base_point);
46875         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46876         memcpy(ret_arr->elems, derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref).compressed_form, 33);
46877         return ret_arr;
46878 }
46879
46880 void  __attribute__((export_name("TS_TxCreationKeys_free"))) TS_TxCreationKeys_free(uint64_t this_obj) {
46881         LDKTxCreationKeys this_obj_conv;
46882         this_obj_conv.inner = untag_ptr(this_obj);
46883         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46885         TxCreationKeys_free(this_obj_conv);
46886 }
46887
46888 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_per_commitment_point"))) TS_TxCreationKeys_get_per_commitment_point(uint64_t this_ptr) {
46889         LDKTxCreationKeys this_ptr_conv;
46890         this_ptr_conv.inner = untag_ptr(this_ptr);
46891         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46893         this_ptr_conv.is_owned = false;
46894         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46895         memcpy(ret_arr->elems, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
46896         return ret_arr;
46897 }
46898
46899 void  __attribute__((export_name("TS_TxCreationKeys_set_per_commitment_point"))) TS_TxCreationKeys_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
46900         LDKTxCreationKeys this_ptr_conv;
46901         this_ptr_conv.inner = untag_ptr(this_ptr);
46902         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46904         this_ptr_conv.is_owned = false;
46905         LDKPublicKey val_ref;
46906         CHECK(val->arr_len == 33);
46907         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46908         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
46909 }
46910
46911 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_revocation_key"))) TS_TxCreationKeys_get_revocation_key(uint64_t this_ptr) {
46912         LDKTxCreationKeys this_ptr_conv;
46913         this_ptr_conv.inner = untag_ptr(this_ptr);
46914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46916         this_ptr_conv.is_owned = false;
46917         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46918         memcpy(ret_arr->elems, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
46919         return ret_arr;
46920 }
46921
46922 void  __attribute__((export_name("TS_TxCreationKeys_set_revocation_key"))) TS_TxCreationKeys_set_revocation_key(uint64_t this_ptr, int8_tArray val) {
46923         LDKTxCreationKeys this_ptr_conv;
46924         this_ptr_conv.inner = untag_ptr(this_ptr);
46925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46927         this_ptr_conv.is_owned = false;
46928         LDKPublicKey val_ref;
46929         CHECK(val->arr_len == 33);
46930         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46931         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
46932 }
46933
46934 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_htlc_key"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint64_t this_ptr) {
46935         LDKTxCreationKeys this_ptr_conv;
46936         this_ptr_conv.inner = untag_ptr(this_ptr);
46937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46939         this_ptr_conv.is_owned = false;
46940         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46941         memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
46942         return ret_arr;
46943 }
46944
46945 void  __attribute__((export_name("TS_TxCreationKeys_set_broadcaster_htlc_key"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint64_t this_ptr, int8_tArray val) {
46946         LDKTxCreationKeys this_ptr_conv;
46947         this_ptr_conv.inner = untag_ptr(this_ptr);
46948         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46950         this_ptr_conv.is_owned = false;
46951         LDKPublicKey val_ref;
46952         CHECK(val->arr_len == 33);
46953         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46954         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
46955 }
46956
46957 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_countersignatory_htlc_key"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint64_t this_ptr) {
46958         LDKTxCreationKeys this_ptr_conv;
46959         this_ptr_conv.inner = untag_ptr(this_ptr);
46960         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46962         this_ptr_conv.is_owned = false;
46963         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46964         memcpy(ret_arr->elems, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
46965         return ret_arr;
46966 }
46967
46968 void  __attribute__((export_name("TS_TxCreationKeys_set_countersignatory_htlc_key"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint64_t this_ptr, int8_tArray val) {
46969         LDKTxCreationKeys this_ptr_conv;
46970         this_ptr_conv.inner = untag_ptr(this_ptr);
46971         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46973         this_ptr_conv.is_owned = false;
46974         LDKPublicKey val_ref;
46975         CHECK(val->arr_len == 33);
46976         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46977         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
46978 }
46979
46980 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_delayed_payment_key"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint64_t this_ptr) {
46981         LDKTxCreationKeys this_ptr_conv;
46982         this_ptr_conv.inner = untag_ptr(this_ptr);
46983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46985         this_ptr_conv.is_owned = false;
46986         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46987         memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
46988         return ret_arr;
46989 }
46990
46991 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) {
46992         LDKTxCreationKeys this_ptr_conv;
46993         this_ptr_conv.inner = untag_ptr(this_ptr);
46994         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46996         this_ptr_conv.is_owned = false;
46997         LDKPublicKey val_ref;
46998         CHECK(val->arr_len == 33);
46999         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47000         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
47001 }
47002
47003 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) {
47004         LDKPublicKey per_commitment_point_arg_ref;
47005         CHECK(per_commitment_point_arg->arr_len == 33);
47006         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
47007         LDKPublicKey revocation_key_arg_ref;
47008         CHECK(revocation_key_arg->arr_len == 33);
47009         memcpy(revocation_key_arg_ref.compressed_form, revocation_key_arg->elems, 33); FREE(revocation_key_arg);
47010         LDKPublicKey broadcaster_htlc_key_arg_ref;
47011         CHECK(broadcaster_htlc_key_arg->arr_len == 33);
47012         memcpy(broadcaster_htlc_key_arg_ref.compressed_form, broadcaster_htlc_key_arg->elems, 33); FREE(broadcaster_htlc_key_arg);
47013         LDKPublicKey countersignatory_htlc_key_arg_ref;
47014         CHECK(countersignatory_htlc_key_arg->arr_len == 33);
47015         memcpy(countersignatory_htlc_key_arg_ref.compressed_form, countersignatory_htlc_key_arg->elems, 33); FREE(countersignatory_htlc_key_arg);
47016         LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
47017         CHECK(broadcaster_delayed_payment_key_arg->arr_len == 33);
47018         memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, broadcaster_delayed_payment_key_arg->elems, 33); FREE(broadcaster_delayed_payment_key_arg);
47019         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);
47020         uint64_t ret_ref = 0;
47021         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47022         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47023         return ret_ref;
47024 }
47025
47026 jboolean  __attribute__((export_name("TS_TxCreationKeys_eq"))) TS_TxCreationKeys_eq(uint64_t a, uint64_t b) {
47027         LDKTxCreationKeys a_conv;
47028         a_conv.inner = untag_ptr(a);
47029         a_conv.is_owned = ptr_is_owned(a);
47030         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47031         a_conv.is_owned = false;
47032         LDKTxCreationKeys b_conv;
47033         b_conv.inner = untag_ptr(b);
47034         b_conv.is_owned = ptr_is_owned(b);
47035         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47036         b_conv.is_owned = false;
47037         jboolean ret_conv = TxCreationKeys_eq(&a_conv, &b_conv);
47038         return ret_conv;
47039 }
47040
47041 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
47042         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
47043         uint64_t ret_ref = 0;
47044         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47045         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47046         return ret_ref;
47047 }
47048 int64_t  __attribute__((export_name("TS_TxCreationKeys_clone_ptr"))) TS_TxCreationKeys_clone_ptr(uint64_t arg) {
47049         LDKTxCreationKeys arg_conv;
47050         arg_conv.inner = untag_ptr(arg);
47051         arg_conv.is_owned = ptr_is_owned(arg);
47052         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47053         arg_conv.is_owned = false;
47054         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
47055         return ret_conv;
47056 }
47057
47058 uint64_t  __attribute__((export_name("TS_TxCreationKeys_clone"))) TS_TxCreationKeys_clone(uint64_t orig) {
47059         LDKTxCreationKeys orig_conv;
47060         orig_conv.inner = untag_ptr(orig);
47061         orig_conv.is_owned = ptr_is_owned(orig);
47062         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47063         orig_conv.is_owned = false;
47064         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
47065         uint64_t ret_ref = 0;
47066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47068         return ret_ref;
47069 }
47070
47071 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_write"))) TS_TxCreationKeys_write(uint64_t obj) {
47072         LDKTxCreationKeys obj_conv;
47073         obj_conv.inner = untag_ptr(obj);
47074         obj_conv.is_owned = ptr_is_owned(obj);
47075         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47076         obj_conv.is_owned = false;
47077         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
47078         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47079         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47080         CVec_u8Z_free(ret_var);
47081         return ret_arr;
47082 }
47083
47084 uint64_t  __attribute__((export_name("TS_TxCreationKeys_read"))) TS_TxCreationKeys_read(int8_tArray ser) {
47085         LDKu8slice ser_ref;
47086         ser_ref.datalen = ser->arr_len;
47087         ser_ref.data = ser->elems;
47088         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
47089         *ret_conv = TxCreationKeys_read(ser_ref);
47090         FREE(ser);
47091         return tag_ptr(ret_conv, true);
47092 }
47093
47094 void  __attribute__((export_name("TS_ChannelPublicKeys_free"))) TS_ChannelPublicKeys_free(uint64_t this_obj) {
47095         LDKChannelPublicKeys this_obj_conv;
47096         this_obj_conv.inner = untag_ptr(this_obj);
47097         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47099         ChannelPublicKeys_free(this_obj_conv);
47100 }
47101
47102 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_funding_pubkey"))) TS_ChannelPublicKeys_get_funding_pubkey(uint64_t this_ptr) {
47103         LDKChannelPublicKeys this_ptr_conv;
47104         this_ptr_conv.inner = untag_ptr(this_ptr);
47105         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47107         this_ptr_conv.is_owned = false;
47108         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47109         memcpy(ret_arr->elems, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
47110         return ret_arr;
47111 }
47112
47113 void  __attribute__((export_name("TS_ChannelPublicKeys_set_funding_pubkey"))) TS_ChannelPublicKeys_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
47114         LDKChannelPublicKeys this_ptr_conv;
47115         this_ptr_conv.inner = untag_ptr(this_ptr);
47116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47118         this_ptr_conv.is_owned = false;
47119         LDKPublicKey val_ref;
47120         CHECK(val->arr_len == 33);
47121         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47122         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
47123 }
47124
47125 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_revocation_basepoint"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint64_t this_ptr) {
47126         LDKChannelPublicKeys this_ptr_conv;
47127         this_ptr_conv.inner = untag_ptr(this_ptr);
47128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47130         this_ptr_conv.is_owned = false;
47131         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47132         memcpy(ret_arr->elems, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
47133         return ret_arr;
47134 }
47135
47136 void  __attribute__((export_name("TS_ChannelPublicKeys_set_revocation_basepoint"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
47137         LDKChannelPublicKeys this_ptr_conv;
47138         this_ptr_conv.inner = untag_ptr(this_ptr);
47139         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47141         this_ptr_conv.is_owned = false;
47142         LDKPublicKey val_ref;
47143         CHECK(val->arr_len == 33);
47144         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47145         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
47146 }
47147
47148 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_payment_point"))) TS_ChannelPublicKeys_get_payment_point(uint64_t this_ptr) {
47149         LDKChannelPublicKeys this_ptr_conv;
47150         this_ptr_conv.inner = untag_ptr(this_ptr);
47151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47153         this_ptr_conv.is_owned = false;
47154         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47155         memcpy(ret_arr->elems, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
47156         return ret_arr;
47157 }
47158
47159 void  __attribute__((export_name("TS_ChannelPublicKeys_set_payment_point"))) TS_ChannelPublicKeys_set_payment_point(uint64_t this_ptr, int8_tArray val) {
47160         LDKChannelPublicKeys this_ptr_conv;
47161         this_ptr_conv.inner = untag_ptr(this_ptr);
47162         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47164         this_ptr_conv.is_owned = false;
47165         LDKPublicKey val_ref;
47166         CHECK(val->arr_len == 33);
47167         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47168         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
47169 }
47170
47171 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_delayed_payment_basepoint"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint64_t this_ptr) {
47172         LDKChannelPublicKeys this_ptr_conv;
47173         this_ptr_conv.inner = untag_ptr(this_ptr);
47174         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47176         this_ptr_conv.is_owned = false;
47177         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47178         memcpy(ret_arr->elems, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
47179         return ret_arr;
47180 }
47181
47182 void  __attribute__((export_name("TS_ChannelPublicKeys_set_delayed_payment_basepoint"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
47183         LDKChannelPublicKeys this_ptr_conv;
47184         this_ptr_conv.inner = untag_ptr(this_ptr);
47185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47187         this_ptr_conv.is_owned = false;
47188         LDKPublicKey val_ref;
47189         CHECK(val->arr_len == 33);
47190         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47191         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
47192 }
47193
47194 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_htlc_basepoint"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint64_t this_ptr) {
47195         LDKChannelPublicKeys this_ptr_conv;
47196         this_ptr_conv.inner = untag_ptr(this_ptr);
47197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47199         this_ptr_conv.is_owned = false;
47200         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47201         memcpy(ret_arr->elems, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
47202         return ret_arr;
47203 }
47204
47205 void  __attribute__((export_name("TS_ChannelPublicKeys_set_htlc_basepoint"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
47206         LDKChannelPublicKeys this_ptr_conv;
47207         this_ptr_conv.inner = untag_ptr(this_ptr);
47208         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47210         this_ptr_conv.is_owned = false;
47211         LDKPublicKey val_ref;
47212         CHECK(val->arr_len == 33);
47213         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47214         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
47215 }
47216
47217 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) {
47218         LDKPublicKey funding_pubkey_arg_ref;
47219         CHECK(funding_pubkey_arg->arr_len == 33);
47220         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
47221         LDKPublicKey revocation_basepoint_arg_ref;
47222         CHECK(revocation_basepoint_arg->arr_len == 33);
47223         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
47224         LDKPublicKey payment_point_arg_ref;
47225         CHECK(payment_point_arg->arr_len == 33);
47226         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
47227         LDKPublicKey delayed_payment_basepoint_arg_ref;
47228         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
47229         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
47230         LDKPublicKey htlc_basepoint_arg_ref;
47231         CHECK(htlc_basepoint_arg->arr_len == 33);
47232         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
47233         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);
47234         uint64_t ret_ref = 0;
47235         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47236         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47237         return ret_ref;
47238 }
47239
47240 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
47241         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
47242         uint64_t ret_ref = 0;
47243         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47244         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47245         return ret_ref;
47246 }
47247 int64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone_ptr"))) TS_ChannelPublicKeys_clone_ptr(uint64_t arg) {
47248         LDKChannelPublicKeys arg_conv;
47249         arg_conv.inner = untag_ptr(arg);
47250         arg_conv.is_owned = ptr_is_owned(arg);
47251         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47252         arg_conv.is_owned = false;
47253         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
47254         return ret_conv;
47255 }
47256
47257 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone"))) TS_ChannelPublicKeys_clone(uint64_t orig) {
47258         LDKChannelPublicKeys orig_conv;
47259         orig_conv.inner = untag_ptr(orig);
47260         orig_conv.is_owned = ptr_is_owned(orig);
47261         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47262         orig_conv.is_owned = false;
47263         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
47264         uint64_t ret_ref = 0;
47265         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47266         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47267         return ret_ref;
47268 }
47269
47270 int64_t  __attribute__((export_name("TS_ChannelPublicKeys_hash"))) TS_ChannelPublicKeys_hash(uint64_t o) {
47271         LDKChannelPublicKeys o_conv;
47272         o_conv.inner = untag_ptr(o);
47273         o_conv.is_owned = ptr_is_owned(o);
47274         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47275         o_conv.is_owned = false;
47276         int64_t ret_conv = ChannelPublicKeys_hash(&o_conv);
47277         return ret_conv;
47278 }
47279
47280 jboolean  __attribute__((export_name("TS_ChannelPublicKeys_eq"))) TS_ChannelPublicKeys_eq(uint64_t a, uint64_t b) {
47281         LDKChannelPublicKeys a_conv;
47282         a_conv.inner = untag_ptr(a);
47283         a_conv.is_owned = ptr_is_owned(a);
47284         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47285         a_conv.is_owned = false;
47286         LDKChannelPublicKeys b_conv;
47287         b_conv.inner = untag_ptr(b);
47288         b_conv.is_owned = ptr_is_owned(b);
47289         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47290         b_conv.is_owned = false;
47291         jboolean ret_conv = ChannelPublicKeys_eq(&a_conv, &b_conv);
47292         return ret_conv;
47293 }
47294
47295 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_write"))) TS_ChannelPublicKeys_write(uint64_t obj) {
47296         LDKChannelPublicKeys obj_conv;
47297         obj_conv.inner = untag_ptr(obj);
47298         obj_conv.is_owned = ptr_is_owned(obj);
47299         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47300         obj_conv.is_owned = false;
47301         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
47302         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47303         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47304         CVec_u8Z_free(ret_var);
47305         return ret_arr;
47306 }
47307
47308 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_read"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
47309         LDKu8slice ser_ref;
47310         ser_ref.datalen = ser->arr_len;
47311         ser_ref.data = ser->elems;
47312         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
47313         *ret_conv = ChannelPublicKeys_read(ser_ref);
47314         FREE(ser);
47315         return tag_ptr(ret_conv, true);
47316 }
47317
47318 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) {
47319         LDKPublicKey per_commitment_point_ref;
47320         CHECK(per_commitment_point->arr_len == 33);
47321         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
47322         LDKPublicKey broadcaster_delayed_payment_base_ref;
47323         CHECK(broadcaster_delayed_payment_base->arr_len == 33);
47324         memcpy(broadcaster_delayed_payment_base_ref.compressed_form, broadcaster_delayed_payment_base->elems, 33); FREE(broadcaster_delayed_payment_base);
47325         LDKPublicKey broadcaster_htlc_base_ref;
47326         CHECK(broadcaster_htlc_base->arr_len == 33);
47327         memcpy(broadcaster_htlc_base_ref.compressed_form, broadcaster_htlc_base->elems, 33); FREE(broadcaster_htlc_base);
47328         LDKPublicKey countersignatory_revocation_base_ref;
47329         CHECK(countersignatory_revocation_base->arr_len == 33);
47330         memcpy(countersignatory_revocation_base_ref.compressed_form, countersignatory_revocation_base->elems, 33); FREE(countersignatory_revocation_base);
47331         LDKPublicKey countersignatory_htlc_base_ref;
47332         CHECK(countersignatory_htlc_base->arr_len == 33);
47333         memcpy(countersignatory_htlc_base_ref.compressed_form, countersignatory_htlc_base->elems, 33); FREE(countersignatory_htlc_base);
47334         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);
47335         uint64_t ret_ref = 0;
47336         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47337         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47338         return ret_ref;
47339 }
47340
47341 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) {
47342         LDKPublicKey per_commitment_point_ref;
47343         CHECK(per_commitment_point->arr_len == 33);
47344         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
47345         LDKChannelPublicKeys broadcaster_keys_conv;
47346         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
47347         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
47348         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
47349         broadcaster_keys_conv.is_owned = false;
47350         LDKChannelPublicKeys countersignatory_keys_conv;
47351         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
47352         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
47353         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
47354         countersignatory_keys_conv.is_owned = false;
47355         LDKTxCreationKeys ret_var = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
47356         uint64_t ret_ref = 0;
47357         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47358         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47359         return ret_ref;
47360 }
47361
47362 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) {
47363         LDKPublicKey revocation_key_ref;
47364         CHECK(revocation_key->arr_len == 33);
47365         memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
47366         LDKPublicKey broadcaster_delayed_payment_key_ref;
47367         CHECK(broadcaster_delayed_payment_key->arr_len == 33);
47368         memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
47369         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
47370         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47371         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47372         CVec_u8Z_free(ret_var);
47373         return ret_arr;
47374 }
47375
47376 int8_tArray  __attribute__((export_name("TS_get_counterparty_payment_script"))) TS_get_counterparty_payment_script(uint64_t channel_type_features, int8_tArray payment_key) {
47377         LDKChannelTypeFeatures channel_type_features_conv;
47378         channel_type_features_conv.inner = untag_ptr(channel_type_features);
47379         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
47380         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
47381         channel_type_features_conv.is_owned = false;
47382         LDKPublicKey payment_key_ref;
47383         CHECK(payment_key->arr_len == 33);
47384         memcpy(payment_key_ref.compressed_form, payment_key->elems, 33); FREE(payment_key);
47385         LDKCVec_u8Z ret_var = get_counterparty_payment_script(&channel_type_features_conv, payment_key_ref);
47386         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47387         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47388         CVec_u8Z_free(ret_var);
47389         return ret_arr;
47390 }
47391
47392 void  __attribute__((export_name("TS_HTLCOutputInCommitment_free"))) TS_HTLCOutputInCommitment_free(uint64_t this_obj) {
47393         LDKHTLCOutputInCommitment this_obj_conv;
47394         this_obj_conv.inner = untag_ptr(this_obj);
47395         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47397         HTLCOutputInCommitment_free(this_obj_conv);
47398 }
47399
47400 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_get_offered"))) TS_HTLCOutputInCommitment_get_offered(uint64_t this_ptr) {
47401         LDKHTLCOutputInCommitment this_ptr_conv;
47402         this_ptr_conv.inner = untag_ptr(this_ptr);
47403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47405         this_ptr_conv.is_owned = false;
47406         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
47407         return ret_conv;
47408 }
47409
47410 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_offered"))) TS_HTLCOutputInCommitment_set_offered(uint64_t this_ptr, jboolean val) {
47411         LDKHTLCOutputInCommitment this_ptr_conv;
47412         this_ptr_conv.inner = untag_ptr(this_ptr);
47413         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47415         this_ptr_conv.is_owned = false;
47416         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
47417 }
47418
47419 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_amount_msat"))) TS_HTLCOutputInCommitment_get_amount_msat(uint64_t this_ptr) {
47420         LDKHTLCOutputInCommitment this_ptr_conv;
47421         this_ptr_conv.inner = untag_ptr(this_ptr);
47422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47424         this_ptr_conv.is_owned = false;
47425         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
47426         return ret_conv;
47427 }
47428
47429 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_amount_msat"))) TS_HTLCOutputInCommitment_set_amount_msat(uint64_t this_ptr, int64_t val) {
47430         LDKHTLCOutputInCommitment this_ptr_conv;
47431         this_ptr_conv.inner = untag_ptr(this_ptr);
47432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47434         this_ptr_conv.is_owned = false;
47435         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
47436 }
47437
47438 int32_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_cltv_expiry"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint64_t this_ptr) {
47439         LDKHTLCOutputInCommitment this_ptr_conv;
47440         this_ptr_conv.inner = untag_ptr(this_ptr);
47441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47443         this_ptr_conv.is_owned = false;
47444         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
47445         return ret_conv;
47446 }
47447
47448 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_cltv_expiry"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
47449         LDKHTLCOutputInCommitment this_ptr_conv;
47450         this_ptr_conv.inner = untag_ptr(this_ptr);
47451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47453         this_ptr_conv.is_owned = false;
47454         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
47455 }
47456
47457 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_get_payment_hash"))) TS_HTLCOutputInCommitment_get_payment_hash(uint64_t this_ptr) {
47458         LDKHTLCOutputInCommitment this_ptr_conv;
47459         this_ptr_conv.inner = untag_ptr(this_ptr);
47460         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47462         this_ptr_conv.is_owned = false;
47463         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47464         memcpy(ret_arr->elems, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
47465         return ret_arr;
47466 }
47467
47468 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_payment_hash"))) TS_HTLCOutputInCommitment_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
47469         LDKHTLCOutputInCommitment this_ptr_conv;
47470         this_ptr_conv.inner = untag_ptr(this_ptr);
47471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47473         this_ptr_conv.is_owned = false;
47474         LDKThirtyTwoBytes val_ref;
47475         CHECK(val->arr_len == 32);
47476         memcpy(val_ref.data, val->elems, 32); FREE(val);
47477         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
47478 }
47479
47480 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_transaction_output_index"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint64_t this_ptr) {
47481         LDKHTLCOutputInCommitment this_ptr_conv;
47482         this_ptr_conv.inner = untag_ptr(this_ptr);
47483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47485         this_ptr_conv.is_owned = false;
47486         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
47487         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
47488         uint64_t ret_ref = tag_ptr(ret_copy, true);
47489         return ret_ref;
47490 }
47491
47492 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_transaction_output_index"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint64_t this_ptr, uint64_t val) {
47493         LDKHTLCOutputInCommitment this_ptr_conv;
47494         this_ptr_conv.inner = untag_ptr(this_ptr);
47495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47497         this_ptr_conv.is_owned = false;
47498         void* val_ptr = untag_ptr(val);
47499         CHECK_ACCESS(val_ptr);
47500         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
47501         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
47502         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
47503 }
47504
47505 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) {
47506         LDKThirtyTwoBytes payment_hash_arg_ref;
47507         CHECK(payment_hash_arg->arr_len == 32);
47508         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
47509         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
47510         CHECK_ACCESS(transaction_output_index_arg_ptr);
47511         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
47512         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
47513         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
47514         uint64_t ret_ref = 0;
47515         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47516         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47517         return ret_ref;
47518 }
47519
47520 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
47521         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
47522         uint64_t ret_ref = 0;
47523         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47524         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47525         return ret_ref;
47526 }
47527 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone_ptr"))) TS_HTLCOutputInCommitment_clone_ptr(uint64_t arg) {
47528         LDKHTLCOutputInCommitment arg_conv;
47529         arg_conv.inner = untag_ptr(arg);
47530         arg_conv.is_owned = ptr_is_owned(arg);
47531         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47532         arg_conv.is_owned = false;
47533         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
47534         return ret_conv;
47535 }
47536
47537 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone"))) TS_HTLCOutputInCommitment_clone(uint64_t orig) {
47538         LDKHTLCOutputInCommitment orig_conv;
47539         orig_conv.inner = untag_ptr(orig);
47540         orig_conv.is_owned = ptr_is_owned(orig);
47541         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47542         orig_conv.is_owned = false;
47543         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
47544         uint64_t ret_ref = 0;
47545         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47546         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47547         return ret_ref;
47548 }
47549
47550 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_eq"))) TS_HTLCOutputInCommitment_eq(uint64_t a, uint64_t b) {
47551         LDKHTLCOutputInCommitment a_conv;
47552         a_conv.inner = untag_ptr(a);
47553         a_conv.is_owned = ptr_is_owned(a);
47554         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47555         a_conv.is_owned = false;
47556         LDKHTLCOutputInCommitment b_conv;
47557         b_conv.inner = untag_ptr(b);
47558         b_conv.is_owned = ptr_is_owned(b);
47559         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47560         b_conv.is_owned = false;
47561         jboolean ret_conv = HTLCOutputInCommitment_eq(&a_conv, &b_conv);
47562         return ret_conv;
47563 }
47564
47565 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_write"))) TS_HTLCOutputInCommitment_write(uint64_t obj) {
47566         LDKHTLCOutputInCommitment obj_conv;
47567         obj_conv.inner = untag_ptr(obj);
47568         obj_conv.is_owned = ptr_is_owned(obj);
47569         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47570         obj_conv.is_owned = false;
47571         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
47572         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47573         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47574         CVec_u8Z_free(ret_var);
47575         return ret_arr;
47576 }
47577
47578 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_read"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
47579         LDKu8slice ser_ref;
47580         ser_ref.datalen = ser->arr_len;
47581         ser_ref.data = ser->elems;
47582         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
47583         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
47584         FREE(ser);
47585         return tag_ptr(ret_conv, true);
47586 }
47587
47588 int8_tArray  __attribute__((export_name("TS_get_htlc_redeemscript"))) TS_get_htlc_redeemscript(uint64_t htlc, uint64_t channel_type_features, uint64_t keys) {
47589         LDKHTLCOutputInCommitment htlc_conv;
47590         htlc_conv.inner = untag_ptr(htlc);
47591         htlc_conv.is_owned = ptr_is_owned(htlc);
47592         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
47593         htlc_conv.is_owned = false;
47594         LDKChannelTypeFeatures channel_type_features_conv;
47595         channel_type_features_conv.inner = untag_ptr(channel_type_features);
47596         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
47597         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
47598         channel_type_features_conv.is_owned = false;
47599         LDKTxCreationKeys keys_conv;
47600         keys_conv.inner = untag_ptr(keys);
47601         keys_conv.is_owned = ptr_is_owned(keys);
47602         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
47603         keys_conv.is_owned = false;
47604         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &channel_type_features_conv, &keys_conv);
47605         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47606         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47607         CVec_u8Z_free(ret_var);
47608         return ret_arr;
47609 }
47610
47611 int8_tArray  __attribute__((export_name("TS_make_funding_redeemscript"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
47612         LDKPublicKey broadcaster_ref;
47613         CHECK(broadcaster->arr_len == 33);
47614         memcpy(broadcaster_ref.compressed_form, broadcaster->elems, 33); FREE(broadcaster);
47615         LDKPublicKey countersignatory_ref;
47616         CHECK(countersignatory->arr_len == 33);
47617         memcpy(countersignatory_ref.compressed_form, countersignatory->elems, 33); FREE(countersignatory);
47618         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
47619         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47620         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47621         CVec_u8Z_free(ret_var);
47622         return ret_arr;
47623 }
47624
47625 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) {
47626         uint8_t commitment_txid_arr[32];
47627         CHECK(commitment_txid->arr_len == 32);
47628         memcpy(commitment_txid_arr, commitment_txid->elems, 32); FREE(commitment_txid);
47629         uint8_t (*commitment_txid_ref)[32] = &commitment_txid_arr;
47630         LDKHTLCOutputInCommitment htlc_conv;
47631         htlc_conv.inner = untag_ptr(htlc);
47632         htlc_conv.is_owned = ptr_is_owned(htlc);
47633         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
47634         htlc_conv.is_owned = false;
47635         LDKChannelTypeFeatures channel_type_features_conv;
47636         channel_type_features_conv.inner = untag_ptr(channel_type_features);
47637         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
47638         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
47639         channel_type_features_conv.is_owned = false;
47640         LDKPublicKey broadcaster_delayed_payment_key_ref;
47641         CHECK(broadcaster_delayed_payment_key->arr_len == 33);
47642         memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
47643         LDKPublicKey revocation_key_ref;
47644         CHECK(revocation_key->arr_len == 33);
47645         memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
47646         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);
47647         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47648         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47649         Transaction_free(ret_var);
47650         return ret_arr;
47651 }
47652
47653 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) {
47654         LDKECDSASignature local_sig_ref;
47655         CHECK(local_sig->arr_len == 64);
47656         memcpy(local_sig_ref.compact_form, local_sig->elems, 64); FREE(local_sig);
47657         LDKECDSASignature remote_sig_ref;
47658         CHECK(remote_sig->arr_len == 64);
47659         memcpy(remote_sig_ref.compact_form, remote_sig->elems, 64); FREE(remote_sig);
47660         void* preimage_ptr = untag_ptr(preimage);
47661         CHECK_ACCESS(preimage_ptr);
47662         LDKCOption_ThirtyTwoBytesZ preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(preimage_ptr);
47663         preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(preimage));
47664         LDKu8slice redeem_script_ref;
47665         redeem_script_ref.datalen = redeem_script->arr_len;
47666         redeem_script_ref.data = redeem_script->elems;
47667         LDKChannelTypeFeatures channel_type_features_conv;
47668         channel_type_features_conv.inner = untag_ptr(channel_type_features);
47669         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
47670         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
47671         channel_type_features_conv.is_owned = false;
47672         LDKWitness ret_var = build_htlc_input_witness(local_sig_ref, remote_sig_ref, preimage_conv, redeem_script_ref, &channel_type_features_conv);
47673         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47674         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47675         Witness_free(ret_var);
47676         FREE(redeem_script);
47677         return ret_arr;
47678 }
47679
47680 int8_tArray  __attribute__((export_name("TS_get_to_countersignatory_with_anchors_redeemscript"))) TS_get_to_countersignatory_with_anchors_redeemscript(int8_tArray payment_point) {
47681         LDKPublicKey payment_point_ref;
47682         CHECK(payment_point->arr_len == 33);
47683         memcpy(payment_point_ref.compressed_form, payment_point->elems, 33); FREE(payment_point);
47684         LDKCVec_u8Z ret_var = get_to_countersignatory_with_anchors_redeemscript(payment_point_ref);
47685         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47686         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47687         CVec_u8Z_free(ret_var);
47688         return ret_arr;
47689 }
47690
47691 int8_tArray  __attribute__((export_name("TS_get_anchor_redeemscript"))) TS_get_anchor_redeemscript(int8_tArray funding_pubkey) {
47692         LDKPublicKey funding_pubkey_ref;
47693         CHECK(funding_pubkey->arr_len == 33);
47694         memcpy(funding_pubkey_ref.compressed_form, funding_pubkey->elems, 33); FREE(funding_pubkey);
47695         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
47696         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47697         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47698         CVec_u8Z_free(ret_var);
47699         return ret_arr;
47700 }
47701
47702 int8_tArray  __attribute__((export_name("TS_build_anchor_input_witness"))) TS_build_anchor_input_witness(int8_tArray funding_key, int8_tArray funding_sig) {
47703         LDKPublicKey funding_key_ref;
47704         CHECK(funding_key->arr_len == 33);
47705         memcpy(funding_key_ref.compressed_form, funding_key->elems, 33); FREE(funding_key);
47706         LDKECDSASignature funding_sig_ref;
47707         CHECK(funding_sig->arr_len == 64);
47708         memcpy(funding_sig_ref.compact_form, funding_sig->elems, 64); FREE(funding_sig);
47709         LDKWitness ret_var = build_anchor_input_witness(funding_key_ref, funding_sig_ref);
47710         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47711         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47712         Witness_free(ret_var);
47713         return ret_arr;
47714 }
47715
47716 void  __attribute__((export_name("TS_ChannelTransactionParameters_free"))) TS_ChannelTransactionParameters_free(uint64_t this_obj) {
47717         LDKChannelTransactionParameters this_obj_conv;
47718         this_obj_conv.inner = untag_ptr(this_obj);
47719         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47721         ChannelTransactionParameters_free(this_obj_conv);
47722 }
47723
47724 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_pubkeys"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint64_t this_ptr) {
47725         LDKChannelTransactionParameters this_ptr_conv;
47726         this_ptr_conv.inner = untag_ptr(this_ptr);
47727         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47729         this_ptr_conv.is_owned = false;
47730         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
47731         uint64_t ret_ref = 0;
47732         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47733         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47734         return ret_ref;
47735 }
47736
47737 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_holder_pubkeys"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint64_t this_ptr, uint64_t val) {
47738         LDKChannelTransactionParameters this_ptr_conv;
47739         this_ptr_conv.inner = untag_ptr(this_ptr);
47740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47742         this_ptr_conv.is_owned = false;
47743         LDKChannelPublicKeys val_conv;
47744         val_conv.inner = untag_ptr(val);
47745         val_conv.is_owned = ptr_is_owned(val);
47746         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47747         val_conv = ChannelPublicKeys_clone(&val_conv);
47748         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
47749 }
47750
47751 int16_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_selected_contest_delay"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint64_t this_ptr) {
47752         LDKChannelTransactionParameters this_ptr_conv;
47753         this_ptr_conv.inner = untag_ptr(this_ptr);
47754         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47756         this_ptr_conv.is_owned = false;
47757         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
47758         return ret_conv;
47759 }
47760
47761 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) {
47762         LDKChannelTransactionParameters this_ptr_conv;
47763         this_ptr_conv.inner = untag_ptr(this_ptr);
47764         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47766         this_ptr_conv.is_owned = false;
47767         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
47768 }
47769
47770 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_get_is_outbound_from_holder"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint64_t this_ptr) {
47771         LDKChannelTransactionParameters this_ptr_conv;
47772         this_ptr_conv.inner = untag_ptr(this_ptr);
47773         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47775         this_ptr_conv.is_owned = false;
47776         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
47777         return ret_conv;
47778 }
47779
47780 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_is_outbound_from_holder"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint64_t this_ptr, jboolean val) {
47781         LDKChannelTransactionParameters this_ptr_conv;
47782         this_ptr_conv.inner = untag_ptr(this_ptr);
47783         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47785         this_ptr_conv.is_owned = false;
47786         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
47787 }
47788
47789 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_counterparty_parameters"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint64_t this_ptr) {
47790         LDKChannelTransactionParameters this_ptr_conv;
47791         this_ptr_conv.inner = untag_ptr(this_ptr);
47792         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47794         this_ptr_conv.is_owned = false;
47795         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
47796         uint64_t ret_ref = 0;
47797         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47798         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47799         return ret_ref;
47800 }
47801
47802 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_counterparty_parameters"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint64_t this_ptr, uint64_t val) {
47803         LDKChannelTransactionParameters this_ptr_conv;
47804         this_ptr_conv.inner = untag_ptr(this_ptr);
47805         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47807         this_ptr_conv.is_owned = false;
47808         LDKCounterpartyChannelTransactionParameters val_conv;
47809         val_conv.inner = untag_ptr(val);
47810         val_conv.is_owned = ptr_is_owned(val);
47811         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47812         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
47813         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
47814 }
47815
47816 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_funding_outpoint"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint64_t this_ptr) {
47817         LDKChannelTransactionParameters this_ptr_conv;
47818         this_ptr_conv.inner = untag_ptr(this_ptr);
47819         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47821         this_ptr_conv.is_owned = false;
47822         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
47823         uint64_t ret_ref = 0;
47824         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47825         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47826         return ret_ref;
47827 }
47828
47829 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_funding_outpoint"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint64_t this_ptr, uint64_t val) {
47830         LDKChannelTransactionParameters this_ptr_conv;
47831         this_ptr_conv.inner = untag_ptr(this_ptr);
47832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47834         this_ptr_conv.is_owned = false;
47835         LDKOutPoint val_conv;
47836         val_conv.inner = untag_ptr(val);
47837         val_conv.is_owned = ptr_is_owned(val);
47838         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47839         val_conv = OutPoint_clone(&val_conv);
47840         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
47841 }
47842
47843 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_channel_type_features"))) TS_ChannelTransactionParameters_get_channel_type_features(uint64_t this_ptr) {
47844         LDKChannelTransactionParameters this_ptr_conv;
47845         this_ptr_conv.inner = untag_ptr(this_ptr);
47846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47848         this_ptr_conv.is_owned = false;
47849         LDKChannelTypeFeatures ret_var = ChannelTransactionParameters_get_channel_type_features(&this_ptr_conv);
47850         uint64_t ret_ref = 0;
47851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47853         return ret_ref;
47854 }
47855
47856 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_channel_type_features"))) TS_ChannelTransactionParameters_set_channel_type_features(uint64_t this_ptr, uint64_t val) {
47857         LDKChannelTransactionParameters this_ptr_conv;
47858         this_ptr_conv.inner = untag_ptr(this_ptr);
47859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47861         this_ptr_conv.is_owned = false;
47862         LDKChannelTypeFeatures val_conv;
47863         val_conv.inner = untag_ptr(val);
47864         val_conv.is_owned = ptr_is_owned(val);
47865         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47866         val_conv = ChannelTypeFeatures_clone(&val_conv);
47867         ChannelTransactionParameters_set_channel_type_features(&this_ptr_conv, val_conv);
47868 }
47869
47870 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) {
47871         LDKChannelPublicKeys holder_pubkeys_arg_conv;
47872         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
47873         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
47874         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
47875         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
47876         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
47877         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
47878         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
47879         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
47880         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
47881         LDKOutPoint funding_outpoint_arg_conv;
47882         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
47883         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
47884         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
47885         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
47886         LDKChannelTypeFeatures channel_type_features_arg_conv;
47887         channel_type_features_arg_conv.inner = untag_ptr(channel_type_features_arg);
47888         channel_type_features_arg_conv.is_owned = ptr_is_owned(channel_type_features_arg);
47889         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_arg_conv);
47890         channel_type_features_arg_conv = ChannelTypeFeatures_clone(&channel_type_features_arg_conv);
47891         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);
47892         uint64_t ret_ref = 0;
47893         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47894         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47895         return ret_ref;
47896 }
47897
47898 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
47899         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
47900         uint64_t ret_ref = 0;
47901         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47902         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47903         return ret_ref;
47904 }
47905 int64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone_ptr"))) TS_ChannelTransactionParameters_clone_ptr(uint64_t arg) {
47906         LDKChannelTransactionParameters arg_conv;
47907         arg_conv.inner = untag_ptr(arg);
47908         arg_conv.is_owned = ptr_is_owned(arg);
47909         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47910         arg_conv.is_owned = false;
47911         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
47912         return ret_conv;
47913 }
47914
47915 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone"))) TS_ChannelTransactionParameters_clone(uint64_t orig) {
47916         LDKChannelTransactionParameters orig_conv;
47917         orig_conv.inner = untag_ptr(orig);
47918         orig_conv.is_owned = ptr_is_owned(orig);
47919         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47920         orig_conv.is_owned = false;
47921         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
47922         uint64_t ret_ref = 0;
47923         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47924         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47925         return ret_ref;
47926 }
47927
47928 int64_t  __attribute__((export_name("TS_ChannelTransactionParameters_hash"))) TS_ChannelTransactionParameters_hash(uint64_t o) {
47929         LDKChannelTransactionParameters o_conv;
47930         o_conv.inner = untag_ptr(o);
47931         o_conv.is_owned = ptr_is_owned(o);
47932         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47933         o_conv.is_owned = false;
47934         int64_t ret_conv = ChannelTransactionParameters_hash(&o_conv);
47935         return ret_conv;
47936 }
47937
47938 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_eq"))) TS_ChannelTransactionParameters_eq(uint64_t a, uint64_t b) {
47939         LDKChannelTransactionParameters a_conv;
47940         a_conv.inner = untag_ptr(a);
47941         a_conv.is_owned = ptr_is_owned(a);
47942         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47943         a_conv.is_owned = false;
47944         LDKChannelTransactionParameters b_conv;
47945         b_conv.inner = untag_ptr(b);
47946         b_conv.is_owned = ptr_is_owned(b);
47947         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47948         b_conv.is_owned = false;
47949         jboolean ret_conv = ChannelTransactionParameters_eq(&a_conv, &b_conv);
47950         return ret_conv;
47951 }
47952
47953 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_free"))) TS_CounterpartyChannelTransactionParameters_free(uint64_t this_obj) {
47954         LDKCounterpartyChannelTransactionParameters this_obj_conv;
47955         this_obj_conv.inner = untag_ptr(this_obj);
47956         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47958         CounterpartyChannelTransactionParameters_free(this_obj_conv);
47959 }
47960
47961 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_pubkeys"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint64_t this_ptr) {
47962         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
47963         this_ptr_conv.inner = untag_ptr(this_ptr);
47964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47966         this_ptr_conv.is_owned = false;
47967         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
47968         uint64_t ret_ref = 0;
47969         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47970         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47971         return ret_ref;
47972 }
47973
47974 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_pubkeys"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint64_t this_ptr, uint64_t val) {
47975         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
47976         this_ptr_conv.inner = untag_ptr(this_ptr);
47977         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47979         this_ptr_conv.is_owned = false;
47980         LDKChannelPublicKeys val_conv;
47981         val_conv.inner = untag_ptr(val);
47982         val_conv.is_owned = ptr_is_owned(val);
47983         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47984         val_conv = ChannelPublicKeys_clone(&val_conv);
47985         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
47986 }
47987
47988 int16_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint64_t this_ptr) {
47989         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
47990         this_ptr_conv.inner = untag_ptr(this_ptr);
47991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47993         this_ptr_conv.is_owned = false;
47994         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
47995         return ret_conv;
47996 }
47997
47998 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint64_t this_ptr, int16_t val) {
47999         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
48000         this_ptr_conv.inner = untag_ptr(this_ptr);
48001         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48003         this_ptr_conv.is_owned = false;
48004         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
48005 }
48006
48007 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_new"))) TS_CounterpartyChannelTransactionParameters_new(uint64_t pubkeys_arg, int16_t selected_contest_delay_arg) {
48008         LDKChannelPublicKeys pubkeys_arg_conv;
48009         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
48010         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
48011         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
48012         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
48013         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
48014         uint64_t ret_ref = 0;
48015         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48016         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48017         return ret_ref;
48018 }
48019
48020 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
48021         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
48022         uint64_t ret_ref = 0;
48023         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48024         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48025         return ret_ref;
48026 }
48027 int64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone_ptr"))) TS_CounterpartyChannelTransactionParameters_clone_ptr(uint64_t arg) {
48028         LDKCounterpartyChannelTransactionParameters arg_conv;
48029         arg_conv.inner = untag_ptr(arg);
48030         arg_conv.is_owned = ptr_is_owned(arg);
48031         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48032         arg_conv.is_owned = false;
48033         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
48034         return ret_conv;
48035 }
48036
48037 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone"))) TS_CounterpartyChannelTransactionParameters_clone(uint64_t orig) {
48038         LDKCounterpartyChannelTransactionParameters orig_conv;
48039         orig_conv.inner = untag_ptr(orig);
48040         orig_conv.is_owned = ptr_is_owned(orig);
48041         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48042         orig_conv.is_owned = false;
48043         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
48044         uint64_t ret_ref = 0;
48045         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48046         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48047         return ret_ref;
48048 }
48049
48050 int64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_hash"))) TS_CounterpartyChannelTransactionParameters_hash(uint64_t o) {
48051         LDKCounterpartyChannelTransactionParameters o_conv;
48052         o_conv.inner = untag_ptr(o);
48053         o_conv.is_owned = ptr_is_owned(o);
48054         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48055         o_conv.is_owned = false;
48056         int64_t ret_conv = CounterpartyChannelTransactionParameters_hash(&o_conv);
48057         return ret_conv;
48058 }
48059
48060 jboolean  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_eq"))) TS_CounterpartyChannelTransactionParameters_eq(uint64_t a, uint64_t b) {
48061         LDKCounterpartyChannelTransactionParameters a_conv;
48062         a_conv.inner = untag_ptr(a);
48063         a_conv.is_owned = ptr_is_owned(a);
48064         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48065         a_conv.is_owned = false;
48066         LDKCounterpartyChannelTransactionParameters b_conv;
48067         b_conv.inner = untag_ptr(b);
48068         b_conv.is_owned = ptr_is_owned(b);
48069         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48070         b_conv.is_owned = false;
48071         jboolean ret_conv = CounterpartyChannelTransactionParameters_eq(&a_conv, &b_conv);
48072         return ret_conv;
48073 }
48074
48075 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_is_populated"))) TS_ChannelTransactionParameters_is_populated(uint64_t this_arg) {
48076         LDKChannelTransactionParameters this_arg_conv;
48077         this_arg_conv.inner = untag_ptr(this_arg);
48078         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48080         this_arg_conv.is_owned = false;
48081         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
48082         return ret_conv;
48083 }
48084
48085 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_holder_broadcastable"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint64_t this_arg) {
48086         LDKChannelTransactionParameters this_arg_conv;
48087         this_arg_conv.inner = untag_ptr(this_arg);
48088         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48090         this_arg_conv.is_owned = false;
48091         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
48092         uint64_t ret_ref = 0;
48093         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48094         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48095         return ret_ref;
48096 }
48097
48098 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_counterparty_broadcastable"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint64_t this_arg) {
48099         LDKChannelTransactionParameters this_arg_conv;
48100         this_arg_conv.inner = untag_ptr(this_arg);
48101         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48103         this_arg_conv.is_owned = false;
48104         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
48105         uint64_t ret_ref = 0;
48106         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48107         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48108         return ret_ref;
48109 }
48110
48111 int8_tArray  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_write"))) TS_CounterpartyChannelTransactionParameters_write(uint64_t obj) {
48112         LDKCounterpartyChannelTransactionParameters obj_conv;
48113         obj_conv.inner = untag_ptr(obj);
48114         obj_conv.is_owned = ptr_is_owned(obj);
48115         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48116         obj_conv.is_owned = false;
48117         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
48118         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48119         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48120         CVec_u8Z_free(ret_var);
48121         return ret_arr;
48122 }
48123
48124 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_read"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
48125         LDKu8slice ser_ref;
48126         ser_ref.datalen = ser->arr_len;
48127         ser_ref.data = ser->elems;
48128         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
48129         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
48130         FREE(ser);
48131         return tag_ptr(ret_conv, true);
48132 }
48133
48134 int8_tArray  __attribute__((export_name("TS_ChannelTransactionParameters_write"))) TS_ChannelTransactionParameters_write(uint64_t obj) {
48135         LDKChannelTransactionParameters obj_conv;
48136         obj_conv.inner = untag_ptr(obj);
48137         obj_conv.is_owned = ptr_is_owned(obj);
48138         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48139         obj_conv.is_owned = false;
48140         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
48141         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48142         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48143         CVec_u8Z_free(ret_var);
48144         return ret_arr;
48145 }
48146
48147 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_read"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
48148         LDKu8slice ser_ref;
48149         ser_ref.datalen = ser->arr_len;
48150         ser_ref.data = ser->elems;
48151         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
48152         *ret_conv = ChannelTransactionParameters_read(ser_ref);
48153         FREE(ser);
48154         return tag_ptr(ret_conv, true);
48155 }
48156
48157 void  __attribute__((export_name("TS_DirectedChannelTransactionParameters_free"))) TS_DirectedChannelTransactionParameters_free(uint64_t this_obj) {
48158         LDKDirectedChannelTransactionParameters this_obj_conv;
48159         this_obj_conv.inner = untag_ptr(this_obj);
48160         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48162         DirectedChannelTransactionParameters_free(this_obj_conv);
48163 }
48164
48165 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_broadcaster_pubkeys"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint64_t this_arg) {
48166         LDKDirectedChannelTransactionParameters this_arg_conv;
48167         this_arg_conv.inner = untag_ptr(this_arg);
48168         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48170         this_arg_conv.is_owned = false;
48171         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
48172         uint64_t ret_ref = 0;
48173         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48174         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48175         return ret_ref;
48176 }
48177
48178 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_countersignatory_pubkeys"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint64_t this_arg) {
48179         LDKDirectedChannelTransactionParameters this_arg_conv;
48180         this_arg_conv.inner = untag_ptr(this_arg);
48181         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48183         this_arg_conv.is_owned = false;
48184         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
48185         uint64_t ret_ref = 0;
48186         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48187         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48188         return ret_ref;
48189 }
48190
48191 int16_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_contest_delay"))) TS_DirectedChannelTransactionParameters_contest_delay(uint64_t this_arg) {
48192         LDKDirectedChannelTransactionParameters this_arg_conv;
48193         this_arg_conv.inner = untag_ptr(this_arg);
48194         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48196         this_arg_conv.is_owned = false;
48197         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
48198         return ret_conv;
48199 }
48200
48201 jboolean  __attribute__((export_name("TS_DirectedChannelTransactionParameters_is_outbound"))) TS_DirectedChannelTransactionParameters_is_outbound(uint64_t this_arg) {
48202         LDKDirectedChannelTransactionParameters this_arg_conv;
48203         this_arg_conv.inner = untag_ptr(this_arg);
48204         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48206         this_arg_conv.is_owned = false;
48207         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
48208         return ret_conv;
48209 }
48210
48211 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_funding_outpoint"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint64_t this_arg) {
48212         LDKDirectedChannelTransactionParameters this_arg_conv;
48213         this_arg_conv.inner = untag_ptr(this_arg);
48214         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48216         this_arg_conv.is_owned = false;
48217         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
48218         uint64_t ret_ref = 0;
48219         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48220         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48221         return ret_ref;
48222 }
48223
48224 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_channel_type_features"))) TS_DirectedChannelTransactionParameters_channel_type_features(uint64_t this_arg) {
48225         LDKDirectedChannelTransactionParameters this_arg_conv;
48226         this_arg_conv.inner = untag_ptr(this_arg);
48227         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48229         this_arg_conv.is_owned = false;
48230         LDKChannelTypeFeatures ret_var = DirectedChannelTransactionParameters_channel_type_features(&this_arg_conv);
48231         uint64_t ret_ref = 0;
48232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48234         return ret_ref;
48235 }
48236
48237 void  __attribute__((export_name("TS_HolderCommitmentTransaction_free"))) TS_HolderCommitmentTransaction_free(uint64_t this_obj) {
48238         LDKHolderCommitmentTransaction this_obj_conv;
48239         this_obj_conv.inner = untag_ptr(this_obj);
48240         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48242         HolderCommitmentTransaction_free(this_obj_conv);
48243 }
48244
48245 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_sig"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint64_t this_ptr) {
48246         LDKHolderCommitmentTransaction this_ptr_conv;
48247         this_ptr_conv.inner = untag_ptr(this_ptr);
48248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48250         this_ptr_conv.is_owned = false;
48251         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
48252         memcpy(ret_arr->elems, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
48253         return ret_arr;
48254 }
48255
48256 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_sig"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint64_t this_ptr, int8_tArray val) {
48257         LDKHolderCommitmentTransaction this_ptr_conv;
48258         this_ptr_conv.inner = untag_ptr(this_ptr);
48259         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48261         this_ptr_conv.is_owned = false;
48262         LDKECDSASignature val_ref;
48263         CHECK(val->arr_len == 64);
48264         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
48265         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
48266 }
48267
48268 ptrArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs(uint64_t this_ptr) {
48269         LDKHolderCommitmentTransaction this_ptr_conv;
48270         this_ptr_conv.inner = untag_ptr(this_ptr);
48271         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48273         this_ptr_conv.is_owned = false;
48274         LDKCVec_ECDSASignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
48275         ptrArray ret_arr = NULL;
48276         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
48277         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
48278         for (size_t m = 0; m < ret_var.datalen; m++) {
48279                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
48280                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
48281                 ret_arr_ptr[m] = ret_conv_12_arr;
48282         }
48283         
48284         FREE(ret_var.data);
48285         return ret_arr;
48286 }
48287
48288 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint64_t this_ptr, ptrArray val) {
48289         LDKHolderCommitmentTransaction this_ptr_conv;
48290         this_ptr_conv.inner = untag_ptr(this_ptr);
48291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48293         this_ptr_conv.is_owned = false;
48294         LDKCVec_ECDSASignatureZ val_constr;
48295         val_constr.datalen = val->arr_len;
48296         if (val_constr.datalen > 0)
48297                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
48298         else
48299                 val_constr.data = NULL;
48300         int8_tArray* val_vals = (void*) val->elems;
48301         for (size_t m = 0; m < val_constr.datalen; m++) {
48302                 int8_tArray val_conv_12 = val_vals[m];
48303                 LDKECDSASignature val_conv_12_ref;
48304                 CHECK(val_conv_12->arr_len == 64);
48305                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
48306                 val_constr.data[m] = val_conv_12_ref;
48307         }
48308         FREE(val);
48309         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
48310 }
48311
48312 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
48313         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
48314         uint64_t ret_ref = 0;
48315         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48316         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48317         return ret_ref;
48318 }
48319 int64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone_ptr"))) TS_HolderCommitmentTransaction_clone_ptr(uint64_t arg) {
48320         LDKHolderCommitmentTransaction arg_conv;
48321         arg_conv.inner = untag_ptr(arg);
48322         arg_conv.is_owned = ptr_is_owned(arg);
48323         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48324         arg_conv.is_owned = false;
48325         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
48326         return ret_conv;
48327 }
48328
48329 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone"))) TS_HolderCommitmentTransaction_clone(uint64_t orig) {
48330         LDKHolderCommitmentTransaction orig_conv;
48331         orig_conv.inner = untag_ptr(orig);
48332         orig_conv.is_owned = ptr_is_owned(orig);
48333         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48334         orig_conv.is_owned = false;
48335         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
48336         uint64_t ret_ref = 0;
48337         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48338         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48339         return ret_ref;
48340 }
48341
48342 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_write"))) TS_HolderCommitmentTransaction_write(uint64_t obj) {
48343         LDKHolderCommitmentTransaction obj_conv;
48344         obj_conv.inner = untag_ptr(obj);
48345         obj_conv.is_owned = ptr_is_owned(obj);
48346         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48347         obj_conv.is_owned = false;
48348         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
48349         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48350         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48351         CVec_u8Z_free(ret_var);
48352         return ret_arr;
48353 }
48354
48355 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_read"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
48356         LDKu8slice ser_ref;
48357         ser_ref.datalen = ser->arr_len;
48358         ser_ref.data = ser->elems;
48359         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
48360         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
48361         FREE(ser);
48362         return tag_ptr(ret_conv, true);
48363 }
48364
48365 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) {
48366         LDKCommitmentTransaction commitment_tx_conv;
48367         commitment_tx_conv.inner = untag_ptr(commitment_tx);
48368         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
48369         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
48370         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
48371         LDKECDSASignature counterparty_sig_ref;
48372         CHECK(counterparty_sig->arr_len == 64);
48373         memcpy(counterparty_sig_ref.compact_form, counterparty_sig->elems, 64); FREE(counterparty_sig);
48374         LDKCVec_ECDSASignatureZ counterparty_htlc_sigs_constr;
48375         counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs->arr_len;
48376         if (counterparty_htlc_sigs_constr.datalen > 0)
48377                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
48378         else
48379                 counterparty_htlc_sigs_constr.data = NULL;
48380         int8_tArray* counterparty_htlc_sigs_vals = (void*) counterparty_htlc_sigs->elems;
48381         for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
48382                 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
48383                 LDKECDSASignature counterparty_htlc_sigs_conv_12_ref;
48384                 CHECK(counterparty_htlc_sigs_conv_12->arr_len == 64);
48385                 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, counterparty_htlc_sigs_conv_12->elems, 64); FREE(counterparty_htlc_sigs_conv_12);
48386                 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
48387         }
48388         FREE(counterparty_htlc_sigs);
48389         LDKPublicKey holder_funding_key_ref;
48390         CHECK(holder_funding_key->arr_len == 33);
48391         memcpy(holder_funding_key_ref.compressed_form, holder_funding_key->elems, 33); FREE(holder_funding_key);
48392         LDKPublicKey counterparty_funding_key_ref;
48393         CHECK(counterparty_funding_key->arr_len == 33);
48394         memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key->elems, 33); FREE(counterparty_funding_key);
48395         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
48396         uint64_t ret_ref = 0;
48397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48399         return ret_ref;
48400 }
48401
48402 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_free"))) TS_BuiltCommitmentTransaction_free(uint64_t this_obj) {
48403         LDKBuiltCommitmentTransaction this_obj_conv;
48404         this_obj_conv.inner = untag_ptr(this_obj);
48405         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48407         BuiltCommitmentTransaction_free(this_obj_conv);
48408 }
48409
48410 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_transaction"))) TS_BuiltCommitmentTransaction_get_transaction(uint64_t this_ptr) {
48411         LDKBuiltCommitmentTransaction this_ptr_conv;
48412         this_ptr_conv.inner = untag_ptr(this_ptr);
48413         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48415         this_ptr_conv.is_owned = false;
48416         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
48417         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48418         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48419         Transaction_free(ret_var);
48420         return ret_arr;
48421 }
48422
48423 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_transaction"))) TS_BuiltCommitmentTransaction_set_transaction(uint64_t this_ptr, int8_tArray val) {
48424         LDKBuiltCommitmentTransaction this_ptr_conv;
48425         this_ptr_conv.inner = untag_ptr(this_ptr);
48426         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48428         this_ptr_conv.is_owned = false;
48429         LDKTransaction val_ref;
48430         val_ref.datalen = val->arr_len;
48431         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
48432         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
48433         val_ref.data_is_owned = true;
48434         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
48435 }
48436
48437 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_txid"))) TS_BuiltCommitmentTransaction_get_txid(uint64_t this_ptr) {
48438         LDKBuiltCommitmentTransaction this_ptr_conv;
48439         this_ptr_conv.inner = untag_ptr(this_ptr);
48440         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48442         this_ptr_conv.is_owned = false;
48443         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
48444         memcpy(ret_arr->elems, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
48445         return ret_arr;
48446 }
48447
48448 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_txid"))) TS_BuiltCommitmentTransaction_set_txid(uint64_t this_ptr, int8_tArray val) {
48449         LDKBuiltCommitmentTransaction this_ptr_conv;
48450         this_ptr_conv.inner = untag_ptr(this_ptr);
48451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48453         this_ptr_conv.is_owned = false;
48454         LDKThirtyTwoBytes val_ref;
48455         CHECK(val->arr_len == 32);
48456         memcpy(val_ref.data, val->elems, 32); FREE(val);
48457         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
48458 }
48459
48460 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_new"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
48461         LDKTransaction transaction_arg_ref;
48462         transaction_arg_ref.datalen = transaction_arg->arr_len;
48463         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
48464         memcpy(transaction_arg_ref.data, transaction_arg->elems, transaction_arg_ref.datalen); FREE(transaction_arg);
48465         transaction_arg_ref.data_is_owned = true;
48466         LDKThirtyTwoBytes txid_arg_ref;
48467         CHECK(txid_arg->arr_len == 32);
48468         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
48469         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
48470         uint64_t ret_ref = 0;
48471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48473         return ret_ref;
48474 }
48475
48476 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
48477         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
48478         uint64_t ret_ref = 0;
48479         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48480         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48481         return ret_ref;
48482 }
48483 int64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone_ptr"))) TS_BuiltCommitmentTransaction_clone_ptr(uint64_t arg) {
48484         LDKBuiltCommitmentTransaction arg_conv;
48485         arg_conv.inner = untag_ptr(arg);
48486         arg_conv.is_owned = ptr_is_owned(arg);
48487         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48488         arg_conv.is_owned = false;
48489         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
48490         return ret_conv;
48491 }
48492
48493 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone"))) TS_BuiltCommitmentTransaction_clone(uint64_t orig) {
48494         LDKBuiltCommitmentTransaction orig_conv;
48495         orig_conv.inner = untag_ptr(orig);
48496         orig_conv.is_owned = ptr_is_owned(orig);
48497         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48498         orig_conv.is_owned = false;
48499         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
48500         uint64_t ret_ref = 0;
48501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48503         return ret_ref;
48504 }
48505
48506 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_write"))) TS_BuiltCommitmentTransaction_write(uint64_t obj) {
48507         LDKBuiltCommitmentTransaction obj_conv;
48508         obj_conv.inner = untag_ptr(obj);
48509         obj_conv.is_owned = ptr_is_owned(obj);
48510         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48511         obj_conv.is_owned = false;
48512         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
48513         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48514         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48515         CVec_u8Z_free(ret_var);
48516         return ret_arr;
48517 }
48518
48519 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_read"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
48520         LDKu8slice ser_ref;
48521         ser_ref.datalen = ser->arr_len;
48522         ser_ref.data = ser->elems;
48523         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
48524         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
48525         FREE(ser);
48526         return tag_ptr(ret_conv, true);
48527 }
48528
48529 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) {
48530         LDKBuiltCommitmentTransaction this_arg_conv;
48531         this_arg_conv.inner = untag_ptr(this_arg);
48532         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48534         this_arg_conv.is_owned = false;
48535         LDKu8slice funding_redeemscript_ref;
48536         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
48537         funding_redeemscript_ref.data = funding_redeemscript->elems;
48538         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
48539         memcpy(ret_arr->elems, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
48540         FREE(funding_redeemscript);
48541         return ret_arr;
48542 }
48543
48544 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) {
48545         LDKBuiltCommitmentTransaction this_arg_conv;
48546         this_arg_conv.inner = untag_ptr(this_arg);
48547         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48549         this_arg_conv.is_owned = false;
48550         uint8_t funding_key_arr[32];
48551         CHECK(funding_key->arr_len == 32);
48552         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
48553         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
48554         LDKu8slice funding_redeemscript_ref;
48555         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
48556         funding_redeemscript_ref.data = funding_redeemscript->elems;
48557         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
48558         memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign_counterparty_commitment(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
48559         FREE(funding_redeemscript);
48560         return ret_arr;
48561 }
48562
48563 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) {
48564         LDKBuiltCommitmentTransaction this_arg_conv;
48565         this_arg_conv.inner = untag_ptr(this_arg);
48566         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48568         this_arg_conv.is_owned = false;
48569         uint8_t funding_key_arr[32];
48570         CHECK(funding_key->arr_len == 32);
48571         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
48572         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
48573         LDKu8slice funding_redeemscript_ref;
48574         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
48575         funding_redeemscript_ref.data = funding_redeemscript->elems;
48576         void* entropy_source_ptr = untag_ptr(entropy_source);
48577         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
48578         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
48579         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
48580         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);
48581         FREE(funding_redeemscript);
48582         return ret_arr;
48583 }
48584
48585 void  __attribute__((export_name("TS_ClosingTransaction_free"))) TS_ClosingTransaction_free(uint64_t this_obj) {
48586         LDKClosingTransaction this_obj_conv;
48587         this_obj_conv.inner = untag_ptr(this_obj);
48588         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48590         ClosingTransaction_free(this_obj_conv);
48591 }
48592
48593 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
48594         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
48595         uint64_t ret_ref = 0;
48596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48598         return ret_ref;
48599 }
48600 int64_t  __attribute__((export_name("TS_ClosingTransaction_clone_ptr"))) TS_ClosingTransaction_clone_ptr(uint64_t arg) {
48601         LDKClosingTransaction arg_conv;
48602         arg_conv.inner = untag_ptr(arg);
48603         arg_conv.is_owned = ptr_is_owned(arg);
48604         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48605         arg_conv.is_owned = false;
48606         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
48607         return ret_conv;
48608 }
48609
48610 uint64_t  __attribute__((export_name("TS_ClosingTransaction_clone"))) TS_ClosingTransaction_clone(uint64_t orig) {
48611         LDKClosingTransaction orig_conv;
48612         orig_conv.inner = untag_ptr(orig);
48613         orig_conv.is_owned = ptr_is_owned(orig);
48614         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48615         orig_conv.is_owned = false;
48616         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
48617         uint64_t ret_ref = 0;
48618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48620         return ret_ref;
48621 }
48622
48623 int64_t  __attribute__((export_name("TS_ClosingTransaction_hash"))) TS_ClosingTransaction_hash(uint64_t o) {
48624         LDKClosingTransaction o_conv;
48625         o_conv.inner = untag_ptr(o);
48626         o_conv.is_owned = ptr_is_owned(o);
48627         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48628         o_conv.is_owned = false;
48629         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
48630         return ret_conv;
48631 }
48632
48633 jboolean  __attribute__((export_name("TS_ClosingTransaction_eq"))) TS_ClosingTransaction_eq(uint64_t a, uint64_t b) {
48634         LDKClosingTransaction a_conv;
48635         a_conv.inner = untag_ptr(a);
48636         a_conv.is_owned = ptr_is_owned(a);
48637         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48638         a_conv.is_owned = false;
48639         LDKClosingTransaction b_conv;
48640         b_conv.inner = untag_ptr(b);
48641         b_conv.is_owned = ptr_is_owned(b);
48642         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48643         b_conv.is_owned = false;
48644         jboolean ret_conv = ClosingTransaction_eq(&a_conv, &b_conv);
48645         return ret_conv;
48646 }
48647
48648 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) {
48649         LDKCVec_u8Z to_holder_script_ref;
48650         to_holder_script_ref.datalen = to_holder_script->arr_len;
48651         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
48652         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
48653         LDKCVec_u8Z to_counterparty_script_ref;
48654         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
48655         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
48656         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
48657         LDKOutPoint funding_outpoint_conv;
48658         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
48659         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
48660         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
48661         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
48662         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
48663         uint64_t ret_ref = 0;
48664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48665         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48666         return ret_ref;
48667 }
48668
48669 uint64_t  __attribute__((export_name("TS_ClosingTransaction_trust"))) TS_ClosingTransaction_trust(uint64_t this_arg) {
48670         LDKClosingTransaction this_arg_conv;
48671         this_arg_conv.inner = untag_ptr(this_arg);
48672         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48674         this_arg_conv.is_owned = false;
48675         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
48676         uint64_t ret_ref = 0;
48677         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48678         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48679         return ret_ref;
48680 }
48681
48682 uint64_t  __attribute__((export_name("TS_ClosingTransaction_verify"))) TS_ClosingTransaction_verify(uint64_t this_arg, uint64_t funding_outpoint) {
48683         LDKClosingTransaction this_arg_conv;
48684         this_arg_conv.inner = untag_ptr(this_arg);
48685         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48687         this_arg_conv.is_owned = false;
48688         LDKOutPoint funding_outpoint_conv;
48689         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
48690         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
48691         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
48692         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
48693         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
48694         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
48695         return tag_ptr(ret_conv, true);
48696 }
48697
48698 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_holder_value_sat"))) TS_ClosingTransaction_to_holder_value_sat(uint64_t this_arg) {
48699         LDKClosingTransaction this_arg_conv;
48700         this_arg_conv.inner = untag_ptr(this_arg);
48701         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48703         this_arg_conv.is_owned = false;
48704         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
48705         return ret_conv;
48706 }
48707
48708 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_value_sat"))) TS_ClosingTransaction_to_counterparty_value_sat(uint64_t this_arg) {
48709         LDKClosingTransaction this_arg_conv;
48710         this_arg_conv.inner = untag_ptr(this_arg);
48711         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48713         this_arg_conv.is_owned = false;
48714         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
48715         return ret_conv;
48716 }
48717
48718 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_holder_script"))) TS_ClosingTransaction_to_holder_script(uint64_t this_arg) {
48719         LDKClosingTransaction this_arg_conv;
48720         this_arg_conv.inner = untag_ptr(this_arg);
48721         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48723         this_arg_conv.is_owned = false;
48724         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
48725         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48726         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48727         return ret_arr;
48728 }
48729
48730 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_script"))) TS_ClosingTransaction_to_counterparty_script(uint64_t this_arg) {
48731         LDKClosingTransaction this_arg_conv;
48732         this_arg_conv.inner = untag_ptr(this_arg);
48733         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48735         this_arg_conv.is_owned = false;
48736         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
48737         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48738         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48739         return ret_arr;
48740 }
48741
48742 void  __attribute__((export_name("TS_TrustedClosingTransaction_free"))) TS_TrustedClosingTransaction_free(uint64_t this_obj) {
48743         LDKTrustedClosingTransaction this_obj_conv;
48744         this_obj_conv.inner = untag_ptr(this_obj);
48745         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48747         TrustedClosingTransaction_free(this_obj_conv);
48748 }
48749
48750 int8_tArray  __attribute__((export_name("TS_TrustedClosingTransaction_built_transaction"))) TS_TrustedClosingTransaction_built_transaction(uint64_t this_arg) {
48751         LDKTrustedClosingTransaction this_arg_conv;
48752         this_arg_conv.inner = untag_ptr(this_arg);
48753         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48755         this_arg_conv.is_owned = false;
48756         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
48757         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48758         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48759         Transaction_free(ret_var);
48760         return ret_arr;
48761 }
48762
48763 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) {
48764         LDKTrustedClosingTransaction this_arg_conv;
48765         this_arg_conv.inner = untag_ptr(this_arg);
48766         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48768         this_arg_conv.is_owned = false;
48769         LDKu8slice funding_redeemscript_ref;
48770         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
48771         funding_redeemscript_ref.data = funding_redeemscript->elems;
48772         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
48773         memcpy(ret_arr->elems, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
48774         FREE(funding_redeemscript);
48775         return ret_arr;
48776 }
48777
48778 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) {
48779         LDKTrustedClosingTransaction this_arg_conv;
48780         this_arg_conv.inner = untag_ptr(this_arg);
48781         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48783         this_arg_conv.is_owned = false;
48784         uint8_t funding_key_arr[32];
48785         CHECK(funding_key->arr_len == 32);
48786         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
48787         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
48788         LDKu8slice funding_redeemscript_ref;
48789         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
48790         funding_redeemscript_ref.data = funding_redeemscript->elems;
48791         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
48792         memcpy(ret_arr->elems, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
48793         FREE(funding_redeemscript);
48794         return ret_arr;
48795 }
48796
48797 void  __attribute__((export_name("TS_CommitmentTransaction_free"))) TS_CommitmentTransaction_free(uint64_t this_obj) {
48798         LDKCommitmentTransaction this_obj_conv;
48799         this_obj_conv.inner = untag_ptr(this_obj);
48800         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48802         CommitmentTransaction_free(this_obj_conv);
48803 }
48804
48805 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
48806         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
48807         uint64_t ret_ref = 0;
48808         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48809         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48810         return ret_ref;
48811 }
48812 int64_t  __attribute__((export_name("TS_CommitmentTransaction_clone_ptr"))) TS_CommitmentTransaction_clone_ptr(uint64_t arg) {
48813         LDKCommitmentTransaction arg_conv;
48814         arg_conv.inner = untag_ptr(arg);
48815         arg_conv.is_owned = ptr_is_owned(arg);
48816         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48817         arg_conv.is_owned = false;
48818         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
48819         return ret_conv;
48820 }
48821
48822 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_clone"))) TS_CommitmentTransaction_clone(uint64_t orig) {
48823         LDKCommitmentTransaction orig_conv;
48824         orig_conv.inner = untag_ptr(orig);
48825         orig_conv.is_owned = ptr_is_owned(orig);
48826         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48827         orig_conv.is_owned = false;
48828         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
48829         uint64_t ret_ref = 0;
48830         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48831         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48832         return ret_ref;
48833 }
48834
48835 int8_tArray  __attribute__((export_name("TS_CommitmentTransaction_write"))) TS_CommitmentTransaction_write(uint64_t obj) {
48836         LDKCommitmentTransaction obj_conv;
48837         obj_conv.inner = untag_ptr(obj);
48838         obj_conv.is_owned = ptr_is_owned(obj);
48839         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48840         obj_conv.is_owned = false;
48841         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
48842         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48843         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48844         CVec_u8Z_free(ret_var);
48845         return ret_arr;
48846 }
48847
48848 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_read"))) TS_CommitmentTransaction_read(int8_tArray ser) {
48849         LDKu8slice ser_ref;
48850         ser_ref.datalen = ser->arr_len;
48851         ser_ref.data = ser->elems;
48852         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
48853         *ret_conv = CommitmentTransaction_read(ser_ref);
48854         FREE(ser);
48855         return tag_ptr(ret_conv, true);
48856 }
48857
48858 int64_t  __attribute__((export_name("TS_CommitmentTransaction_commitment_number"))) TS_CommitmentTransaction_commitment_number(uint64_t this_arg) {
48859         LDKCommitmentTransaction this_arg_conv;
48860         this_arg_conv.inner = untag_ptr(this_arg);
48861         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48863         this_arg_conv.is_owned = false;
48864         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
48865         return ret_conv;
48866 }
48867
48868 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_broadcaster_value_sat"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint64_t this_arg) {
48869         LDKCommitmentTransaction this_arg_conv;
48870         this_arg_conv.inner = untag_ptr(this_arg);
48871         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48873         this_arg_conv.is_owned = false;
48874         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
48875         return ret_conv;
48876 }
48877
48878 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_countersignatory_value_sat"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint64_t this_arg) {
48879         LDKCommitmentTransaction this_arg_conv;
48880         this_arg_conv.inner = untag_ptr(this_arg);
48881         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48883         this_arg_conv.is_owned = false;
48884         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
48885         return ret_conv;
48886 }
48887
48888 int32_t  __attribute__((export_name("TS_CommitmentTransaction_feerate_per_kw"))) TS_CommitmentTransaction_feerate_per_kw(uint64_t this_arg) {
48889         LDKCommitmentTransaction this_arg_conv;
48890         this_arg_conv.inner = untag_ptr(this_arg);
48891         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48893         this_arg_conv.is_owned = false;
48894         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
48895         return ret_conv;
48896 }
48897
48898 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_trust"))) TS_CommitmentTransaction_trust(uint64_t this_arg) {
48899         LDKCommitmentTransaction this_arg_conv;
48900         this_arg_conv.inner = untag_ptr(this_arg);
48901         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48903         this_arg_conv.is_owned = false;
48904         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
48905         uint64_t ret_ref = 0;
48906         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48907         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48908         return ret_ref;
48909 }
48910
48911 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) {
48912         LDKCommitmentTransaction this_arg_conv;
48913         this_arg_conv.inner = untag_ptr(this_arg);
48914         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48916         this_arg_conv.is_owned = false;
48917         LDKDirectedChannelTransactionParameters channel_parameters_conv;
48918         channel_parameters_conv.inner = untag_ptr(channel_parameters);
48919         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
48920         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
48921         channel_parameters_conv.is_owned = false;
48922         LDKChannelPublicKeys broadcaster_keys_conv;
48923         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
48924         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
48925         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
48926         broadcaster_keys_conv.is_owned = false;
48927         LDKChannelPublicKeys countersignatory_keys_conv;
48928         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
48929         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
48930         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
48931         countersignatory_keys_conv.is_owned = false;
48932         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
48933         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
48934         return tag_ptr(ret_conv, true);
48935 }
48936
48937 void  __attribute__((export_name("TS_TrustedCommitmentTransaction_free"))) TS_TrustedCommitmentTransaction_free(uint64_t this_obj) {
48938         LDKTrustedCommitmentTransaction this_obj_conv;
48939         this_obj_conv.inner = untag_ptr(this_obj);
48940         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48942         TrustedCommitmentTransaction_free(this_obj_conv);
48943 }
48944
48945 int8_tArray  __attribute__((export_name("TS_TrustedCommitmentTransaction_txid"))) TS_TrustedCommitmentTransaction_txid(uint64_t this_arg) {
48946         LDKTrustedCommitmentTransaction this_arg_conv;
48947         this_arg_conv.inner = untag_ptr(this_arg);
48948         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48950         this_arg_conv.is_owned = false;
48951         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
48952         memcpy(ret_arr->elems, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
48953         return ret_arr;
48954 }
48955
48956 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_built_transaction"))) TS_TrustedCommitmentTransaction_built_transaction(uint64_t this_arg) {
48957         LDKTrustedCommitmentTransaction this_arg_conv;
48958         this_arg_conv.inner = untag_ptr(this_arg);
48959         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48961         this_arg_conv.is_owned = false;
48962         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
48963         uint64_t ret_ref = 0;
48964         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48965         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48966         return ret_ref;
48967 }
48968
48969 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_keys"))) TS_TrustedCommitmentTransaction_keys(uint64_t this_arg) {
48970         LDKTrustedCommitmentTransaction this_arg_conv;
48971         this_arg_conv.inner = untag_ptr(this_arg);
48972         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48974         this_arg_conv.is_owned = false;
48975         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
48976         uint64_t ret_ref = 0;
48977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48979         return ret_ref;
48980 }
48981
48982 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_channel_type_features"))) TS_TrustedCommitmentTransaction_channel_type_features(uint64_t this_arg) {
48983         LDKTrustedCommitmentTransaction this_arg_conv;
48984         this_arg_conv.inner = untag_ptr(this_arg);
48985         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48987         this_arg_conv.is_owned = false;
48988         LDKChannelTypeFeatures ret_var = TrustedCommitmentTransaction_channel_type_features(&this_arg_conv);
48989         uint64_t ret_ref = 0;
48990         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48991         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48992         return ret_ref;
48993 }
48994
48995 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) {
48996         LDKTrustedCommitmentTransaction this_arg_conv;
48997         this_arg_conv.inner = untag_ptr(this_arg);
48998         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49000         this_arg_conv.is_owned = false;
49001         uint8_t htlc_base_key_arr[32];
49002         CHECK(htlc_base_key->arr_len == 32);
49003         memcpy(htlc_base_key_arr, htlc_base_key->elems, 32); FREE(htlc_base_key);
49004         uint8_t (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
49005         LDKDirectedChannelTransactionParameters channel_parameters_conv;
49006         channel_parameters_conv.inner = untag_ptr(channel_parameters);
49007         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
49008         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
49009         channel_parameters_conv.is_owned = false;
49010         void* entropy_source_ptr = untag_ptr(entropy_source);
49011         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
49012         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
49013         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
49014         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv, entropy_source_conv);
49015         return tag_ptr(ret_conv, true);
49016 }
49017
49018 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_revokeable_output_index"))) TS_TrustedCommitmentTransaction_revokeable_output_index(uint64_t this_arg) {
49019         LDKTrustedCommitmentTransaction this_arg_conv;
49020         this_arg_conv.inner = untag_ptr(this_arg);
49021         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49023         this_arg_conv.is_owned = false;
49024         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
49025         *ret_copy = TrustedCommitmentTransaction_revokeable_output_index(&this_arg_conv);
49026         uint64_t ret_ref = tag_ptr(ret_copy, true);
49027         return ret_ref;
49028 }
49029
49030 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) {
49031         LDKTrustedCommitmentTransaction this_arg_conv;
49032         this_arg_conv.inner = untag_ptr(this_arg);
49033         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49035         this_arg_conv.is_owned = false;
49036         LDKCVec_u8Z destination_script_ref;
49037         destination_script_ref.datalen = destination_script->arr_len;
49038         destination_script_ref.data = MALLOC(destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
49039         memcpy(destination_script_ref.data, destination_script->elems, destination_script_ref.datalen); FREE(destination_script);
49040         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
49041         *ret_conv = TrustedCommitmentTransaction_build_to_local_justice_tx(&this_arg_conv, feerate_per_kw, destination_script_ref);
49042         return tag_ptr(ret_conv, true);
49043 }
49044
49045 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) {
49046         LDKPublicKey broadcaster_payment_basepoint_ref;
49047         CHECK(broadcaster_payment_basepoint->arr_len == 33);
49048         memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint->elems, 33); FREE(broadcaster_payment_basepoint);
49049         LDKPublicKey countersignatory_payment_basepoint_ref;
49050         CHECK(countersignatory_payment_basepoint->arr_len == 33);
49051         memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint->elems, 33); FREE(countersignatory_payment_basepoint);
49052         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
49053         return ret_conv;
49054 }
49055
49056 jboolean  __attribute__((export_name("TS_InitFeatures_eq"))) TS_InitFeatures_eq(uint64_t a, uint64_t b) {
49057         LDKInitFeatures a_conv;
49058         a_conv.inner = untag_ptr(a);
49059         a_conv.is_owned = ptr_is_owned(a);
49060         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49061         a_conv.is_owned = false;
49062         LDKInitFeatures b_conv;
49063         b_conv.inner = untag_ptr(b);
49064         b_conv.is_owned = ptr_is_owned(b);
49065         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49066         b_conv.is_owned = false;
49067         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
49068         return ret_conv;
49069 }
49070
49071 jboolean  __attribute__((export_name("TS_NodeFeatures_eq"))) TS_NodeFeatures_eq(uint64_t a, uint64_t b) {
49072         LDKNodeFeatures a_conv;
49073         a_conv.inner = untag_ptr(a);
49074         a_conv.is_owned = ptr_is_owned(a);
49075         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49076         a_conv.is_owned = false;
49077         LDKNodeFeatures b_conv;
49078         b_conv.inner = untag_ptr(b);
49079         b_conv.is_owned = ptr_is_owned(b);
49080         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49081         b_conv.is_owned = false;
49082         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
49083         return ret_conv;
49084 }
49085
49086 jboolean  __attribute__((export_name("TS_ChannelFeatures_eq"))) TS_ChannelFeatures_eq(uint64_t a, uint64_t b) {
49087         LDKChannelFeatures a_conv;
49088         a_conv.inner = untag_ptr(a);
49089         a_conv.is_owned = ptr_is_owned(a);
49090         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49091         a_conv.is_owned = false;
49092         LDKChannelFeatures b_conv;
49093         b_conv.inner = untag_ptr(b);
49094         b_conv.is_owned = ptr_is_owned(b);
49095         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49096         b_conv.is_owned = false;
49097         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
49098         return ret_conv;
49099 }
49100
49101 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_eq"))) TS_Bolt11InvoiceFeatures_eq(uint64_t a, uint64_t b) {
49102         LDKBolt11InvoiceFeatures a_conv;
49103         a_conv.inner = untag_ptr(a);
49104         a_conv.is_owned = ptr_is_owned(a);
49105         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49106         a_conv.is_owned = false;
49107         LDKBolt11InvoiceFeatures b_conv;
49108         b_conv.inner = untag_ptr(b);
49109         b_conv.is_owned = ptr_is_owned(b);
49110         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49111         b_conv.is_owned = false;
49112         jboolean ret_conv = Bolt11InvoiceFeatures_eq(&a_conv, &b_conv);
49113         return ret_conv;
49114 }
49115
49116 jboolean  __attribute__((export_name("TS_OfferFeatures_eq"))) TS_OfferFeatures_eq(uint64_t a, uint64_t b) {
49117         LDKOfferFeatures a_conv;
49118         a_conv.inner = untag_ptr(a);
49119         a_conv.is_owned = ptr_is_owned(a);
49120         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49121         a_conv.is_owned = false;
49122         LDKOfferFeatures b_conv;
49123         b_conv.inner = untag_ptr(b);
49124         b_conv.is_owned = ptr_is_owned(b);
49125         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49126         b_conv.is_owned = false;
49127         jboolean ret_conv = OfferFeatures_eq(&a_conv, &b_conv);
49128         return ret_conv;
49129 }
49130
49131 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_eq"))) TS_InvoiceRequestFeatures_eq(uint64_t a, uint64_t b) {
49132         LDKInvoiceRequestFeatures a_conv;
49133         a_conv.inner = untag_ptr(a);
49134         a_conv.is_owned = ptr_is_owned(a);
49135         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49136         a_conv.is_owned = false;
49137         LDKInvoiceRequestFeatures b_conv;
49138         b_conv.inner = untag_ptr(b);
49139         b_conv.is_owned = ptr_is_owned(b);
49140         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49141         b_conv.is_owned = false;
49142         jboolean ret_conv = InvoiceRequestFeatures_eq(&a_conv, &b_conv);
49143         return ret_conv;
49144 }
49145
49146 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_eq"))) TS_Bolt12InvoiceFeatures_eq(uint64_t a, uint64_t b) {
49147         LDKBolt12InvoiceFeatures a_conv;
49148         a_conv.inner = untag_ptr(a);
49149         a_conv.is_owned = ptr_is_owned(a);
49150         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49151         a_conv.is_owned = false;
49152         LDKBolt12InvoiceFeatures b_conv;
49153         b_conv.inner = untag_ptr(b);
49154         b_conv.is_owned = ptr_is_owned(b);
49155         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49156         b_conv.is_owned = false;
49157         jboolean ret_conv = Bolt12InvoiceFeatures_eq(&a_conv, &b_conv);
49158         return ret_conv;
49159 }
49160
49161 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_eq"))) TS_BlindedHopFeatures_eq(uint64_t a, uint64_t b) {
49162         LDKBlindedHopFeatures a_conv;
49163         a_conv.inner = untag_ptr(a);
49164         a_conv.is_owned = ptr_is_owned(a);
49165         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49166         a_conv.is_owned = false;
49167         LDKBlindedHopFeatures b_conv;
49168         b_conv.inner = untag_ptr(b);
49169         b_conv.is_owned = ptr_is_owned(b);
49170         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49171         b_conv.is_owned = false;
49172         jboolean ret_conv = BlindedHopFeatures_eq(&a_conv, &b_conv);
49173         return ret_conv;
49174 }
49175
49176 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_eq"))) TS_ChannelTypeFeatures_eq(uint64_t a, uint64_t b) {
49177         LDKChannelTypeFeatures a_conv;
49178         a_conv.inner = untag_ptr(a);
49179         a_conv.is_owned = ptr_is_owned(a);
49180         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49181         a_conv.is_owned = false;
49182         LDKChannelTypeFeatures b_conv;
49183         b_conv.inner = untag_ptr(b);
49184         b_conv.is_owned = ptr_is_owned(b);
49185         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49186         b_conv.is_owned = false;
49187         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
49188         return ret_conv;
49189 }
49190
49191 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
49192         LDKInitFeatures ret_var = InitFeatures_clone(arg);
49193         uint64_t ret_ref = 0;
49194         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49195         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49196         return ret_ref;
49197 }
49198 int64_t  __attribute__((export_name("TS_InitFeatures_clone_ptr"))) TS_InitFeatures_clone_ptr(uint64_t arg) {
49199         LDKInitFeatures arg_conv;
49200         arg_conv.inner = untag_ptr(arg);
49201         arg_conv.is_owned = ptr_is_owned(arg);
49202         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49203         arg_conv.is_owned = false;
49204         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
49205         return ret_conv;
49206 }
49207
49208 uint64_t  __attribute__((export_name("TS_InitFeatures_clone"))) TS_InitFeatures_clone(uint64_t orig) {
49209         LDKInitFeatures orig_conv;
49210         orig_conv.inner = untag_ptr(orig);
49211         orig_conv.is_owned = ptr_is_owned(orig);
49212         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49213         orig_conv.is_owned = false;
49214         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
49215         uint64_t ret_ref = 0;
49216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49218         return ret_ref;
49219 }
49220
49221 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
49222         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
49223         uint64_t ret_ref = 0;
49224         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49225         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49226         return ret_ref;
49227 }
49228 int64_t  __attribute__((export_name("TS_NodeFeatures_clone_ptr"))) TS_NodeFeatures_clone_ptr(uint64_t arg) {
49229         LDKNodeFeatures arg_conv;
49230         arg_conv.inner = untag_ptr(arg);
49231         arg_conv.is_owned = ptr_is_owned(arg);
49232         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49233         arg_conv.is_owned = false;
49234         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
49235         return ret_conv;
49236 }
49237
49238 uint64_t  __attribute__((export_name("TS_NodeFeatures_clone"))) TS_NodeFeatures_clone(uint64_t orig) {
49239         LDKNodeFeatures orig_conv;
49240         orig_conv.inner = untag_ptr(orig);
49241         orig_conv.is_owned = ptr_is_owned(orig);
49242         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49243         orig_conv.is_owned = false;
49244         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
49245         uint64_t ret_ref = 0;
49246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49248         return ret_ref;
49249 }
49250
49251 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
49252         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
49253         uint64_t ret_ref = 0;
49254         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49255         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49256         return ret_ref;
49257 }
49258 int64_t  __attribute__((export_name("TS_ChannelFeatures_clone_ptr"))) TS_ChannelFeatures_clone_ptr(uint64_t arg) {
49259         LDKChannelFeatures arg_conv;
49260         arg_conv.inner = untag_ptr(arg);
49261         arg_conv.is_owned = ptr_is_owned(arg);
49262         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49263         arg_conv.is_owned = false;
49264         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
49265         return ret_conv;
49266 }
49267
49268 uint64_t  __attribute__((export_name("TS_ChannelFeatures_clone"))) TS_ChannelFeatures_clone(uint64_t orig) {
49269         LDKChannelFeatures orig_conv;
49270         orig_conv.inner = untag_ptr(orig);
49271         orig_conv.is_owned = ptr_is_owned(orig);
49272         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49273         orig_conv.is_owned = false;
49274         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
49275         uint64_t ret_ref = 0;
49276         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49277         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49278         return ret_ref;
49279 }
49280
49281 static inline uint64_t Bolt11InvoiceFeatures_clone_ptr(LDKBolt11InvoiceFeatures *NONNULL_PTR arg) {
49282         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(arg);
49283         uint64_t ret_ref = 0;
49284         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49285         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49286         return ret_ref;
49287 }
49288 int64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_clone_ptr"))) TS_Bolt11InvoiceFeatures_clone_ptr(uint64_t arg) {
49289         LDKBolt11InvoiceFeatures arg_conv;
49290         arg_conv.inner = untag_ptr(arg);
49291         arg_conv.is_owned = ptr_is_owned(arg);
49292         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49293         arg_conv.is_owned = false;
49294         int64_t ret_conv = Bolt11InvoiceFeatures_clone_ptr(&arg_conv);
49295         return ret_conv;
49296 }
49297
49298 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_clone"))) TS_Bolt11InvoiceFeatures_clone(uint64_t orig) {
49299         LDKBolt11InvoiceFeatures orig_conv;
49300         orig_conv.inner = untag_ptr(orig);
49301         orig_conv.is_owned = ptr_is_owned(orig);
49302         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49303         orig_conv.is_owned = false;
49304         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(&orig_conv);
49305         uint64_t ret_ref = 0;
49306         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49307         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49308         return ret_ref;
49309 }
49310
49311 static inline uint64_t OfferFeatures_clone_ptr(LDKOfferFeatures *NONNULL_PTR arg) {
49312         LDKOfferFeatures ret_var = OfferFeatures_clone(arg);
49313         uint64_t ret_ref = 0;
49314         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49315         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49316         return ret_ref;
49317 }
49318 int64_t  __attribute__((export_name("TS_OfferFeatures_clone_ptr"))) TS_OfferFeatures_clone_ptr(uint64_t arg) {
49319         LDKOfferFeatures arg_conv;
49320         arg_conv.inner = untag_ptr(arg);
49321         arg_conv.is_owned = ptr_is_owned(arg);
49322         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49323         arg_conv.is_owned = false;
49324         int64_t ret_conv = OfferFeatures_clone_ptr(&arg_conv);
49325         return ret_conv;
49326 }
49327
49328 uint64_t  __attribute__((export_name("TS_OfferFeatures_clone"))) TS_OfferFeatures_clone(uint64_t orig) {
49329         LDKOfferFeatures orig_conv;
49330         orig_conv.inner = untag_ptr(orig);
49331         orig_conv.is_owned = ptr_is_owned(orig);
49332         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49333         orig_conv.is_owned = false;
49334         LDKOfferFeatures ret_var = OfferFeatures_clone(&orig_conv);
49335         uint64_t ret_ref = 0;
49336         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49337         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49338         return ret_ref;
49339 }
49340
49341 static inline uint64_t InvoiceRequestFeatures_clone_ptr(LDKInvoiceRequestFeatures *NONNULL_PTR arg) {
49342         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(arg);
49343         uint64_t ret_ref = 0;
49344         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49345         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49346         return ret_ref;
49347 }
49348 int64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_clone_ptr"))) TS_InvoiceRequestFeatures_clone_ptr(uint64_t arg) {
49349         LDKInvoiceRequestFeatures arg_conv;
49350         arg_conv.inner = untag_ptr(arg);
49351         arg_conv.is_owned = ptr_is_owned(arg);
49352         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49353         arg_conv.is_owned = false;
49354         int64_t ret_conv = InvoiceRequestFeatures_clone_ptr(&arg_conv);
49355         return ret_conv;
49356 }
49357
49358 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_clone"))) TS_InvoiceRequestFeatures_clone(uint64_t orig) {
49359         LDKInvoiceRequestFeatures orig_conv;
49360         orig_conv.inner = untag_ptr(orig);
49361         orig_conv.is_owned = ptr_is_owned(orig);
49362         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49363         orig_conv.is_owned = false;
49364         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(&orig_conv);
49365         uint64_t ret_ref = 0;
49366         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49367         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49368         return ret_ref;
49369 }
49370
49371 static inline uint64_t Bolt12InvoiceFeatures_clone_ptr(LDKBolt12InvoiceFeatures *NONNULL_PTR arg) {
49372         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(arg);
49373         uint64_t ret_ref = 0;
49374         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49375         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49376         return ret_ref;
49377 }
49378 int64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_clone_ptr"))) TS_Bolt12InvoiceFeatures_clone_ptr(uint64_t arg) {
49379         LDKBolt12InvoiceFeatures arg_conv;
49380         arg_conv.inner = untag_ptr(arg);
49381         arg_conv.is_owned = ptr_is_owned(arg);
49382         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49383         arg_conv.is_owned = false;
49384         int64_t ret_conv = Bolt12InvoiceFeatures_clone_ptr(&arg_conv);
49385         return ret_conv;
49386 }
49387
49388 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_clone"))) TS_Bolt12InvoiceFeatures_clone(uint64_t orig) {
49389         LDKBolt12InvoiceFeatures orig_conv;
49390         orig_conv.inner = untag_ptr(orig);
49391         orig_conv.is_owned = ptr_is_owned(orig);
49392         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49393         orig_conv.is_owned = false;
49394         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(&orig_conv);
49395         uint64_t ret_ref = 0;
49396         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49397         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49398         return ret_ref;
49399 }
49400
49401 static inline uint64_t BlindedHopFeatures_clone_ptr(LDKBlindedHopFeatures *NONNULL_PTR arg) {
49402         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(arg);
49403         uint64_t ret_ref = 0;
49404         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49405         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49406         return ret_ref;
49407 }
49408 int64_t  __attribute__((export_name("TS_BlindedHopFeatures_clone_ptr"))) TS_BlindedHopFeatures_clone_ptr(uint64_t arg) {
49409         LDKBlindedHopFeatures arg_conv;
49410         arg_conv.inner = untag_ptr(arg);
49411         arg_conv.is_owned = ptr_is_owned(arg);
49412         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49413         arg_conv.is_owned = false;
49414         int64_t ret_conv = BlindedHopFeatures_clone_ptr(&arg_conv);
49415         return ret_conv;
49416 }
49417
49418 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_clone"))) TS_BlindedHopFeatures_clone(uint64_t orig) {
49419         LDKBlindedHopFeatures orig_conv;
49420         orig_conv.inner = untag_ptr(orig);
49421         orig_conv.is_owned = ptr_is_owned(orig);
49422         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49423         orig_conv.is_owned = false;
49424         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(&orig_conv);
49425         uint64_t ret_ref = 0;
49426         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49427         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49428         return ret_ref;
49429 }
49430
49431 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
49432         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
49433         uint64_t ret_ref = 0;
49434         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49435         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49436         return ret_ref;
49437 }
49438 int64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone_ptr"))) TS_ChannelTypeFeatures_clone_ptr(uint64_t arg) {
49439         LDKChannelTypeFeatures arg_conv;
49440         arg_conv.inner = untag_ptr(arg);
49441         arg_conv.is_owned = ptr_is_owned(arg);
49442         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49443         arg_conv.is_owned = false;
49444         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
49445         return ret_conv;
49446 }
49447
49448 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone"))) TS_ChannelTypeFeatures_clone(uint64_t orig) {
49449         LDKChannelTypeFeatures orig_conv;
49450         orig_conv.inner = untag_ptr(orig);
49451         orig_conv.is_owned = ptr_is_owned(orig);
49452         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49453         orig_conv.is_owned = false;
49454         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
49455         uint64_t ret_ref = 0;
49456         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49457         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49458         return ret_ref;
49459 }
49460
49461 void  __attribute__((export_name("TS_InitFeatures_free"))) TS_InitFeatures_free(uint64_t this_obj) {
49462         LDKInitFeatures this_obj_conv;
49463         this_obj_conv.inner = untag_ptr(this_obj);
49464         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49466         InitFeatures_free(this_obj_conv);
49467 }
49468
49469 void  __attribute__((export_name("TS_NodeFeatures_free"))) TS_NodeFeatures_free(uint64_t this_obj) {
49470         LDKNodeFeatures this_obj_conv;
49471         this_obj_conv.inner = untag_ptr(this_obj);
49472         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49474         NodeFeatures_free(this_obj_conv);
49475 }
49476
49477 void  __attribute__((export_name("TS_ChannelFeatures_free"))) TS_ChannelFeatures_free(uint64_t this_obj) {
49478         LDKChannelFeatures this_obj_conv;
49479         this_obj_conv.inner = untag_ptr(this_obj);
49480         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49482         ChannelFeatures_free(this_obj_conv);
49483 }
49484
49485 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_free"))) TS_Bolt11InvoiceFeatures_free(uint64_t this_obj) {
49486         LDKBolt11InvoiceFeatures this_obj_conv;
49487         this_obj_conv.inner = untag_ptr(this_obj);
49488         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49490         Bolt11InvoiceFeatures_free(this_obj_conv);
49491 }
49492
49493 void  __attribute__((export_name("TS_OfferFeatures_free"))) TS_OfferFeatures_free(uint64_t this_obj) {
49494         LDKOfferFeatures this_obj_conv;
49495         this_obj_conv.inner = untag_ptr(this_obj);
49496         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49498         OfferFeatures_free(this_obj_conv);
49499 }
49500
49501 void  __attribute__((export_name("TS_InvoiceRequestFeatures_free"))) TS_InvoiceRequestFeatures_free(uint64_t this_obj) {
49502         LDKInvoiceRequestFeatures this_obj_conv;
49503         this_obj_conv.inner = untag_ptr(this_obj);
49504         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49506         InvoiceRequestFeatures_free(this_obj_conv);
49507 }
49508
49509 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_free"))) TS_Bolt12InvoiceFeatures_free(uint64_t this_obj) {
49510         LDKBolt12InvoiceFeatures this_obj_conv;
49511         this_obj_conv.inner = untag_ptr(this_obj);
49512         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49514         Bolt12InvoiceFeatures_free(this_obj_conv);
49515 }
49516
49517 void  __attribute__((export_name("TS_BlindedHopFeatures_free"))) TS_BlindedHopFeatures_free(uint64_t this_obj) {
49518         LDKBlindedHopFeatures this_obj_conv;
49519         this_obj_conv.inner = untag_ptr(this_obj);
49520         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49522         BlindedHopFeatures_free(this_obj_conv);
49523 }
49524
49525 void  __attribute__((export_name("TS_ChannelTypeFeatures_free"))) TS_ChannelTypeFeatures_free(uint64_t this_obj) {
49526         LDKChannelTypeFeatures this_obj_conv;
49527         this_obj_conv.inner = untag_ptr(this_obj);
49528         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49530         ChannelTypeFeatures_free(this_obj_conv);
49531 }
49532
49533 uint64_t  __attribute__((export_name("TS_InitFeatures_empty"))) TS_InitFeatures_empty() {
49534         LDKInitFeatures ret_var = InitFeatures_empty();
49535         uint64_t ret_ref = 0;
49536         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49537         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49538         return ret_ref;
49539 }
49540
49541 jboolean  __attribute__((export_name("TS_InitFeatures_requires_unknown_bits_from"))) TS_InitFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
49542         LDKInitFeatures this_arg_conv;
49543         this_arg_conv.inner = untag_ptr(this_arg);
49544         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49546         this_arg_conv.is_owned = false;
49547         LDKInitFeatures other_conv;
49548         other_conv.inner = untag_ptr(other);
49549         other_conv.is_owned = ptr_is_owned(other);
49550         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
49551         other_conv.is_owned = false;
49552         jboolean ret_conv = InitFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
49553         return ret_conv;
49554 }
49555
49556 jboolean  __attribute__((export_name("TS_InitFeatures_requires_unknown_bits"))) TS_InitFeatures_requires_unknown_bits(uint64_t this_arg) {
49557         LDKInitFeatures this_arg_conv;
49558         this_arg_conv.inner = untag_ptr(this_arg);
49559         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49561         this_arg_conv.is_owned = false;
49562         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
49563         return ret_conv;
49564 }
49565
49566 uint64_t  __attribute__((export_name("TS_InitFeatures_set_required_feature_bit"))) TS_InitFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
49567         LDKInitFeatures this_arg_conv;
49568         this_arg_conv.inner = untag_ptr(this_arg);
49569         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49571         this_arg_conv.is_owned = false;
49572         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49573         *ret_conv = InitFeatures_set_required_feature_bit(&this_arg_conv, bit);
49574         return tag_ptr(ret_conv, true);
49575 }
49576
49577 uint64_t  __attribute__((export_name("TS_InitFeatures_set_optional_feature_bit"))) TS_InitFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
49578         LDKInitFeatures this_arg_conv;
49579         this_arg_conv.inner = untag_ptr(this_arg);
49580         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49582         this_arg_conv.is_owned = false;
49583         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49584         *ret_conv = InitFeatures_set_optional_feature_bit(&this_arg_conv, bit);
49585         return tag_ptr(ret_conv, true);
49586 }
49587
49588 uint64_t  __attribute__((export_name("TS_InitFeatures_set_required_custom_bit"))) TS_InitFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
49589         LDKInitFeatures this_arg_conv;
49590         this_arg_conv.inner = untag_ptr(this_arg);
49591         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49593         this_arg_conv.is_owned = false;
49594         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49595         *ret_conv = InitFeatures_set_required_custom_bit(&this_arg_conv, bit);
49596         return tag_ptr(ret_conv, true);
49597 }
49598
49599 uint64_t  __attribute__((export_name("TS_InitFeatures_set_optional_custom_bit"))) TS_InitFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
49600         LDKInitFeatures this_arg_conv;
49601         this_arg_conv.inner = untag_ptr(this_arg);
49602         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49604         this_arg_conv.is_owned = false;
49605         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49606         *ret_conv = InitFeatures_set_optional_custom_bit(&this_arg_conv, bit);
49607         return tag_ptr(ret_conv, true);
49608 }
49609
49610 uint64_t  __attribute__((export_name("TS_NodeFeatures_empty"))) TS_NodeFeatures_empty() {
49611         LDKNodeFeatures ret_var = NodeFeatures_empty();
49612         uint64_t ret_ref = 0;
49613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49615         return ret_ref;
49616 }
49617
49618 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits_from"))) TS_NodeFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
49619         LDKNodeFeatures this_arg_conv;
49620         this_arg_conv.inner = untag_ptr(this_arg);
49621         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49623         this_arg_conv.is_owned = false;
49624         LDKNodeFeatures other_conv;
49625         other_conv.inner = untag_ptr(other);
49626         other_conv.is_owned = ptr_is_owned(other);
49627         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
49628         other_conv.is_owned = false;
49629         jboolean ret_conv = NodeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
49630         return ret_conv;
49631 }
49632
49633 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits"))) TS_NodeFeatures_requires_unknown_bits(uint64_t this_arg) {
49634         LDKNodeFeatures this_arg_conv;
49635         this_arg_conv.inner = untag_ptr(this_arg);
49636         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49638         this_arg_conv.is_owned = false;
49639         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
49640         return ret_conv;
49641 }
49642
49643 uint64_t  __attribute__((export_name("TS_NodeFeatures_set_required_feature_bit"))) TS_NodeFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
49644         LDKNodeFeatures this_arg_conv;
49645         this_arg_conv.inner = untag_ptr(this_arg);
49646         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49648         this_arg_conv.is_owned = false;
49649         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49650         *ret_conv = NodeFeatures_set_required_feature_bit(&this_arg_conv, bit);
49651         return tag_ptr(ret_conv, true);
49652 }
49653
49654 uint64_t  __attribute__((export_name("TS_NodeFeatures_set_optional_feature_bit"))) TS_NodeFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
49655         LDKNodeFeatures this_arg_conv;
49656         this_arg_conv.inner = untag_ptr(this_arg);
49657         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49659         this_arg_conv.is_owned = false;
49660         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49661         *ret_conv = NodeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
49662         return tag_ptr(ret_conv, true);
49663 }
49664
49665 uint64_t  __attribute__((export_name("TS_NodeFeatures_set_required_custom_bit"))) TS_NodeFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
49666         LDKNodeFeatures this_arg_conv;
49667         this_arg_conv.inner = untag_ptr(this_arg);
49668         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49670         this_arg_conv.is_owned = false;
49671         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49672         *ret_conv = NodeFeatures_set_required_custom_bit(&this_arg_conv, bit);
49673         return tag_ptr(ret_conv, true);
49674 }
49675
49676 uint64_t  __attribute__((export_name("TS_NodeFeatures_set_optional_custom_bit"))) TS_NodeFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
49677         LDKNodeFeatures this_arg_conv;
49678         this_arg_conv.inner = untag_ptr(this_arg);
49679         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49681         this_arg_conv.is_owned = false;
49682         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49683         *ret_conv = NodeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
49684         return tag_ptr(ret_conv, true);
49685 }
49686
49687 uint64_t  __attribute__((export_name("TS_ChannelFeatures_empty"))) TS_ChannelFeatures_empty() {
49688         LDKChannelFeatures ret_var = ChannelFeatures_empty();
49689         uint64_t ret_ref = 0;
49690         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49691         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49692         return ret_ref;
49693 }
49694
49695 jboolean  __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits_from"))) TS_ChannelFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
49696         LDKChannelFeatures this_arg_conv;
49697         this_arg_conv.inner = untag_ptr(this_arg);
49698         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49700         this_arg_conv.is_owned = false;
49701         LDKChannelFeatures other_conv;
49702         other_conv.inner = untag_ptr(other);
49703         other_conv.is_owned = ptr_is_owned(other);
49704         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
49705         other_conv.is_owned = false;
49706         jboolean ret_conv = ChannelFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
49707         return ret_conv;
49708 }
49709
49710 jboolean  __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits"))) TS_ChannelFeatures_requires_unknown_bits(uint64_t this_arg) {
49711         LDKChannelFeatures this_arg_conv;
49712         this_arg_conv.inner = untag_ptr(this_arg);
49713         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49715         this_arg_conv.is_owned = false;
49716         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
49717         return ret_conv;
49718 }
49719
49720 uint64_t  __attribute__((export_name("TS_ChannelFeatures_set_required_feature_bit"))) TS_ChannelFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
49721         LDKChannelFeatures this_arg_conv;
49722         this_arg_conv.inner = untag_ptr(this_arg);
49723         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49725         this_arg_conv.is_owned = false;
49726         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49727         *ret_conv = ChannelFeatures_set_required_feature_bit(&this_arg_conv, bit);
49728         return tag_ptr(ret_conv, true);
49729 }
49730
49731 uint64_t  __attribute__((export_name("TS_ChannelFeatures_set_optional_feature_bit"))) TS_ChannelFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
49732         LDKChannelFeatures this_arg_conv;
49733         this_arg_conv.inner = untag_ptr(this_arg);
49734         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49736         this_arg_conv.is_owned = false;
49737         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49738         *ret_conv = ChannelFeatures_set_optional_feature_bit(&this_arg_conv, bit);
49739         return tag_ptr(ret_conv, true);
49740 }
49741
49742 uint64_t  __attribute__((export_name("TS_ChannelFeatures_set_required_custom_bit"))) TS_ChannelFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
49743         LDKChannelFeatures this_arg_conv;
49744         this_arg_conv.inner = untag_ptr(this_arg);
49745         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49747         this_arg_conv.is_owned = false;
49748         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49749         *ret_conv = ChannelFeatures_set_required_custom_bit(&this_arg_conv, bit);
49750         return tag_ptr(ret_conv, true);
49751 }
49752
49753 uint64_t  __attribute__((export_name("TS_ChannelFeatures_set_optional_custom_bit"))) TS_ChannelFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
49754         LDKChannelFeatures this_arg_conv;
49755         this_arg_conv.inner = untag_ptr(this_arg);
49756         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49758         this_arg_conv.is_owned = false;
49759         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49760         *ret_conv = ChannelFeatures_set_optional_custom_bit(&this_arg_conv, bit);
49761         return tag_ptr(ret_conv, true);
49762 }
49763
49764 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_empty"))) TS_Bolt11InvoiceFeatures_empty() {
49765         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_empty();
49766         uint64_t ret_ref = 0;
49767         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49768         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49769         return ret_ref;
49770 }
49771
49772 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_unknown_bits_from"))) TS_Bolt11InvoiceFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
49773         LDKBolt11InvoiceFeatures this_arg_conv;
49774         this_arg_conv.inner = untag_ptr(this_arg);
49775         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49777         this_arg_conv.is_owned = false;
49778         LDKBolt11InvoiceFeatures other_conv;
49779         other_conv.inner = untag_ptr(other);
49780         other_conv.is_owned = ptr_is_owned(other);
49781         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
49782         other_conv.is_owned = false;
49783         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
49784         return ret_conv;
49785 }
49786
49787 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_unknown_bits"))) TS_Bolt11InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
49788         LDKBolt11InvoiceFeatures this_arg_conv;
49789         this_arg_conv.inner = untag_ptr(this_arg);
49790         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49792         this_arg_conv.is_owned = false;
49793         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
49794         return ret_conv;
49795 }
49796
49797 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_required_feature_bit"))) TS_Bolt11InvoiceFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
49798         LDKBolt11InvoiceFeatures this_arg_conv;
49799         this_arg_conv.inner = untag_ptr(this_arg);
49800         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49802         this_arg_conv.is_owned = false;
49803         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49804         *ret_conv = Bolt11InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
49805         return tag_ptr(ret_conv, true);
49806 }
49807
49808 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_optional_feature_bit"))) TS_Bolt11InvoiceFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
49809         LDKBolt11InvoiceFeatures this_arg_conv;
49810         this_arg_conv.inner = untag_ptr(this_arg);
49811         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49813         this_arg_conv.is_owned = false;
49814         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49815         *ret_conv = Bolt11InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
49816         return tag_ptr(ret_conv, true);
49817 }
49818
49819 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_required_custom_bit"))) TS_Bolt11InvoiceFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
49820         LDKBolt11InvoiceFeatures this_arg_conv;
49821         this_arg_conv.inner = untag_ptr(this_arg);
49822         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49824         this_arg_conv.is_owned = false;
49825         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49826         *ret_conv = Bolt11InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
49827         return tag_ptr(ret_conv, true);
49828 }
49829
49830 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_optional_custom_bit"))) TS_Bolt11InvoiceFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
49831         LDKBolt11InvoiceFeatures this_arg_conv;
49832         this_arg_conv.inner = untag_ptr(this_arg);
49833         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49835         this_arg_conv.is_owned = false;
49836         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49837         *ret_conv = Bolt11InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
49838         return tag_ptr(ret_conv, true);
49839 }
49840
49841 uint64_t  __attribute__((export_name("TS_OfferFeatures_empty"))) TS_OfferFeatures_empty() {
49842         LDKOfferFeatures ret_var = OfferFeatures_empty();
49843         uint64_t ret_ref = 0;
49844         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49845         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49846         return ret_ref;
49847 }
49848
49849 jboolean  __attribute__((export_name("TS_OfferFeatures_requires_unknown_bits_from"))) TS_OfferFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
49850         LDKOfferFeatures this_arg_conv;
49851         this_arg_conv.inner = untag_ptr(this_arg);
49852         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49854         this_arg_conv.is_owned = false;
49855         LDKOfferFeatures other_conv;
49856         other_conv.inner = untag_ptr(other);
49857         other_conv.is_owned = ptr_is_owned(other);
49858         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
49859         other_conv.is_owned = false;
49860         jboolean ret_conv = OfferFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
49861         return ret_conv;
49862 }
49863
49864 jboolean  __attribute__((export_name("TS_OfferFeatures_requires_unknown_bits"))) TS_OfferFeatures_requires_unknown_bits(uint64_t this_arg) {
49865         LDKOfferFeatures this_arg_conv;
49866         this_arg_conv.inner = untag_ptr(this_arg);
49867         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49869         this_arg_conv.is_owned = false;
49870         jboolean ret_conv = OfferFeatures_requires_unknown_bits(&this_arg_conv);
49871         return ret_conv;
49872 }
49873
49874 uint64_t  __attribute__((export_name("TS_OfferFeatures_set_required_feature_bit"))) TS_OfferFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
49875         LDKOfferFeatures this_arg_conv;
49876         this_arg_conv.inner = untag_ptr(this_arg);
49877         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49879         this_arg_conv.is_owned = false;
49880         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49881         *ret_conv = OfferFeatures_set_required_feature_bit(&this_arg_conv, bit);
49882         return tag_ptr(ret_conv, true);
49883 }
49884
49885 uint64_t  __attribute__((export_name("TS_OfferFeatures_set_optional_feature_bit"))) TS_OfferFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
49886         LDKOfferFeatures this_arg_conv;
49887         this_arg_conv.inner = untag_ptr(this_arg);
49888         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49890         this_arg_conv.is_owned = false;
49891         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49892         *ret_conv = OfferFeatures_set_optional_feature_bit(&this_arg_conv, bit);
49893         return tag_ptr(ret_conv, true);
49894 }
49895
49896 uint64_t  __attribute__((export_name("TS_OfferFeatures_set_required_custom_bit"))) TS_OfferFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
49897         LDKOfferFeatures this_arg_conv;
49898         this_arg_conv.inner = untag_ptr(this_arg);
49899         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49901         this_arg_conv.is_owned = false;
49902         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49903         *ret_conv = OfferFeatures_set_required_custom_bit(&this_arg_conv, bit);
49904         return tag_ptr(ret_conv, true);
49905 }
49906
49907 uint64_t  __attribute__((export_name("TS_OfferFeatures_set_optional_custom_bit"))) TS_OfferFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
49908         LDKOfferFeatures this_arg_conv;
49909         this_arg_conv.inner = untag_ptr(this_arg);
49910         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49912         this_arg_conv.is_owned = false;
49913         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49914         *ret_conv = OfferFeatures_set_optional_custom_bit(&this_arg_conv, bit);
49915         return tag_ptr(ret_conv, true);
49916 }
49917
49918 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_empty"))) TS_InvoiceRequestFeatures_empty() {
49919         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_empty();
49920         uint64_t ret_ref = 0;
49921         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49922         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49923         return ret_ref;
49924 }
49925
49926 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_requires_unknown_bits_from"))) TS_InvoiceRequestFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
49927         LDKInvoiceRequestFeatures this_arg_conv;
49928         this_arg_conv.inner = untag_ptr(this_arg);
49929         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49931         this_arg_conv.is_owned = false;
49932         LDKInvoiceRequestFeatures other_conv;
49933         other_conv.inner = untag_ptr(other);
49934         other_conv.is_owned = ptr_is_owned(other);
49935         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
49936         other_conv.is_owned = false;
49937         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
49938         return ret_conv;
49939 }
49940
49941 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_requires_unknown_bits"))) TS_InvoiceRequestFeatures_requires_unknown_bits(uint64_t this_arg) {
49942         LDKInvoiceRequestFeatures this_arg_conv;
49943         this_arg_conv.inner = untag_ptr(this_arg);
49944         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49946         this_arg_conv.is_owned = false;
49947         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits(&this_arg_conv);
49948         return ret_conv;
49949 }
49950
49951 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_set_required_feature_bit"))) TS_InvoiceRequestFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
49952         LDKInvoiceRequestFeatures this_arg_conv;
49953         this_arg_conv.inner = untag_ptr(this_arg);
49954         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49956         this_arg_conv.is_owned = false;
49957         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49958         *ret_conv = InvoiceRequestFeatures_set_required_feature_bit(&this_arg_conv, bit);
49959         return tag_ptr(ret_conv, true);
49960 }
49961
49962 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_set_optional_feature_bit"))) TS_InvoiceRequestFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
49963         LDKInvoiceRequestFeatures this_arg_conv;
49964         this_arg_conv.inner = untag_ptr(this_arg);
49965         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49967         this_arg_conv.is_owned = false;
49968         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49969         *ret_conv = InvoiceRequestFeatures_set_optional_feature_bit(&this_arg_conv, bit);
49970         return tag_ptr(ret_conv, true);
49971 }
49972
49973 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_set_required_custom_bit"))) TS_InvoiceRequestFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
49974         LDKInvoiceRequestFeatures this_arg_conv;
49975         this_arg_conv.inner = untag_ptr(this_arg);
49976         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49978         this_arg_conv.is_owned = false;
49979         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49980         *ret_conv = InvoiceRequestFeatures_set_required_custom_bit(&this_arg_conv, bit);
49981         return tag_ptr(ret_conv, true);
49982 }
49983
49984 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_set_optional_custom_bit"))) TS_InvoiceRequestFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
49985         LDKInvoiceRequestFeatures this_arg_conv;
49986         this_arg_conv.inner = untag_ptr(this_arg);
49987         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49989         this_arg_conv.is_owned = false;
49990         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49991         *ret_conv = InvoiceRequestFeatures_set_optional_custom_bit(&this_arg_conv, bit);
49992         return tag_ptr(ret_conv, true);
49993 }
49994
49995 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_empty"))) TS_Bolt12InvoiceFeatures_empty() {
49996         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_empty();
49997         uint64_t ret_ref = 0;
49998         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49999         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50000         return ret_ref;
50001 }
50002
50003 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_unknown_bits_from"))) TS_Bolt12InvoiceFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
50004         LDKBolt12InvoiceFeatures this_arg_conv;
50005         this_arg_conv.inner = untag_ptr(this_arg);
50006         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50008         this_arg_conv.is_owned = false;
50009         LDKBolt12InvoiceFeatures other_conv;
50010         other_conv.inner = untag_ptr(other);
50011         other_conv.is_owned = ptr_is_owned(other);
50012         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
50013         other_conv.is_owned = false;
50014         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
50015         return ret_conv;
50016 }
50017
50018 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_unknown_bits"))) TS_Bolt12InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
50019         LDKBolt12InvoiceFeatures this_arg_conv;
50020         this_arg_conv.inner = untag_ptr(this_arg);
50021         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50023         this_arg_conv.is_owned = false;
50024         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
50025         return ret_conv;
50026 }
50027
50028 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_required_feature_bit"))) TS_Bolt12InvoiceFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
50029         LDKBolt12InvoiceFeatures this_arg_conv;
50030         this_arg_conv.inner = untag_ptr(this_arg);
50031         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50033         this_arg_conv.is_owned = false;
50034         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50035         *ret_conv = Bolt12InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
50036         return tag_ptr(ret_conv, true);
50037 }
50038
50039 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_optional_feature_bit"))) TS_Bolt12InvoiceFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
50040         LDKBolt12InvoiceFeatures this_arg_conv;
50041         this_arg_conv.inner = untag_ptr(this_arg);
50042         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50044         this_arg_conv.is_owned = false;
50045         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50046         *ret_conv = Bolt12InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
50047         return tag_ptr(ret_conv, true);
50048 }
50049
50050 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_required_custom_bit"))) TS_Bolt12InvoiceFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
50051         LDKBolt12InvoiceFeatures this_arg_conv;
50052         this_arg_conv.inner = untag_ptr(this_arg);
50053         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50055         this_arg_conv.is_owned = false;
50056         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50057         *ret_conv = Bolt12InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
50058         return tag_ptr(ret_conv, true);
50059 }
50060
50061 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_optional_custom_bit"))) TS_Bolt12InvoiceFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
50062         LDKBolt12InvoiceFeatures this_arg_conv;
50063         this_arg_conv.inner = untag_ptr(this_arg);
50064         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50066         this_arg_conv.is_owned = false;
50067         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50068         *ret_conv = Bolt12InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
50069         return tag_ptr(ret_conv, true);
50070 }
50071
50072 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_empty"))) TS_BlindedHopFeatures_empty() {
50073         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_empty();
50074         uint64_t ret_ref = 0;
50075         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50076         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50077         return ret_ref;
50078 }
50079
50080 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_requires_unknown_bits_from"))) TS_BlindedHopFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
50081         LDKBlindedHopFeatures this_arg_conv;
50082         this_arg_conv.inner = untag_ptr(this_arg);
50083         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50085         this_arg_conv.is_owned = false;
50086         LDKBlindedHopFeatures other_conv;
50087         other_conv.inner = untag_ptr(other);
50088         other_conv.is_owned = ptr_is_owned(other);
50089         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
50090         other_conv.is_owned = false;
50091         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
50092         return ret_conv;
50093 }
50094
50095 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_requires_unknown_bits"))) TS_BlindedHopFeatures_requires_unknown_bits(uint64_t this_arg) {
50096         LDKBlindedHopFeatures this_arg_conv;
50097         this_arg_conv.inner = untag_ptr(this_arg);
50098         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50100         this_arg_conv.is_owned = false;
50101         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits(&this_arg_conv);
50102         return ret_conv;
50103 }
50104
50105 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_set_required_feature_bit"))) TS_BlindedHopFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
50106         LDKBlindedHopFeatures this_arg_conv;
50107         this_arg_conv.inner = untag_ptr(this_arg);
50108         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50110         this_arg_conv.is_owned = false;
50111         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50112         *ret_conv = BlindedHopFeatures_set_required_feature_bit(&this_arg_conv, bit);
50113         return tag_ptr(ret_conv, true);
50114 }
50115
50116 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_set_optional_feature_bit"))) TS_BlindedHopFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
50117         LDKBlindedHopFeatures this_arg_conv;
50118         this_arg_conv.inner = untag_ptr(this_arg);
50119         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50121         this_arg_conv.is_owned = false;
50122         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50123         *ret_conv = BlindedHopFeatures_set_optional_feature_bit(&this_arg_conv, bit);
50124         return tag_ptr(ret_conv, true);
50125 }
50126
50127 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_set_required_custom_bit"))) TS_BlindedHopFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
50128         LDKBlindedHopFeatures this_arg_conv;
50129         this_arg_conv.inner = untag_ptr(this_arg);
50130         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50132         this_arg_conv.is_owned = false;
50133         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50134         *ret_conv = BlindedHopFeatures_set_required_custom_bit(&this_arg_conv, bit);
50135         return tag_ptr(ret_conv, true);
50136 }
50137
50138 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_set_optional_custom_bit"))) TS_BlindedHopFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
50139         LDKBlindedHopFeatures this_arg_conv;
50140         this_arg_conv.inner = untag_ptr(this_arg);
50141         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50143         this_arg_conv.is_owned = false;
50144         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50145         *ret_conv = BlindedHopFeatures_set_optional_custom_bit(&this_arg_conv, bit);
50146         return tag_ptr(ret_conv, true);
50147 }
50148
50149 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_empty"))) TS_ChannelTypeFeatures_empty() {
50150         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
50151         uint64_t ret_ref = 0;
50152         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50153         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50154         return ret_ref;
50155 }
50156
50157 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits_from"))) TS_ChannelTypeFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
50158         LDKChannelTypeFeatures this_arg_conv;
50159         this_arg_conv.inner = untag_ptr(this_arg);
50160         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50162         this_arg_conv.is_owned = false;
50163         LDKChannelTypeFeatures other_conv;
50164         other_conv.inner = untag_ptr(other);
50165         other_conv.is_owned = ptr_is_owned(other);
50166         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
50167         other_conv.is_owned = false;
50168         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
50169         return ret_conv;
50170 }
50171
50172 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits"))) TS_ChannelTypeFeatures_requires_unknown_bits(uint64_t this_arg) {
50173         LDKChannelTypeFeatures this_arg_conv;
50174         this_arg_conv.inner = untag_ptr(this_arg);
50175         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50177         this_arg_conv.is_owned = false;
50178         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
50179         return ret_conv;
50180 }
50181
50182 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_set_required_feature_bit"))) TS_ChannelTypeFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
50183         LDKChannelTypeFeatures this_arg_conv;
50184         this_arg_conv.inner = untag_ptr(this_arg);
50185         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50187         this_arg_conv.is_owned = false;
50188         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50189         *ret_conv = ChannelTypeFeatures_set_required_feature_bit(&this_arg_conv, bit);
50190         return tag_ptr(ret_conv, true);
50191 }
50192
50193 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_set_optional_feature_bit"))) TS_ChannelTypeFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
50194         LDKChannelTypeFeatures this_arg_conv;
50195         this_arg_conv.inner = untag_ptr(this_arg);
50196         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50198         this_arg_conv.is_owned = false;
50199         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50200         *ret_conv = ChannelTypeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
50201         return tag_ptr(ret_conv, true);
50202 }
50203
50204 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_set_required_custom_bit"))) TS_ChannelTypeFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
50205         LDKChannelTypeFeatures this_arg_conv;
50206         this_arg_conv.inner = untag_ptr(this_arg);
50207         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50209         this_arg_conv.is_owned = false;
50210         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50211         *ret_conv = ChannelTypeFeatures_set_required_custom_bit(&this_arg_conv, bit);
50212         return tag_ptr(ret_conv, true);
50213 }
50214
50215 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_set_optional_custom_bit"))) TS_ChannelTypeFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
50216         LDKChannelTypeFeatures this_arg_conv;
50217         this_arg_conv.inner = untag_ptr(this_arg);
50218         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50220         this_arg_conv.is_owned = false;
50221         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
50222         *ret_conv = ChannelTypeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
50223         return tag_ptr(ret_conv, true);
50224 }
50225
50226 int8_tArray  __attribute__((export_name("TS_InitFeatures_write"))) TS_InitFeatures_write(uint64_t obj) {
50227         LDKInitFeatures obj_conv;
50228         obj_conv.inner = untag_ptr(obj);
50229         obj_conv.is_owned = ptr_is_owned(obj);
50230         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50231         obj_conv.is_owned = false;
50232         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
50233         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50234         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50235         CVec_u8Z_free(ret_var);
50236         return ret_arr;
50237 }
50238
50239 uint64_t  __attribute__((export_name("TS_InitFeatures_read"))) TS_InitFeatures_read(int8_tArray ser) {
50240         LDKu8slice ser_ref;
50241         ser_ref.datalen = ser->arr_len;
50242         ser_ref.data = ser->elems;
50243         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
50244         *ret_conv = InitFeatures_read(ser_ref);
50245         FREE(ser);
50246         return tag_ptr(ret_conv, true);
50247 }
50248
50249 int8_tArray  __attribute__((export_name("TS_ChannelFeatures_write"))) TS_ChannelFeatures_write(uint64_t obj) {
50250         LDKChannelFeatures obj_conv;
50251         obj_conv.inner = untag_ptr(obj);
50252         obj_conv.is_owned = ptr_is_owned(obj);
50253         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50254         obj_conv.is_owned = false;
50255         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
50256         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50257         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50258         CVec_u8Z_free(ret_var);
50259         return ret_arr;
50260 }
50261
50262 uint64_t  __attribute__((export_name("TS_ChannelFeatures_read"))) TS_ChannelFeatures_read(int8_tArray ser) {
50263         LDKu8slice ser_ref;
50264         ser_ref.datalen = ser->arr_len;
50265         ser_ref.data = ser->elems;
50266         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
50267         *ret_conv = ChannelFeatures_read(ser_ref);
50268         FREE(ser);
50269         return tag_ptr(ret_conv, true);
50270 }
50271
50272 int8_tArray  __attribute__((export_name("TS_NodeFeatures_write"))) TS_NodeFeatures_write(uint64_t obj) {
50273         LDKNodeFeatures obj_conv;
50274         obj_conv.inner = untag_ptr(obj);
50275         obj_conv.is_owned = ptr_is_owned(obj);
50276         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50277         obj_conv.is_owned = false;
50278         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
50279         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50280         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50281         CVec_u8Z_free(ret_var);
50282         return ret_arr;
50283 }
50284
50285 uint64_t  __attribute__((export_name("TS_NodeFeatures_read"))) TS_NodeFeatures_read(int8_tArray ser) {
50286         LDKu8slice ser_ref;
50287         ser_ref.datalen = ser->arr_len;
50288         ser_ref.data = ser->elems;
50289         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
50290         *ret_conv = NodeFeatures_read(ser_ref);
50291         FREE(ser);
50292         return tag_ptr(ret_conv, true);
50293 }
50294
50295 int8_tArray  __attribute__((export_name("TS_Bolt11InvoiceFeatures_write"))) TS_Bolt11InvoiceFeatures_write(uint64_t obj) {
50296         LDKBolt11InvoiceFeatures obj_conv;
50297         obj_conv.inner = untag_ptr(obj);
50298         obj_conv.is_owned = ptr_is_owned(obj);
50299         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50300         obj_conv.is_owned = false;
50301         LDKCVec_u8Z ret_var = Bolt11InvoiceFeatures_write(&obj_conv);
50302         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50303         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50304         CVec_u8Z_free(ret_var);
50305         return ret_arr;
50306 }
50307
50308 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_read"))) TS_Bolt11InvoiceFeatures_read(int8_tArray ser) {
50309         LDKu8slice ser_ref;
50310         ser_ref.datalen = ser->arr_len;
50311         ser_ref.data = ser->elems;
50312         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
50313         *ret_conv = Bolt11InvoiceFeatures_read(ser_ref);
50314         FREE(ser);
50315         return tag_ptr(ret_conv, true);
50316 }
50317
50318 int8_tArray  __attribute__((export_name("TS_Bolt12InvoiceFeatures_write"))) TS_Bolt12InvoiceFeatures_write(uint64_t obj) {
50319         LDKBolt12InvoiceFeatures obj_conv;
50320         obj_conv.inner = untag_ptr(obj);
50321         obj_conv.is_owned = ptr_is_owned(obj);
50322         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50323         obj_conv.is_owned = false;
50324         LDKCVec_u8Z ret_var = Bolt12InvoiceFeatures_write(&obj_conv);
50325         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50326         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50327         CVec_u8Z_free(ret_var);
50328         return ret_arr;
50329 }
50330
50331 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_read"))) TS_Bolt12InvoiceFeatures_read(int8_tArray ser) {
50332         LDKu8slice ser_ref;
50333         ser_ref.datalen = ser->arr_len;
50334         ser_ref.data = ser->elems;
50335         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
50336         *ret_conv = Bolt12InvoiceFeatures_read(ser_ref);
50337         FREE(ser);
50338         return tag_ptr(ret_conv, true);
50339 }
50340
50341 int8_tArray  __attribute__((export_name("TS_BlindedHopFeatures_write"))) TS_BlindedHopFeatures_write(uint64_t obj) {
50342         LDKBlindedHopFeatures obj_conv;
50343         obj_conv.inner = untag_ptr(obj);
50344         obj_conv.is_owned = ptr_is_owned(obj);
50345         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50346         obj_conv.is_owned = false;
50347         LDKCVec_u8Z ret_var = BlindedHopFeatures_write(&obj_conv);
50348         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50349         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50350         CVec_u8Z_free(ret_var);
50351         return ret_arr;
50352 }
50353
50354 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_read"))) TS_BlindedHopFeatures_read(int8_tArray ser) {
50355         LDKu8slice ser_ref;
50356         ser_ref.datalen = ser->arr_len;
50357         ser_ref.data = ser->elems;
50358         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
50359         *ret_conv = BlindedHopFeatures_read(ser_ref);
50360         FREE(ser);
50361         return tag_ptr(ret_conv, true);
50362 }
50363
50364 int8_tArray  __attribute__((export_name("TS_ChannelTypeFeatures_write"))) TS_ChannelTypeFeatures_write(uint64_t obj) {
50365         LDKChannelTypeFeatures obj_conv;
50366         obj_conv.inner = untag_ptr(obj);
50367         obj_conv.is_owned = ptr_is_owned(obj);
50368         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50369         obj_conv.is_owned = false;
50370         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
50371         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50372         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50373         CVec_u8Z_free(ret_var);
50374         return ret_arr;
50375 }
50376
50377 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_read"))) TS_ChannelTypeFeatures_read(int8_tArray ser) {
50378         LDKu8slice ser_ref;
50379         ser_ref.datalen = ser->arr_len;
50380         ser_ref.data = ser->elems;
50381         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
50382         *ret_conv = ChannelTypeFeatures_read(ser_ref);
50383         FREE(ser);
50384         return tag_ptr(ret_conv, true);
50385 }
50386
50387 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_optional"))) TS_InitFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
50388         LDKInitFeatures this_arg_conv;
50389         this_arg_conv.inner = untag_ptr(this_arg);
50390         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50392         this_arg_conv.is_owned = false;
50393         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
50394 }
50395
50396 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_required"))) TS_InitFeatures_set_data_loss_protect_required(uint64_t this_arg) {
50397         LDKInitFeatures this_arg_conv;
50398         this_arg_conv.inner = untag_ptr(this_arg);
50399         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50401         this_arg_conv.is_owned = false;
50402         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
50403 }
50404
50405 jboolean  __attribute__((export_name("TS_InitFeatures_supports_data_loss_protect"))) TS_InitFeatures_supports_data_loss_protect(uint64_t this_arg) {
50406         LDKInitFeatures this_arg_conv;
50407         this_arg_conv.inner = untag_ptr(this_arg);
50408         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50410         this_arg_conv.is_owned = false;
50411         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
50412         return ret_conv;
50413 }
50414
50415 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_optional"))) TS_NodeFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
50416         LDKNodeFeatures this_arg_conv;
50417         this_arg_conv.inner = untag_ptr(this_arg);
50418         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50420         this_arg_conv.is_owned = false;
50421         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
50422 }
50423
50424 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_required"))) TS_NodeFeatures_set_data_loss_protect_required(uint64_t this_arg) {
50425         LDKNodeFeatures this_arg_conv;
50426         this_arg_conv.inner = untag_ptr(this_arg);
50427         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50429         this_arg_conv.is_owned = false;
50430         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
50431 }
50432
50433 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_data_loss_protect"))) TS_NodeFeatures_supports_data_loss_protect(uint64_t this_arg) {
50434         LDKNodeFeatures this_arg_conv;
50435         this_arg_conv.inner = untag_ptr(this_arg);
50436         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50438         this_arg_conv.is_owned = false;
50439         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
50440         return ret_conv;
50441 }
50442
50443 jboolean  __attribute__((export_name("TS_InitFeatures_requires_data_loss_protect"))) TS_InitFeatures_requires_data_loss_protect(uint64_t this_arg) {
50444         LDKInitFeatures this_arg_conv;
50445         this_arg_conv.inner = untag_ptr(this_arg);
50446         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50448         this_arg_conv.is_owned = false;
50449         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
50450         return ret_conv;
50451 }
50452
50453 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_data_loss_protect"))) TS_NodeFeatures_requires_data_loss_protect(uint64_t this_arg) {
50454         LDKNodeFeatures this_arg_conv;
50455         this_arg_conv.inner = untag_ptr(this_arg);
50456         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50458         this_arg_conv.is_owned = false;
50459         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
50460         return ret_conv;
50461 }
50462
50463 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_optional"))) TS_InitFeatures_set_initial_routing_sync_optional(uint64_t this_arg) {
50464         LDKInitFeatures this_arg_conv;
50465         this_arg_conv.inner = untag_ptr(this_arg);
50466         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50468         this_arg_conv.is_owned = false;
50469         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
50470 }
50471
50472 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_required"))) TS_InitFeatures_set_initial_routing_sync_required(uint64_t this_arg) {
50473         LDKInitFeatures this_arg_conv;
50474         this_arg_conv.inner = untag_ptr(this_arg);
50475         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50477         this_arg_conv.is_owned = false;
50478         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
50479 }
50480
50481 jboolean  __attribute__((export_name("TS_InitFeatures_initial_routing_sync"))) TS_InitFeatures_initial_routing_sync(uint64_t this_arg) {
50482         LDKInitFeatures this_arg_conv;
50483         this_arg_conv.inner = untag_ptr(this_arg);
50484         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50486         this_arg_conv.is_owned = false;
50487         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
50488         return ret_conv;
50489 }
50490
50491 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_optional"))) TS_InitFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
50492         LDKInitFeatures this_arg_conv;
50493         this_arg_conv.inner = untag_ptr(this_arg);
50494         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50496         this_arg_conv.is_owned = false;
50497         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
50498 }
50499
50500 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_required"))) TS_InitFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
50501         LDKInitFeatures this_arg_conv;
50502         this_arg_conv.inner = untag_ptr(this_arg);
50503         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50505         this_arg_conv.is_owned = false;
50506         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
50507 }
50508
50509 jboolean  __attribute__((export_name("TS_InitFeatures_supports_upfront_shutdown_script"))) TS_InitFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
50510         LDKInitFeatures this_arg_conv;
50511         this_arg_conv.inner = untag_ptr(this_arg);
50512         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50514         this_arg_conv.is_owned = false;
50515         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
50516         return ret_conv;
50517 }
50518
50519 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_optional"))) TS_NodeFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
50520         LDKNodeFeatures this_arg_conv;
50521         this_arg_conv.inner = untag_ptr(this_arg);
50522         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50524         this_arg_conv.is_owned = false;
50525         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
50526 }
50527
50528 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_required"))) TS_NodeFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
50529         LDKNodeFeatures this_arg_conv;
50530         this_arg_conv.inner = untag_ptr(this_arg);
50531         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50533         this_arg_conv.is_owned = false;
50534         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
50535 }
50536
50537 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_upfront_shutdown_script"))) TS_NodeFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
50538         LDKNodeFeatures this_arg_conv;
50539         this_arg_conv.inner = untag_ptr(this_arg);
50540         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50542         this_arg_conv.is_owned = false;
50543         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
50544         return ret_conv;
50545 }
50546
50547 jboolean  __attribute__((export_name("TS_InitFeatures_requires_upfront_shutdown_script"))) TS_InitFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
50548         LDKInitFeatures this_arg_conv;
50549         this_arg_conv.inner = untag_ptr(this_arg);
50550         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50552         this_arg_conv.is_owned = false;
50553         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
50554         return ret_conv;
50555 }
50556
50557 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_upfront_shutdown_script"))) TS_NodeFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
50558         LDKNodeFeatures this_arg_conv;
50559         this_arg_conv.inner = untag_ptr(this_arg);
50560         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50562         this_arg_conv.is_owned = false;
50563         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
50564         return ret_conv;
50565 }
50566
50567 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_optional"))) TS_InitFeatures_set_gossip_queries_optional(uint64_t this_arg) {
50568         LDKInitFeatures this_arg_conv;
50569         this_arg_conv.inner = untag_ptr(this_arg);
50570         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50572         this_arg_conv.is_owned = false;
50573         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
50574 }
50575
50576 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_required"))) TS_InitFeatures_set_gossip_queries_required(uint64_t this_arg) {
50577         LDKInitFeatures this_arg_conv;
50578         this_arg_conv.inner = untag_ptr(this_arg);
50579         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50581         this_arg_conv.is_owned = false;
50582         InitFeatures_set_gossip_queries_required(&this_arg_conv);
50583 }
50584
50585 jboolean  __attribute__((export_name("TS_InitFeatures_supports_gossip_queries"))) TS_InitFeatures_supports_gossip_queries(uint64_t this_arg) {
50586         LDKInitFeatures this_arg_conv;
50587         this_arg_conv.inner = untag_ptr(this_arg);
50588         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50590         this_arg_conv.is_owned = false;
50591         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
50592         return ret_conv;
50593 }
50594
50595 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_optional"))) TS_NodeFeatures_set_gossip_queries_optional(uint64_t this_arg) {
50596         LDKNodeFeatures this_arg_conv;
50597         this_arg_conv.inner = untag_ptr(this_arg);
50598         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50600         this_arg_conv.is_owned = false;
50601         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
50602 }
50603
50604 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_required"))) TS_NodeFeatures_set_gossip_queries_required(uint64_t this_arg) {
50605         LDKNodeFeatures this_arg_conv;
50606         this_arg_conv.inner = untag_ptr(this_arg);
50607         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50609         this_arg_conv.is_owned = false;
50610         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
50611 }
50612
50613 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_gossip_queries"))) TS_NodeFeatures_supports_gossip_queries(uint64_t this_arg) {
50614         LDKNodeFeatures this_arg_conv;
50615         this_arg_conv.inner = untag_ptr(this_arg);
50616         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50618         this_arg_conv.is_owned = false;
50619         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
50620         return ret_conv;
50621 }
50622
50623 jboolean  __attribute__((export_name("TS_InitFeatures_requires_gossip_queries"))) TS_InitFeatures_requires_gossip_queries(uint64_t this_arg) {
50624         LDKInitFeatures this_arg_conv;
50625         this_arg_conv.inner = untag_ptr(this_arg);
50626         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50628         this_arg_conv.is_owned = false;
50629         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
50630         return ret_conv;
50631 }
50632
50633 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_gossip_queries"))) TS_NodeFeatures_requires_gossip_queries(uint64_t this_arg) {
50634         LDKNodeFeatures this_arg_conv;
50635         this_arg_conv.inner = untag_ptr(this_arg);
50636         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50638         this_arg_conv.is_owned = false;
50639         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
50640         return ret_conv;
50641 }
50642
50643 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_optional"))) TS_InitFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
50644         LDKInitFeatures this_arg_conv;
50645         this_arg_conv.inner = untag_ptr(this_arg);
50646         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50648         this_arg_conv.is_owned = false;
50649         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
50650 }
50651
50652 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_required"))) TS_InitFeatures_set_variable_length_onion_required(uint64_t this_arg) {
50653         LDKInitFeatures this_arg_conv;
50654         this_arg_conv.inner = untag_ptr(this_arg);
50655         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50657         this_arg_conv.is_owned = false;
50658         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
50659 }
50660
50661 jboolean  __attribute__((export_name("TS_InitFeatures_supports_variable_length_onion"))) TS_InitFeatures_supports_variable_length_onion(uint64_t this_arg) {
50662         LDKInitFeatures this_arg_conv;
50663         this_arg_conv.inner = untag_ptr(this_arg);
50664         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50666         this_arg_conv.is_owned = false;
50667         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
50668         return ret_conv;
50669 }
50670
50671 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_optional"))) TS_NodeFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
50672         LDKNodeFeatures this_arg_conv;
50673         this_arg_conv.inner = untag_ptr(this_arg);
50674         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50676         this_arg_conv.is_owned = false;
50677         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
50678 }
50679
50680 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_required"))) TS_NodeFeatures_set_variable_length_onion_required(uint64_t this_arg) {
50681         LDKNodeFeatures this_arg_conv;
50682         this_arg_conv.inner = untag_ptr(this_arg);
50683         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50685         this_arg_conv.is_owned = false;
50686         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
50687 }
50688
50689 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_variable_length_onion"))) TS_NodeFeatures_supports_variable_length_onion(uint64_t this_arg) {
50690         LDKNodeFeatures this_arg_conv;
50691         this_arg_conv.inner = untag_ptr(this_arg);
50692         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50694         this_arg_conv.is_owned = false;
50695         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
50696         return ret_conv;
50697 }
50698
50699 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_variable_length_onion_optional"))) TS_Bolt11InvoiceFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
50700         LDKBolt11InvoiceFeatures this_arg_conv;
50701         this_arg_conv.inner = untag_ptr(this_arg);
50702         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50704         this_arg_conv.is_owned = false;
50705         Bolt11InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
50706 }
50707
50708 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_variable_length_onion_required"))) TS_Bolt11InvoiceFeatures_set_variable_length_onion_required(uint64_t this_arg) {
50709         LDKBolt11InvoiceFeatures this_arg_conv;
50710         this_arg_conv.inner = untag_ptr(this_arg);
50711         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50713         this_arg_conv.is_owned = false;
50714         Bolt11InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
50715 }
50716
50717 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_variable_length_onion"))) TS_Bolt11InvoiceFeatures_supports_variable_length_onion(uint64_t this_arg) {
50718         LDKBolt11InvoiceFeatures this_arg_conv;
50719         this_arg_conv.inner = untag_ptr(this_arg);
50720         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50722         this_arg_conv.is_owned = false;
50723         jboolean ret_conv = Bolt11InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
50724         return ret_conv;
50725 }
50726
50727 jboolean  __attribute__((export_name("TS_InitFeatures_requires_variable_length_onion"))) TS_InitFeatures_requires_variable_length_onion(uint64_t this_arg) {
50728         LDKInitFeatures this_arg_conv;
50729         this_arg_conv.inner = untag_ptr(this_arg);
50730         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50732         this_arg_conv.is_owned = false;
50733         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
50734         return ret_conv;
50735 }
50736
50737 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_variable_length_onion"))) TS_NodeFeatures_requires_variable_length_onion(uint64_t this_arg) {
50738         LDKNodeFeatures this_arg_conv;
50739         this_arg_conv.inner = untag_ptr(this_arg);
50740         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50742         this_arg_conv.is_owned = false;
50743         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
50744         return ret_conv;
50745 }
50746
50747 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_variable_length_onion"))) TS_Bolt11InvoiceFeatures_requires_variable_length_onion(uint64_t this_arg) {
50748         LDKBolt11InvoiceFeatures this_arg_conv;
50749         this_arg_conv.inner = untag_ptr(this_arg);
50750         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50752         this_arg_conv.is_owned = false;
50753         jboolean ret_conv = Bolt11InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
50754         return ret_conv;
50755 }
50756
50757 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_optional"))) TS_InitFeatures_set_static_remote_key_optional(uint64_t this_arg) {
50758         LDKInitFeatures this_arg_conv;
50759         this_arg_conv.inner = untag_ptr(this_arg);
50760         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50762         this_arg_conv.is_owned = false;
50763         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
50764 }
50765
50766 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_required"))) TS_InitFeatures_set_static_remote_key_required(uint64_t this_arg) {
50767         LDKInitFeatures this_arg_conv;
50768         this_arg_conv.inner = untag_ptr(this_arg);
50769         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50771         this_arg_conv.is_owned = false;
50772         InitFeatures_set_static_remote_key_required(&this_arg_conv);
50773 }
50774
50775 jboolean  __attribute__((export_name("TS_InitFeatures_supports_static_remote_key"))) TS_InitFeatures_supports_static_remote_key(uint64_t this_arg) {
50776         LDKInitFeatures this_arg_conv;
50777         this_arg_conv.inner = untag_ptr(this_arg);
50778         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50780         this_arg_conv.is_owned = false;
50781         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
50782         return ret_conv;
50783 }
50784
50785 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_optional"))) TS_NodeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
50786         LDKNodeFeatures this_arg_conv;
50787         this_arg_conv.inner = untag_ptr(this_arg);
50788         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50790         this_arg_conv.is_owned = false;
50791         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
50792 }
50793
50794 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_required"))) TS_NodeFeatures_set_static_remote_key_required(uint64_t this_arg) {
50795         LDKNodeFeatures this_arg_conv;
50796         this_arg_conv.inner = untag_ptr(this_arg);
50797         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50799         this_arg_conv.is_owned = false;
50800         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
50801 }
50802
50803 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_static_remote_key"))) TS_NodeFeatures_supports_static_remote_key(uint64_t this_arg) {
50804         LDKNodeFeatures this_arg_conv;
50805         this_arg_conv.inner = untag_ptr(this_arg);
50806         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50808         this_arg_conv.is_owned = false;
50809         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
50810         return ret_conv;
50811 }
50812
50813 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_optional"))) TS_ChannelTypeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
50814         LDKChannelTypeFeatures this_arg_conv;
50815         this_arg_conv.inner = untag_ptr(this_arg);
50816         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50818         this_arg_conv.is_owned = false;
50819         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
50820 }
50821
50822 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_required"))) TS_ChannelTypeFeatures_set_static_remote_key_required(uint64_t this_arg) {
50823         LDKChannelTypeFeatures this_arg_conv;
50824         this_arg_conv.inner = untag_ptr(this_arg);
50825         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50827         this_arg_conv.is_owned = false;
50828         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
50829 }
50830
50831 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_static_remote_key"))) TS_ChannelTypeFeatures_supports_static_remote_key(uint64_t this_arg) {
50832         LDKChannelTypeFeatures this_arg_conv;
50833         this_arg_conv.inner = untag_ptr(this_arg);
50834         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50836         this_arg_conv.is_owned = false;
50837         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
50838         return ret_conv;
50839 }
50840
50841 jboolean  __attribute__((export_name("TS_InitFeatures_requires_static_remote_key"))) TS_InitFeatures_requires_static_remote_key(uint64_t this_arg) {
50842         LDKInitFeatures this_arg_conv;
50843         this_arg_conv.inner = untag_ptr(this_arg);
50844         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50846         this_arg_conv.is_owned = false;
50847         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
50848         return ret_conv;
50849 }
50850
50851 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_static_remote_key"))) TS_NodeFeatures_requires_static_remote_key(uint64_t this_arg) {
50852         LDKNodeFeatures this_arg_conv;
50853         this_arg_conv.inner = untag_ptr(this_arg);
50854         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50856         this_arg_conv.is_owned = false;
50857         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
50858         return ret_conv;
50859 }
50860
50861 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_static_remote_key"))) TS_ChannelTypeFeatures_requires_static_remote_key(uint64_t this_arg) {
50862         LDKChannelTypeFeatures this_arg_conv;
50863         this_arg_conv.inner = untag_ptr(this_arg);
50864         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50866         this_arg_conv.is_owned = false;
50867         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
50868         return ret_conv;
50869 }
50870
50871 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_optional"))) TS_InitFeatures_set_payment_secret_optional(uint64_t this_arg) {
50872         LDKInitFeatures this_arg_conv;
50873         this_arg_conv.inner = untag_ptr(this_arg);
50874         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50876         this_arg_conv.is_owned = false;
50877         InitFeatures_set_payment_secret_optional(&this_arg_conv);
50878 }
50879
50880 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_required"))) TS_InitFeatures_set_payment_secret_required(uint64_t this_arg) {
50881         LDKInitFeatures this_arg_conv;
50882         this_arg_conv.inner = untag_ptr(this_arg);
50883         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50885         this_arg_conv.is_owned = false;
50886         InitFeatures_set_payment_secret_required(&this_arg_conv);
50887 }
50888
50889 jboolean  __attribute__((export_name("TS_InitFeatures_supports_payment_secret"))) TS_InitFeatures_supports_payment_secret(uint64_t this_arg) {
50890         LDKInitFeatures this_arg_conv;
50891         this_arg_conv.inner = untag_ptr(this_arg);
50892         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50894         this_arg_conv.is_owned = false;
50895         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
50896         return ret_conv;
50897 }
50898
50899 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_optional"))) TS_NodeFeatures_set_payment_secret_optional(uint64_t this_arg) {
50900         LDKNodeFeatures this_arg_conv;
50901         this_arg_conv.inner = untag_ptr(this_arg);
50902         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50904         this_arg_conv.is_owned = false;
50905         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
50906 }
50907
50908 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_required"))) TS_NodeFeatures_set_payment_secret_required(uint64_t this_arg) {
50909         LDKNodeFeatures this_arg_conv;
50910         this_arg_conv.inner = untag_ptr(this_arg);
50911         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50913         this_arg_conv.is_owned = false;
50914         NodeFeatures_set_payment_secret_required(&this_arg_conv);
50915 }
50916
50917 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_payment_secret"))) TS_NodeFeatures_supports_payment_secret(uint64_t this_arg) {
50918         LDKNodeFeatures this_arg_conv;
50919         this_arg_conv.inner = untag_ptr(this_arg);
50920         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50922         this_arg_conv.is_owned = false;
50923         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
50924         return ret_conv;
50925 }
50926
50927 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_secret_optional"))) TS_Bolt11InvoiceFeatures_set_payment_secret_optional(uint64_t this_arg) {
50928         LDKBolt11InvoiceFeatures this_arg_conv;
50929         this_arg_conv.inner = untag_ptr(this_arg);
50930         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50932         this_arg_conv.is_owned = false;
50933         Bolt11InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
50934 }
50935
50936 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_secret_required"))) TS_Bolt11InvoiceFeatures_set_payment_secret_required(uint64_t this_arg) {
50937         LDKBolt11InvoiceFeatures this_arg_conv;
50938         this_arg_conv.inner = untag_ptr(this_arg);
50939         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50941         this_arg_conv.is_owned = false;
50942         Bolt11InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
50943 }
50944
50945 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_payment_secret"))) TS_Bolt11InvoiceFeatures_supports_payment_secret(uint64_t this_arg) {
50946         LDKBolt11InvoiceFeatures this_arg_conv;
50947         this_arg_conv.inner = untag_ptr(this_arg);
50948         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50950         this_arg_conv.is_owned = false;
50951         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_secret(&this_arg_conv);
50952         return ret_conv;
50953 }
50954
50955 jboolean  __attribute__((export_name("TS_InitFeatures_requires_payment_secret"))) TS_InitFeatures_requires_payment_secret(uint64_t this_arg) {
50956         LDKInitFeatures this_arg_conv;
50957         this_arg_conv.inner = untag_ptr(this_arg);
50958         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50960         this_arg_conv.is_owned = false;
50961         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
50962         return ret_conv;
50963 }
50964
50965 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_payment_secret"))) TS_NodeFeatures_requires_payment_secret(uint64_t this_arg) {
50966         LDKNodeFeatures this_arg_conv;
50967         this_arg_conv.inner = untag_ptr(this_arg);
50968         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50970         this_arg_conv.is_owned = false;
50971         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
50972         return ret_conv;
50973 }
50974
50975 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_payment_secret"))) TS_Bolt11InvoiceFeatures_requires_payment_secret(uint64_t this_arg) {
50976         LDKBolt11InvoiceFeatures this_arg_conv;
50977         this_arg_conv.inner = untag_ptr(this_arg);
50978         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50980         this_arg_conv.is_owned = false;
50981         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_secret(&this_arg_conv);
50982         return ret_conv;
50983 }
50984
50985 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_optional"))) TS_InitFeatures_set_basic_mpp_optional(uint64_t this_arg) {
50986         LDKInitFeatures this_arg_conv;
50987         this_arg_conv.inner = untag_ptr(this_arg);
50988         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50990         this_arg_conv.is_owned = false;
50991         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
50992 }
50993
50994 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_required"))) TS_InitFeatures_set_basic_mpp_required(uint64_t this_arg) {
50995         LDKInitFeatures this_arg_conv;
50996         this_arg_conv.inner = untag_ptr(this_arg);
50997         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50999         this_arg_conv.is_owned = false;
51000         InitFeatures_set_basic_mpp_required(&this_arg_conv);
51001 }
51002
51003 jboolean  __attribute__((export_name("TS_InitFeatures_supports_basic_mpp"))) TS_InitFeatures_supports_basic_mpp(uint64_t this_arg) {
51004         LDKInitFeatures this_arg_conv;
51005         this_arg_conv.inner = untag_ptr(this_arg);
51006         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51008         this_arg_conv.is_owned = false;
51009         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
51010         return ret_conv;
51011 }
51012
51013 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_optional"))) TS_NodeFeatures_set_basic_mpp_optional(uint64_t this_arg) {
51014         LDKNodeFeatures this_arg_conv;
51015         this_arg_conv.inner = untag_ptr(this_arg);
51016         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51018         this_arg_conv.is_owned = false;
51019         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
51020 }
51021
51022 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_required"))) TS_NodeFeatures_set_basic_mpp_required(uint64_t this_arg) {
51023         LDKNodeFeatures this_arg_conv;
51024         this_arg_conv.inner = untag_ptr(this_arg);
51025         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51027         this_arg_conv.is_owned = false;
51028         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
51029 }
51030
51031 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_basic_mpp"))) TS_NodeFeatures_supports_basic_mpp(uint64_t this_arg) {
51032         LDKNodeFeatures this_arg_conv;
51033         this_arg_conv.inner = untag_ptr(this_arg);
51034         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51036         this_arg_conv.is_owned = false;
51037         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
51038         return ret_conv;
51039 }
51040
51041 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_basic_mpp_optional"))) TS_Bolt11InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
51042         LDKBolt11InvoiceFeatures this_arg_conv;
51043         this_arg_conv.inner = untag_ptr(this_arg);
51044         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51046         this_arg_conv.is_owned = false;
51047         Bolt11InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
51048 }
51049
51050 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_basic_mpp_required"))) TS_Bolt11InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
51051         LDKBolt11InvoiceFeatures this_arg_conv;
51052         this_arg_conv.inner = untag_ptr(this_arg);
51053         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51055         this_arg_conv.is_owned = false;
51056         Bolt11InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
51057 }
51058
51059 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_basic_mpp"))) TS_Bolt11InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
51060         LDKBolt11InvoiceFeatures this_arg_conv;
51061         this_arg_conv.inner = untag_ptr(this_arg);
51062         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51064         this_arg_conv.is_owned = false;
51065         jboolean ret_conv = Bolt11InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
51066         return ret_conv;
51067 }
51068
51069 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_basic_mpp_optional"))) TS_Bolt12InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
51070         LDKBolt12InvoiceFeatures this_arg_conv;
51071         this_arg_conv.inner = untag_ptr(this_arg);
51072         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51074         this_arg_conv.is_owned = false;
51075         Bolt12InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
51076 }
51077
51078 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_basic_mpp_required"))) TS_Bolt12InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
51079         LDKBolt12InvoiceFeatures this_arg_conv;
51080         this_arg_conv.inner = untag_ptr(this_arg);
51081         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51083         this_arg_conv.is_owned = false;
51084         Bolt12InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
51085 }
51086
51087 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_supports_basic_mpp"))) TS_Bolt12InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
51088         LDKBolt12InvoiceFeatures this_arg_conv;
51089         this_arg_conv.inner = untag_ptr(this_arg);
51090         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51092         this_arg_conv.is_owned = false;
51093         jboolean ret_conv = Bolt12InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
51094         return ret_conv;
51095 }
51096
51097 jboolean  __attribute__((export_name("TS_InitFeatures_requires_basic_mpp"))) TS_InitFeatures_requires_basic_mpp(uint64_t this_arg) {
51098         LDKInitFeatures this_arg_conv;
51099         this_arg_conv.inner = untag_ptr(this_arg);
51100         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51102         this_arg_conv.is_owned = false;
51103         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
51104         return ret_conv;
51105 }
51106
51107 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_basic_mpp"))) TS_NodeFeatures_requires_basic_mpp(uint64_t this_arg) {
51108         LDKNodeFeatures this_arg_conv;
51109         this_arg_conv.inner = untag_ptr(this_arg);
51110         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51112         this_arg_conv.is_owned = false;
51113         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
51114         return ret_conv;
51115 }
51116
51117 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_basic_mpp"))) TS_Bolt11InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
51118         LDKBolt11InvoiceFeatures this_arg_conv;
51119         this_arg_conv.inner = untag_ptr(this_arg);
51120         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51122         this_arg_conv.is_owned = false;
51123         jboolean ret_conv = Bolt11InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
51124         return ret_conv;
51125 }
51126
51127 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_basic_mpp"))) TS_Bolt12InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
51128         LDKBolt12InvoiceFeatures this_arg_conv;
51129         this_arg_conv.inner = untag_ptr(this_arg);
51130         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51132         this_arg_conv.is_owned = false;
51133         jboolean ret_conv = Bolt12InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
51134         return ret_conv;
51135 }
51136
51137 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_optional"))) TS_InitFeatures_set_wumbo_optional(uint64_t this_arg) {
51138         LDKInitFeatures this_arg_conv;
51139         this_arg_conv.inner = untag_ptr(this_arg);
51140         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51142         this_arg_conv.is_owned = false;
51143         InitFeatures_set_wumbo_optional(&this_arg_conv);
51144 }
51145
51146 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_required"))) TS_InitFeatures_set_wumbo_required(uint64_t this_arg) {
51147         LDKInitFeatures this_arg_conv;
51148         this_arg_conv.inner = untag_ptr(this_arg);
51149         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51151         this_arg_conv.is_owned = false;
51152         InitFeatures_set_wumbo_required(&this_arg_conv);
51153 }
51154
51155 jboolean  __attribute__((export_name("TS_InitFeatures_supports_wumbo"))) TS_InitFeatures_supports_wumbo(uint64_t this_arg) {
51156         LDKInitFeatures this_arg_conv;
51157         this_arg_conv.inner = untag_ptr(this_arg);
51158         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51160         this_arg_conv.is_owned = false;
51161         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
51162         return ret_conv;
51163 }
51164
51165 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_optional"))) TS_NodeFeatures_set_wumbo_optional(uint64_t this_arg) {
51166         LDKNodeFeatures this_arg_conv;
51167         this_arg_conv.inner = untag_ptr(this_arg);
51168         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51170         this_arg_conv.is_owned = false;
51171         NodeFeatures_set_wumbo_optional(&this_arg_conv);
51172 }
51173
51174 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_required"))) TS_NodeFeatures_set_wumbo_required(uint64_t this_arg) {
51175         LDKNodeFeatures this_arg_conv;
51176         this_arg_conv.inner = untag_ptr(this_arg);
51177         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51179         this_arg_conv.is_owned = false;
51180         NodeFeatures_set_wumbo_required(&this_arg_conv);
51181 }
51182
51183 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_wumbo"))) TS_NodeFeatures_supports_wumbo(uint64_t this_arg) {
51184         LDKNodeFeatures this_arg_conv;
51185         this_arg_conv.inner = untag_ptr(this_arg);
51186         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51188         this_arg_conv.is_owned = false;
51189         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
51190         return ret_conv;
51191 }
51192
51193 jboolean  __attribute__((export_name("TS_InitFeatures_requires_wumbo"))) TS_InitFeatures_requires_wumbo(uint64_t this_arg) {
51194         LDKInitFeatures this_arg_conv;
51195         this_arg_conv.inner = untag_ptr(this_arg);
51196         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51198         this_arg_conv.is_owned = false;
51199         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
51200         return ret_conv;
51201 }
51202
51203 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_wumbo"))) TS_NodeFeatures_requires_wumbo(uint64_t this_arg) {
51204         LDKNodeFeatures this_arg_conv;
51205         this_arg_conv.inner = untag_ptr(this_arg);
51206         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51208         this_arg_conv.is_owned = false;
51209         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
51210         return ret_conv;
51211 }
51212
51213 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) {
51214         LDKInitFeatures this_arg_conv;
51215         this_arg_conv.inner = untag_ptr(this_arg);
51216         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51218         this_arg_conv.is_owned = false;
51219         InitFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
51220 }
51221
51222 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) {
51223         LDKInitFeatures this_arg_conv;
51224         this_arg_conv.inner = untag_ptr(this_arg);
51225         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51227         this_arg_conv.is_owned = false;
51228         InitFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
51229 }
51230
51231 jboolean  __attribute__((export_name("TS_InitFeatures_supports_anchors_nonzero_fee_htlc_tx"))) TS_InitFeatures_supports_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
51232         LDKInitFeatures this_arg_conv;
51233         this_arg_conv.inner = untag_ptr(this_arg);
51234         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51236         this_arg_conv.is_owned = false;
51237         jboolean ret_conv = InitFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
51238         return ret_conv;
51239 }
51240
51241 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) {
51242         LDKNodeFeatures this_arg_conv;
51243         this_arg_conv.inner = untag_ptr(this_arg);
51244         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51246         this_arg_conv.is_owned = false;
51247         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
51248 }
51249
51250 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) {
51251         LDKNodeFeatures this_arg_conv;
51252         this_arg_conv.inner = untag_ptr(this_arg);
51253         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51255         this_arg_conv.is_owned = false;
51256         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
51257 }
51258
51259 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_anchors_nonzero_fee_htlc_tx"))) TS_NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
51260         LDKNodeFeatures this_arg_conv;
51261         this_arg_conv.inner = untag_ptr(this_arg);
51262         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51264         this_arg_conv.is_owned = false;
51265         jboolean ret_conv = NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
51266         return ret_conv;
51267 }
51268
51269 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) {
51270         LDKChannelTypeFeatures this_arg_conv;
51271         this_arg_conv.inner = untag_ptr(this_arg);
51272         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51274         this_arg_conv.is_owned = false;
51275         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
51276 }
51277
51278 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) {
51279         LDKChannelTypeFeatures this_arg_conv;
51280         this_arg_conv.inner = untag_ptr(this_arg);
51281         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51283         this_arg_conv.is_owned = false;
51284         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
51285 }
51286
51287 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx"))) TS_ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
51288         LDKChannelTypeFeatures this_arg_conv;
51289         this_arg_conv.inner = untag_ptr(this_arg);
51290         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51292         this_arg_conv.is_owned = false;
51293         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
51294         return ret_conv;
51295 }
51296
51297 jboolean  __attribute__((export_name("TS_InitFeatures_requires_anchors_nonzero_fee_htlc_tx"))) TS_InitFeatures_requires_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
51298         LDKInitFeatures this_arg_conv;
51299         this_arg_conv.inner = untag_ptr(this_arg);
51300         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51302         this_arg_conv.is_owned = false;
51303         jboolean ret_conv = InitFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
51304         return ret_conv;
51305 }
51306
51307 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_anchors_nonzero_fee_htlc_tx"))) TS_NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
51308         LDKNodeFeatures this_arg_conv;
51309         this_arg_conv.inner = untag_ptr(this_arg);
51310         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51312         this_arg_conv.is_owned = false;
51313         jboolean ret_conv = NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
51314         return ret_conv;
51315 }
51316
51317 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx"))) TS_ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
51318         LDKChannelTypeFeatures this_arg_conv;
51319         this_arg_conv.inner = untag_ptr(this_arg);
51320         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51322         this_arg_conv.is_owned = false;
51323         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
51324         return ret_conv;
51325 }
51326
51327 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) {
51328         LDKInitFeatures this_arg_conv;
51329         this_arg_conv.inner = untag_ptr(this_arg);
51330         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51332         this_arg_conv.is_owned = false;
51333         InitFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
51334 }
51335
51336 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) {
51337         LDKInitFeatures this_arg_conv;
51338         this_arg_conv.inner = untag_ptr(this_arg);
51339         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51341         this_arg_conv.is_owned = false;
51342         InitFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
51343 }
51344
51345 jboolean  __attribute__((export_name("TS_InitFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_InitFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
51346         LDKInitFeatures this_arg_conv;
51347         this_arg_conv.inner = untag_ptr(this_arg);
51348         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51350         this_arg_conv.is_owned = false;
51351         jboolean ret_conv = InitFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
51352         return ret_conv;
51353 }
51354
51355 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) {
51356         LDKNodeFeatures this_arg_conv;
51357         this_arg_conv.inner = untag_ptr(this_arg);
51358         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51360         this_arg_conv.is_owned = false;
51361         NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
51362 }
51363
51364 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) {
51365         LDKNodeFeatures this_arg_conv;
51366         this_arg_conv.inner = untag_ptr(this_arg);
51367         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51369         this_arg_conv.is_owned = false;
51370         NodeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
51371 }
51372
51373 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_NodeFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
51374         LDKNodeFeatures this_arg_conv;
51375         this_arg_conv.inner = untag_ptr(this_arg);
51376         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51378         this_arg_conv.is_owned = false;
51379         jboolean ret_conv = NodeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
51380         return ret_conv;
51381 }
51382
51383 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) {
51384         LDKChannelTypeFeatures this_arg_conv;
51385         this_arg_conv.inner = untag_ptr(this_arg);
51386         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51388         this_arg_conv.is_owned = false;
51389         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
51390 }
51391
51392 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) {
51393         LDKChannelTypeFeatures this_arg_conv;
51394         this_arg_conv.inner = untag_ptr(this_arg);
51395         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51397         this_arg_conv.is_owned = false;
51398         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
51399 }
51400
51401 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
51402         LDKChannelTypeFeatures this_arg_conv;
51403         this_arg_conv.inner = untag_ptr(this_arg);
51404         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51406         this_arg_conv.is_owned = false;
51407         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
51408         return ret_conv;
51409 }
51410
51411 jboolean  __attribute__((export_name("TS_InitFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_InitFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
51412         LDKInitFeatures this_arg_conv;
51413         this_arg_conv.inner = untag_ptr(this_arg);
51414         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51416         this_arg_conv.is_owned = false;
51417         jboolean ret_conv = InitFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
51418         return ret_conv;
51419 }
51420
51421 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_NodeFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
51422         LDKNodeFeatures this_arg_conv;
51423         this_arg_conv.inner = untag_ptr(this_arg);
51424         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51426         this_arg_conv.is_owned = false;
51427         jboolean ret_conv = NodeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
51428         return ret_conv;
51429 }
51430
51431 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
51432         LDKChannelTypeFeatures this_arg_conv;
51433         this_arg_conv.inner = untag_ptr(this_arg);
51434         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51436         this_arg_conv.is_owned = false;
51437         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
51438         return ret_conv;
51439 }
51440
51441 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_optional"))) TS_InitFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
51442         LDKInitFeatures this_arg_conv;
51443         this_arg_conv.inner = untag_ptr(this_arg);
51444         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51446         this_arg_conv.is_owned = false;
51447         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
51448 }
51449
51450 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_required"))) TS_InitFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
51451         LDKInitFeatures this_arg_conv;
51452         this_arg_conv.inner = untag_ptr(this_arg);
51453         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51455         this_arg_conv.is_owned = false;
51456         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
51457 }
51458
51459 jboolean  __attribute__((export_name("TS_InitFeatures_supports_shutdown_anysegwit"))) TS_InitFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
51460         LDKInitFeatures this_arg_conv;
51461         this_arg_conv.inner = untag_ptr(this_arg);
51462         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51464         this_arg_conv.is_owned = false;
51465         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
51466         return ret_conv;
51467 }
51468
51469 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_optional"))) TS_NodeFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
51470         LDKNodeFeatures this_arg_conv;
51471         this_arg_conv.inner = untag_ptr(this_arg);
51472         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51474         this_arg_conv.is_owned = false;
51475         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
51476 }
51477
51478 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_required"))) TS_NodeFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
51479         LDKNodeFeatures this_arg_conv;
51480         this_arg_conv.inner = untag_ptr(this_arg);
51481         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51483         this_arg_conv.is_owned = false;
51484         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
51485 }
51486
51487 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_shutdown_anysegwit"))) TS_NodeFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
51488         LDKNodeFeatures this_arg_conv;
51489         this_arg_conv.inner = untag_ptr(this_arg);
51490         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51492         this_arg_conv.is_owned = false;
51493         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
51494         return ret_conv;
51495 }
51496
51497 jboolean  __attribute__((export_name("TS_InitFeatures_requires_shutdown_anysegwit"))) TS_InitFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
51498         LDKInitFeatures this_arg_conv;
51499         this_arg_conv.inner = untag_ptr(this_arg);
51500         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51502         this_arg_conv.is_owned = false;
51503         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
51504         return ret_conv;
51505 }
51506
51507 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_shutdown_anysegwit"))) TS_NodeFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
51508         LDKNodeFeatures this_arg_conv;
51509         this_arg_conv.inner = untag_ptr(this_arg);
51510         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51512         this_arg_conv.is_owned = false;
51513         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
51514         return ret_conv;
51515 }
51516
51517 void  __attribute__((export_name("TS_InitFeatures_set_taproot_optional"))) TS_InitFeatures_set_taproot_optional(uint64_t this_arg) {
51518         LDKInitFeatures this_arg_conv;
51519         this_arg_conv.inner = untag_ptr(this_arg);
51520         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51522         this_arg_conv.is_owned = false;
51523         InitFeatures_set_taproot_optional(&this_arg_conv);
51524 }
51525
51526 void  __attribute__((export_name("TS_InitFeatures_set_taproot_required"))) TS_InitFeatures_set_taproot_required(uint64_t this_arg) {
51527         LDKInitFeatures this_arg_conv;
51528         this_arg_conv.inner = untag_ptr(this_arg);
51529         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51531         this_arg_conv.is_owned = false;
51532         InitFeatures_set_taproot_required(&this_arg_conv);
51533 }
51534
51535 jboolean  __attribute__((export_name("TS_InitFeatures_supports_taproot"))) TS_InitFeatures_supports_taproot(uint64_t this_arg) {
51536         LDKInitFeatures this_arg_conv;
51537         this_arg_conv.inner = untag_ptr(this_arg);
51538         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51540         this_arg_conv.is_owned = false;
51541         jboolean ret_conv = InitFeatures_supports_taproot(&this_arg_conv);
51542         return ret_conv;
51543 }
51544
51545 void  __attribute__((export_name("TS_NodeFeatures_set_taproot_optional"))) TS_NodeFeatures_set_taproot_optional(uint64_t this_arg) {
51546         LDKNodeFeatures this_arg_conv;
51547         this_arg_conv.inner = untag_ptr(this_arg);
51548         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51550         this_arg_conv.is_owned = false;
51551         NodeFeatures_set_taproot_optional(&this_arg_conv);
51552 }
51553
51554 void  __attribute__((export_name("TS_NodeFeatures_set_taproot_required"))) TS_NodeFeatures_set_taproot_required(uint64_t this_arg) {
51555         LDKNodeFeatures this_arg_conv;
51556         this_arg_conv.inner = untag_ptr(this_arg);
51557         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51559         this_arg_conv.is_owned = false;
51560         NodeFeatures_set_taproot_required(&this_arg_conv);
51561 }
51562
51563 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_taproot"))) TS_NodeFeatures_supports_taproot(uint64_t this_arg) {
51564         LDKNodeFeatures this_arg_conv;
51565         this_arg_conv.inner = untag_ptr(this_arg);
51566         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51568         this_arg_conv.is_owned = false;
51569         jboolean ret_conv = NodeFeatures_supports_taproot(&this_arg_conv);
51570         return ret_conv;
51571 }
51572
51573 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_taproot_optional"))) TS_ChannelTypeFeatures_set_taproot_optional(uint64_t this_arg) {
51574         LDKChannelTypeFeatures this_arg_conv;
51575         this_arg_conv.inner = untag_ptr(this_arg);
51576         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51578         this_arg_conv.is_owned = false;
51579         ChannelTypeFeatures_set_taproot_optional(&this_arg_conv);
51580 }
51581
51582 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_taproot_required"))) TS_ChannelTypeFeatures_set_taproot_required(uint64_t this_arg) {
51583         LDKChannelTypeFeatures this_arg_conv;
51584         this_arg_conv.inner = untag_ptr(this_arg);
51585         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51587         this_arg_conv.is_owned = false;
51588         ChannelTypeFeatures_set_taproot_required(&this_arg_conv);
51589 }
51590
51591 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_taproot"))) TS_ChannelTypeFeatures_supports_taproot(uint64_t this_arg) {
51592         LDKChannelTypeFeatures this_arg_conv;
51593         this_arg_conv.inner = untag_ptr(this_arg);
51594         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51596         this_arg_conv.is_owned = false;
51597         jboolean ret_conv = ChannelTypeFeatures_supports_taproot(&this_arg_conv);
51598         return ret_conv;
51599 }
51600
51601 jboolean  __attribute__((export_name("TS_InitFeatures_requires_taproot"))) TS_InitFeatures_requires_taproot(uint64_t this_arg) {
51602         LDKInitFeatures this_arg_conv;
51603         this_arg_conv.inner = untag_ptr(this_arg);
51604         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51606         this_arg_conv.is_owned = false;
51607         jboolean ret_conv = InitFeatures_requires_taproot(&this_arg_conv);
51608         return ret_conv;
51609 }
51610
51611 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_taproot"))) TS_NodeFeatures_requires_taproot(uint64_t this_arg) {
51612         LDKNodeFeatures this_arg_conv;
51613         this_arg_conv.inner = untag_ptr(this_arg);
51614         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51616         this_arg_conv.is_owned = false;
51617         jboolean ret_conv = NodeFeatures_requires_taproot(&this_arg_conv);
51618         return ret_conv;
51619 }
51620
51621 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_taproot"))) TS_ChannelTypeFeatures_requires_taproot(uint64_t this_arg) {
51622         LDKChannelTypeFeatures this_arg_conv;
51623         this_arg_conv.inner = untag_ptr(this_arg);
51624         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51626         this_arg_conv.is_owned = false;
51627         jboolean ret_conv = ChannelTypeFeatures_requires_taproot(&this_arg_conv);
51628         return ret_conv;
51629 }
51630
51631 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_optional"))) TS_InitFeatures_set_onion_messages_optional(uint64_t this_arg) {
51632         LDKInitFeatures this_arg_conv;
51633         this_arg_conv.inner = untag_ptr(this_arg);
51634         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51636         this_arg_conv.is_owned = false;
51637         InitFeatures_set_onion_messages_optional(&this_arg_conv);
51638 }
51639
51640 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_required"))) TS_InitFeatures_set_onion_messages_required(uint64_t this_arg) {
51641         LDKInitFeatures this_arg_conv;
51642         this_arg_conv.inner = untag_ptr(this_arg);
51643         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51645         this_arg_conv.is_owned = false;
51646         InitFeatures_set_onion_messages_required(&this_arg_conv);
51647 }
51648
51649 jboolean  __attribute__((export_name("TS_InitFeatures_supports_onion_messages"))) TS_InitFeatures_supports_onion_messages(uint64_t this_arg) {
51650         LDKInitFeatures this_arg_conv;
51651         this_arg_conv.inner = untag_ptr(this_arg);
51652         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51654         this_arg_conv.is_owned = false;
51655         jboolean ret_conv = InitFeatures_supports_onion_messages(&this_arg_conv);
51656         return ret_conv;
51657 }
51658
51659 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_optional"))) TS_NodeFeatures_set_onion_messages_optional(uint64_t this_arg) {
51660         LDKNodeFeatures this_arg_conv;
51661         this_arg_conv.inner = untag_ptr(this_arg);
51662         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51664         this_arg_conv.is_owned = false;
51665         NodeFeatures_set_onion_messages_optional(&this_arg_conv);
51666 }
51667
51668 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_required"))) TS_NodeFeatures_set_onion_messages_required(uint64_t this_arg) {
51669         LDKNodeFeatures this_arg_conv;
51670         this_arg_conv.inner = untag_ptr(this_arg);
51671         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51673         this_arg_conv.is_owned = false;
51674         NodeFeatures_set_onion_messages_required(&this_arg_conv);
51675 }
51676
51677 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_onion_messages"))) TS_NodeFeatures_supports_onion_messages(uint64_t this_arg) {
51678         LDKNodeFeatures this_arg_conv;
51679         this_arg_conv.inner = untag_ptr(this_arg);
51680         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51682         this_arg_conv.is_owned = false;
51683         jboolean ret_conv = NodeFeatures_supports_onion_messages(&this_arg_conv);
51684         return ret_conv;
51685 }
51686
51687 jboolean  __attribute__((export_name("TS_InitFeatures_requires_onion_messages"))) TS_InitFeatures_requires_onion_messages(uint64_t this_arg) {
51688         LDKInitFeatures this_arg_conv;
51689         this_arg_conv.inner = untag_ptr(this_arg);
51690         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51692         this_arg_conv.is_owned = false;
51693         jboolean ret_conv = InitFeatures_requires_onion_messages(&this_arg_conv);
51694         return ret_conv;
51695 }
51696
51697 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_onion_messages"))) TS_NodeFeatures_requires_onion_messages(uint64_t this_arg) {
51698         LDKNodeFeatures this_arg_conv;
51699         this_arg_conv.inner = untag_ptr(this_arg);
51700         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51702         this_arg_conv.is_owned = false;
51703         jboolean ret_conv = NodeFeatures_requires_onion_messages(&this_arg_conv);
51704         return ret_conv;
51705 }
51706
51707 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_optional"))) TS_InitFeatures_set_channel_type_optional(uint64_t this_arg) {
51708         LDKInitFeatures this_arg_conv;
51709         this_arg_conv.inner = untag_ptr(this_arg);
51710         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51712         this_arg_conv.is_owned = false;
51713         InitFeatures_set_channel_type_optional(&this_arg_conv);
51714 }
51715
51716 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_required"))) TS_InitFeatures_set_channel_type_required(uint64_t this_arg) {
51717         LDKInitFeatures this_arg_conv;
51718         this_arg_conv.inner = untag_ptr(this_arg);
51719         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51721         this_arg_conv.is_owned = false;
51722         InitFeatures_set_channel_type_required(&this_arg_conv);
51723 }
51724
51725 jboolean  __attribute__((export_name("TS_InitFeatures_supports_channel_type"))) TS_InitFeatures_supports_channel_type(uint64_t this_arg) {
51726         LDKInitFeatures this_arg_conv;
51727         this_arg_conv.inner = untag_ptr(this_arg);
51728         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51730         this_arg_conv.is_owned = false;
51731         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
51732         return ret_conv;
51733 }
51734
51735 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_optional"))) TS_NodeFeatures_set_channel_type_optional(uint64_t this_arg) {
51736         LDKNodeFeatures this_arg_conv;
51737         this_arg_conv.inner = untag_ptr(this_arg);
51738         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51740         this_arg_conv.is_owned = false;
51741         NodeFeatures_set_channel_type_optional(&this_arg_conv);
51742 }
51743
51744 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_required"))) TS_NodeFeatures_set_channel_type_required(uint64_t this_arg) {
51745         LDKNodeFeatures this_arg_conv;
51746         this_arg_conv.inner = untag_ptr(this_arg);
51747         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51749         this_arg_conv.is_owned = false;
51750         NodeFeatures_set_channel_type_required(&this_arg_conv);
51751 }
51752
51753 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_channel_type"))) TS_NodeFeatures_supports_channel_type(uint64_t this_arg) {
51754         LDKNodeFeatures this_arg_conv;
51755         this_arg_conv.inner = untag_ptr(this_arg);
51756         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51758         this_arg_conv.is_owned = false;
51759         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
51760         return ret_conv;
51761 }
51762
51763 jboolean  __attribute__((export_name("TS_InitFeatures_requires_channel_type"))) TS_InitFeatures_requires_channel_type(uint64_t this_arg) {
51764         LDKInitFeatures this_arg_conv;
51765         this_arg_conv.inner = untag_ptr(this_arg);
51766         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51768         this_arg_conv.is_owned = false;
51769         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
51770         return ret_conv;
51771 }
51772
51773 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_channel_type"))) TS_NodeFeatures_requires_channel_type(uint64_t this_arg) {
51774         LDKNodeFeatures this_arg_conv;
51775         this_arg_conv.inner = untag_ptr(this_arg);
51776         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51778         this_arg_conv.is_owned = false;
51779         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
51780         return ret_conv;
51781 }
51782
51783 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_optional"))) TS_InitFeatures_set_scid_privacy_optional(uint64_t this_arg) {
51784         LDKInitFeatures this_arg_conv;
51785         this_arg_conv.inner = untag_ptr(this_arg);
51786         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51788         this_arg_conv.is_owned = false;
51789         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
51790 }
51791
51792 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_required"))) TS_InitFeatures_set_scid_privacy_required(uint64_t this_arg) {
51793         LDKInitFeatures this_arg_conv;
51794         this_arg_conv.inner = untag_ptr(this_arg);
51795         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51797         this_arg_conv.is_owned = false;
51798         InitFeatures_set_scid_privacy_required(&this_arg_conv);
51799 }
51800
51801 jboolean  __attribute__((export_name("TS_InitFeatures_supports_scid_privacy"))) TS_InitFeatures_supports_scid_privacy(uint64_t this_arg) {
51802         LDKInitFeatures this_arg_conv;
51803         this_arg_conv.inner = untag_ptr(this_arg);
51804         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51806         this_arg_conv.is_owned = false;
51807         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
51808         return ret_conv;
51809 }
51810
51811 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_optional"))) TS_NodeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
51812         LDKNodeFeatures this_arg_conv;
51813         this_arg_conv.inner = untag_ptr(this_arg);
51814         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51816         this_arg_conv.is_owned = false;
51817         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
51818 }
51819
51820 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_required"))) TS_NodeFeatures_set_scid_privacy_required(uint64_t this_arg) {
51821         LDKNodeFeatures this_arg_conv;
51822         this_arg_conv.inner = untag_ptr(this_arg);
51823         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51825         this_arg_conv.is_owned = false;
51826         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
51827 }
51828
51829 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_scid_privacy"))) TS_NodeFeatures_supports_scid_privacy(uint64_t this_arg) {
51830         LDKNodeFeatures this_arg_conv;
51831         this_arg_conv.inner = untag_ptr(this_arg);
51832         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51834         this_arg_conv.is_owned = false;
51835         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
51836         return ret_conv;
51837 }
51838
51839 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_optional"))) TS_ChannelTypeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
51840         LDKChannelTypeFeatures this_arg_conv;
51841         this_arg_conv.inner = untag_ptr(this_arg);
51842         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51844         this_arg_conv.is_owned = false;
51845         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
51846 }
51847
51848 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_required"))) TS_ChannelTypeFeatures_set_scid_privacy_required(uint64_t this_arg) {
51849         LDKChannelTypeFeatures this_arg_conv;
51850         this_arg_conv.inner = untag_ptr(this_arg);
51851         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51853         this_arg_conv.is_owned = false;
51854         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
51855 }
51856
51857 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_scid_privacy"))) TS_ChannelTypeFeatures_supports_scid_privacy(uint64_t this_arg) {
51858         LDKChannelTypeFeatures this_arg_conv;
51859         this_arg_conv.inner = untag_ptr(this_arg);
51860         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51862         this_arg_conv.is_owned = false;
51863         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
51864         return ret_conv;
51865 }
51866
51867 jboolean  __attribute__((export_name("TS_InitFeatures_requires_scid_privacy"))) TS_InitFeatures_requires_scid_privacy(uint64_t this_arg) {
51868         LDKInitFeatures this_arg_conv;
51869         this_arg_conv.inner = untag_ptr(this_arg);
51870         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51872         this_arg_conv.is_owned = false;
51873         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
51874         return ret_conv;
51875 }
51876
51877 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_scid_privacy"))) TS_NodeFeatures_requires_scid_privacy(uint64_t this_arg) {
51878         LDKNodeFeatures this_arg_conv;
51879         this_arg_conv.inner = untag_ptr(this_arg);
51880         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51882         this_arg_conv.is_owned = false;
51883         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
51884         return ret_conv;
51885 }
51886
51887 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_scid_privacy"))) TS_ChannelTypeFeatures_requires_scid_privacy(uint64_t this_arg) {
51888         LDKChannelTypeFeatures this_arg_conv;
51889         this_arg_conv.inner = untag_ptr(this_arg);
51890         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51892         this_arg_conv.is_owned = false;
51893         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
51894         return ret_conv;
51895 }
51896
51897 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_metadata_optional"))) TS_Bolt11InvoiceFeatures_set_payment_metadata_optional(uint64_t this_arg) {
51898         LDKBolt11InvoiceFeatures this_arg_conv;
51899         this_arg_conv.inner = untag_ptr(this_arg);
51900         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51902         this_arg_conv.is_owned = false;
51903         Bolt11InvoiceFeatures_set_payment_metadata_optional(&this_arg_conv);
51904 }
51905
51906 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_metadata_required"))) TS_Bolt11InvoiceFeatures_set_payment_metadata_required(uint64_t this_arg) {
51907         LDKBolt11InvoiceFeatures this_arg_conv;
51908         this_arg_conv.inner = untag_ptr(this_arg);
51909         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51911         this_arg_conv.is_owned = false;
51912         Bolt11InvoiceFeatures_set_payment_metadata_required(&this_arg_conv);
51913 }
51914
51915 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_payment_metadata"))) TS_Bolt11InvoiceFeatures_supports_payment_metadata(uint64_t this_arg) {
51916         LDKBolt11InvoiceFeatures this_arg_conv;
51917         this_arg_conv.inner = untag_ptr(this_arg);
51918         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51920         this_arg_conv.is_owned = false;
51921         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_metadata(&this_arg_conv);
51922         return ret_conv;
51923 }
51924
51925 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_payment_metadata"))) TS_Bolt11InvoiceFeatures_requires_payment_metadata(uint64_t this_arg) {
51926         LDKBolt11InvoiceFeatures this_arg_conv;
51927         this_arg_conv.inner = untag_ptr(this_arg);
51928         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51930         this_arg_conv.is_owned = false;
51931         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_metadata(&this_arg_conv);
51932         return ret_conv;
51933 }
51934
51935 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_optional"))) TS_InitFeatures_set_zero_conf_optional(uint64_t this_arg) {
51936         LDKInitFeatures this_arg_conv;
51937         this_arg_conv.inner = untag_ptr(this_arg);
51938         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51940         this_arg_conv.is_owned = false;
51941         InitFeatures_set_zero_conf_optional(&this_arg_conv);
51942 }
51943
51944 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_required"))) TS_InitFeatures_set_zero_conf_required(uint64_t this_arg) {
51945         LDKInitFeatures this_arg_conv;
51946         this_arg_conv.inner = untag_ptr(this_arg);
51947         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51949         this_arg_conv.is_owned = false;
51950         InitFeatures_set_zero_conf_required(&this_arg_conv);
51951 }
51952
51953 jboolean  __attribute__((export_name("TS_InitFeatures_supports_zero_conf"))) TS_InitFeatures_supports_zero_conf(uint64_t this_arg) {
51954         LDKInitFeatures this_arg_conv;
51955         this_arg_conv.inner = untag_ptr(this_arg);
51956         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51958         this_arg_conv.is_owned = false;
51959         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
51960         return ret_conv;
51961 }
51962
51963 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_optional"))) TS_NodeFeatures_set_zero_conf_optional(uint64_t this_arg) {
51964         LDKNodeFeatures this_arg_conv;
51965         this_arg_conv.inner = untag_ptr(this_arg);
51966         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51968         this_arg_conv.is_owned = false;
51969         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
51970 }
51971
51972 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_required"))) TS_NodeFeatures_set_zero_conf_required(uint64_t this_arg) {
51973         LDKNodeFeatures this_arg_conv;
51974         this_arg_conv.inner = untag_ptr(this_arg);
51975         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51977         this_arg_conv.is_owned = false;
51978         NodeFeatures_set_zero_conf_required(&this_arg_conv);
51979 }
51980
51981 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_zero_conf"))) TS_NodeFeatures_supports_zero_conf(uint64_t this_arg) {
51982         LDKNodeFeatures this_arg_conv;
51983         this_arg_conv.inner = untag_ptr(this_arg);
51984         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51986         this_arg_conv.is_owned = false;
51987         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
51988         return ret_conv;
51989 }
51990
51991 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_optional"))) TS_ChannelTypeFeatures_set_zero_conf_optional(uint64_t this_arg) {
51992         LDKChannelTypeFeatures this_arg_conv;
51993         this_arg_conv.inner = untag_ptr(this_arg);
51994         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51996         this_arg_conv.is_owned = false;
51997         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
51998 }
51999
52000 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_required"))) TS_ChannelTypeFeatures_set_zero_conf_required(uint64_t this_arg) {
52001         LDKChannelTypeFeatures this_arg_conv;
52002         this_arg_conv.inner = untag_ptr(this_arg);
52003         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52005         this_arg_conv.is_owned = false;
52006         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
52007 }
52008
52009 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_zero_conf"))) TS_ChannelTypeFeatures_supports_zero_conf(uint64_t this_arg) {
52010         LDKChannelTypeFeatures this_arg_conv;
52011         this_arg_conv.inner = untag_ptr(this_arg);
52012         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52014         this_arg_conv.is_owned = false;
52015         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
52016         return ret_conv;
52017 }
52018
52019 jboolean  __attribute__((export_name("TS_InitFeatures_requires_zero_conf"))) TS_InitFeatures_requires_zero_conf(uint64_t this_arg) {
52020         LDKInitFeatures this_arg_conv;
52021         this_arg_conv.inner = untag_ptr(this_arg);
52022         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52024         this_arg_conv.is_owned = false;
52025         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
52026         return ret_conv;
52027 }
52028
52029 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_zero_conf"))) TS_NodeFeatures_requires_zero_conf(uint64_t this_arg) {
52030         LDKNodeFeatures this_arg_conv;
52031         this_arg_conv.inner = untag_ptr(this_arg);
52032         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52034         this_arg_conv.is_owned = false;
52035         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
52036         return ret_conv;
52037 }
52038
52039 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_zero_conf"))) TS_ChannelTypeFeatures_requires_zero_conf(uint64_t this_arg) {
52040         LDKChannelTypeFeatures this_arg_conv;
52041         this_arg_conv.inner = untag_ptr(this_arg);
52042         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52044         this_arg_conv.is_owned = false;
52045         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
52046         return ret_conv;
52047 }
52048
52049 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_optional"))) TS_NodeFeatures_set_keysend_optional(uint64_t this_arg) {
52050         LDKNodeFeatures this_arg_conv;
52051         this_arg_conv.inner = untag_ptr(this_arg);
52052         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52054         this_arg_conv.is_owned = false;
52055         NodeFeatures_set_keysend_optional(&this_arg_conv);
52056 }
52057
52058 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_required"))) TS_NodeFeatures_set_keysend_required(uint64_t this_arg) {
52059         LDKNodeFeatures this_arg_conv;
52060         this_arg_conv.inner = untag_ptr(this_arg);
52061         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52063         this_arg_conv.is_owned = false;
52064         NodeFeatures_set_keysend_required(&this_arg_conv);
52065 }
52066
52067 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_keysend"))) TS_NodeFeatures_supports_keysend(uint64_t this_arg) {
52068         LDKNodeFeatures this_arg_conv;
52069         this_arg_conv.inner = untag_ptr(this_arg);
52070         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52072         this_arg_conv.is_owned = false;
52073         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
52074         return ret_conv;
52075 }
52076
52077 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_keysend"))) TS_NodeFeatures_requires_keysend(uint64_t this_arg) {
52078         LDKNodeFeatures this_arg_conv;
52079         this_arg_conv.inner = untag_ptr(this_arg);
52080         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52082         this_arg_conv.is_owned = false;
52083         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
52084         return ret_conv;
52085 }
52086
52087 void  __attribute__((export_name("TS_ShutdownScript_free"))) TS_ShutdownScript_free(uint64_t this_obj) {
52088         LDKShutdownScript this_obj_conv;
52089         this_obj_conv.inner = untag_ptr(this_obj);
52090         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52092         ShutdownScript_free(this_obj_conv);
52093 }
52094
52095 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
52096         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
52097         uint64_t ret_ref = 0;
52098         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52099         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52100         return ret_ref;
52101 }
52102 int64_t  __attribute__((export_name("TS_ShutdownScript_clone_ptr"))) TS_ShutdownScript_clone_ptr(uint64_t arg) {
52103         LDKShutdownScript arg_conv;
52104         arg_conv.inner = untag_ptr(arg);
52105         arg_conv.is_owned = ptr_is_owned(arg);
52106         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52107         arg_conv.is_owned = false;
52108         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
52109         return ret_conv;
52110 }
52111
52112 uint64_t  __attribute__((export_name("TS_ShutdownScript_clone"))) TS_ShutdownScript_clone(uint64_t orig) {
52113         LDKShutdownScript orig_conv;
52114         orig_conv.inner = untag_ptr(orig);
52115         orig_conv.is_owned = ptr_is_owned(orig);
52116         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52117         orig_conv.is_owned = false;
52118         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
52119         uint64_t ret_ref = 0;
52120         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52121         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52122         return ret_ref;
52123 }
52124
52125 jboolean  __attribute__((export_name("TS_ShutdownScript_eq"))) TS_ShutdownScript_eq(uint64_t a, uint64_t b) {
52126         LDKShutdownScript a_conv;
52127         a_conv.inner = untag_ptr(a);
52128         a_conv.is_owned = ptr_is_owned(a);
52129         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52130         a_conv.is_owned = false;
52131         LDKShutdownScript b_conv;
52132         b_conv.inner = untag_ptr(b);
52133         b_conv.is_owned = ptr_is_owned(b);
52134         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52135         b_conv.is_owned = false;
52136         jboolean ret_conv = ShutdownScript_eq(&a_conv, &b_conv);
52137         return ret_conv;
52138 }
52139
52140 void  __attribute__((export_name("TS_InvalidShutdownScript_free"))) TS_InvalidShutdownScript_free(uint64_t this_obj) {
52141         LDKInvalidShutdownScript this_obj_conv;
52142         this_obj_conv.inner = untag_ptr(this_obj);
52143         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52145         InvalidShutdownScript_free(this_obj_conv);
52146 }
52147
52148 int8_tArray  __attribute__((export_name("TS_InvalidShutdownScript_get_script"))) TS_InvalidShutdownScript_get_script(uint64_t this_ptr) {
52149         LDKInvalidShutdownScript this_ptr_conv;
52150         this_ptr_conv.inner = untag_ptr(this_ptr);
52151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52153         this_ptr_conv.is_owned = false;
52154         LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
52155         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52156         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52157         return ret_arr;
52158 }
52159
52160 void  __attribute__((export_name("TS_InvalidShutdownScript_set_script"))) TS_InvalidShutdownScript_set_script(uint64_t this_ptr, int8_tArray val) {
52161         LDKInvalidShutdownScript this_ptr_conv;
52162         this_ptr_conv.inner = untag_ptr(this_ptr);
52163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52165         this_ptr_conv.is_owned = false;
52166         LDKCVec_u8Z val_ref;
52167         val_ref.datalen = val->arr_len;
52168         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
52169         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
52170         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
52171 }
52172
52173 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_new"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
52174         LDKCVec_u8Z script_arg_ref;
52175         script_arg_ref.datalen = script_arg->arr_len;
52176         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
52177         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
52178         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
52179         uint64_t ret_ref = 0;
52180         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52181         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52182         return ret_ref;
52183 }
52184
52185 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
52186         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
52187         uint64_t ret_ref = 0;
52188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52190         return ret_ref;
52191 }
52192 int64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone_ptr"))) TS_InvalidShutdownScript_clone_ptr(uint64_t arg) {
52193         LDKInvalidShutdownScript arg_conv;
52194         arg_conv.inner = untag_ptr(arg);
52195         arg_conv.is_owned = ptr_is_owned(arg);
52196         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52197         arg_conv.is_owned = false;
52198         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
52199         return ret_conv;
52200 }
52201
52202 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone"))) TS_InvalidShutdownScript_clone(uint64_t orig) {
52203         LDKInvalidShutdownScript orig_conv;
52204         orig_conv.inner = untag_ptr(orig);
52205         orig_conv.is_owned = ptr_is_owned(orig);
52206         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52207         orig_conv.is_owned = false;
52208         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
52209         uint64_t ret_ref = 0;
52210         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52211         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52212         return ret_ref;
52213 }
52214
52215 int8_tArray  __attribute__((export_name("TS_ShutdownScript_write"))) TS_ShutdownScript_write(uint64_t obj) {
52216         LDKShutdownScript obj_conv;
52217         obj_conv.inner = untag_ptr(obj);
52218         obj_conv.is_owned = ptr_is_owned(obj);
52219         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52220         obj_conv.is_owned = false;
52221         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
52222         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52223         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52224         CVec_u8Z_free(ret_var);
52225         return ret_arr;
52226 }
52227
52228 uint64_t  __attribute__((export_name("TS_ShutdownScript_read"))) TS_ShutdownScript_read(int8_tArray ser) {
52229         LDKu8slice ser_ref;
52230         ser_ref.datalen = ser->arr_len;
52231         ser_ref.data = ser->elems;
52232         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
52233         *ret_conv = ShutdownScript_read(ser_ref);
52234         FREE(ser);
52235         return tag_ptr(ret_conv, true);
52236 }
52237
52238 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wpkh"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
52239         uint8_t pubkey_hash_arr[20];
52240         CHECK(pubkey_hash->arr_len == 20);
52241         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
52242         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
52243         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
52244         uint64_t ret_ref = 0;
52245         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52246         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52247         return ret_ref;
52248 }
52249
52250 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wsh"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
52251         uint8_t script_hash_arr[32];
52252         CHECK(script_hash->arr_len == 32);
52253         memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
52254         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
52255         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
52256         uint64_t ret_ref = 0;
52257         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52258         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52259         return ret_ref;
52260 }
52261
52262 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_witness_program"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
52263         
52264         LDKu8slice program_ref;
52265         program_ref.datalen = program->arr_len;
52266         program_ref.data = program->elems;
52267         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
52268         *ret_conv = ShutdownScript_new_witness_program((LDKWitnessVersion){ ._0 = version }, program_ref);
52269         FREE(program);
52270         return tag_ptr(ret_conv, true);
52271 }
52272
52273 int8_tArray  __attribute__((export_name("TS_ShutdownScript_into_inner"))) TS_ShutdownScript_into_inner(uint64_t this_arg) {
52274         LDKShutdownScript this_arg_conv;
52275         this_arg_conv.inner = untag_ptr(this_arg);
52276         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52278         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
52279         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
52280         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52281         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52282         CVec_u8Z_free(ret_var);
52283         return ret_arr;
52284 }
52285
52286 int8_tArray  __attribute__((export_name("TS_ShutdownScript_as_legacy_pubkey"))) TS_ShutdownScript_as_legacy_pubkey(uint64_t this_arg) {
52287         LDKShutdownScript this_arg_conv;
52288         this_arg_conv.inner = untag_ptr(this_arg);
52289         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52291         this_arg_conv.is_owned = false;
52292         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
52293         memcpy(ret_arr->elems, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
52294         return ret_arr;
52295 }
52296
52297 jboolean  __attribute__((export_name("TS_ShutdownScript_is_compatible"))) TS_ShutdownScript_is_compatible(uint64_t this_arg, uint64_t features) {
52298         LDKShutdownScript this_arg_conv;
52299         this_arg_conv.inner = untag_ptr(this_arg);
52300         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52302         this_arg_conv.is_owned = false;
52303         LDKInitFeatures features_conv;
52304         features_conv.inner = untag_ptr(features);
52305         features_conv.is_owned = ptr_is_owned(features);
52306         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
52307         features_conv.is_owned = false;
52308         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
52309         return ret_conv;
52310 }
52311
52312 void  __attribute__((export_name("TS_Retry_free"))) TS_Retry_free(uint64_t this_ptr) {
52313         if (!ptr_is_owned(this_ptr)) return;
52314         void* this_ptr_ptr = untag_ptr(this_ptr);
52315         CHECK_ACCESS(this_ptr_ptr);
52316         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
52317         FREE(untag_ptr(this_ptr));
52318         Retry_free(this_ptr_conv);
52319 }
52320
52321 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
52322         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
52323         *ret_copy = Retry_clone(arg);
52324         uint64_t ret_ref = tag_ptr(ret_copy, true);
52325         return ret_ref;
52326 }
52327 int64_t  __attribute__((export_name("TS_Retry_clone_ptr"))) TS_Retry_clone_ptr(uint64_t arg) {
52328         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
52329         int64_t ret_conv = Retry_clone_ptr(arg_conv);
52330         return ret_conv;
52331 }
52332
52333 uint64_t  __attribute__((export_name("TS_Retry_clone"))) TS_Retry_clone(uint64_t orig) {
52334         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
52335         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
52336         *ret_copy = Retry_clone(orig_conv);
52337         uint64_t ret_ref = tag_ptr(ret_copy, true);
52338         return ret_ref;
52339 }
52340
52341 uint64_t  __attribute__((export_name("TS_Retry_attempts"))) TS_Retry_attempts(int32_t a) {
52342         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
52343         *ret_copy = Retry_attempts(a);
52344         uint64_t ret_ref = tag_ptr(ret_copy, true);
52345         return ret_ref;
52346 }
52347
52348 jboolean  __attribute__((export_name("TS_Retry_eq"))) TS_Retry_eq(uint64_t a, uint64_t b) {
52349         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
52350         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
52351         jboolean ret_conv = Retry_eq(a_conv, b_conv);
52352         return ret_conv;
52353 }
52354
52355 int64_t  __attribute__((export_name("TS_Retry_hash"))) TS_Retry_hash(uint64_t o) {
52356         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
52357         int64_t ret_conv = Retry_hash(o_conv);
52358         return ret_conv;
52359 }
52360
52361 int8_tArray  __attribute__((export_name("TS_Retry_write"))) TS_Retry_write(uint64_t obj) {
52362         LDKRetry* obj_conv = (LDKRetry*)untag_ptr(obj);
52363         LDKCVec_u8Z ret_var = Retry_write(obj_conv);
52364         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52365         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52366         CVec_u8Z_free(ret_var);
52367         return ret_arr;
52368 }
52369
52370 uint64_t  __attribute__((export_name("TS_Retry_read"))) TS_Retry_read(int8_tArray ser) {
52371         LDKu8slice ser_ref;
52372         ser_ref.datalen = ser->arr_len;
52373         ser_ref.data = ser->elems;
52374         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
52375         *ret_conv = Retry_read(ser_ref);
52376         FREE(ser);
52377         return tag_ptr(ret_conv, true);
52378 }
52379
52380 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_clone"))) TS_RetryableSendFailure_clone(uint64_t orig) {
52381         LDKRetryableSendFailure* orig_conv = (LDKRetryableSendFailure*)untag_ptr(orig);
52382         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_clone(orig_conv));
52383         return ret_conv;
52384 }
52385
52386 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_payment_expired"))) TS_RetryableSendFailure_payment_expired() {
52387         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_payment_expired());
52388         return ret_conv;
52389 }
52390
52391 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_route_not_found"))) TS_RetryableSendFailure_route_not_found() {
52392         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_route_not_found());
52393         return ret_conv;
52394 }
52395
52396 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_duplicate_payment"))) TS_RetryableSendFailure_duplicate_payment() {
52397         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_duplicate_payment());
52398         return ret_conv;
52399 }
52400
52401 jboolean  __attribute__((export_name("TS_RetryableSendFailure_eq"))) TS_RetryableSendFailure_eq(uint64_t a, uint64_t b) {
52402         LDKRetryableSendFailure* a_conv = (LDKRetryableSendFailure*)untag_ptr(a);
52403         LDKRetryableSendFailure* b_conv = (LDKRetryableSendFailure*)untag_ptr(b);
52404         jboolean ret_conv = RetryableSendFailure_eq(a_conv, b_conv);
52405         return ret_conv;
52406 }
52407
52408 void  __attribute__((export_name("TS_PaymentSendFailure_free"))) TS_PaymentSendFailure_free(uint64_t this_ptr) {
52409         if (!ptr_is_owned(this_ptr)) return;
52410         void* this_ptr_ptr = untag_ptr(this_ptr);
52411         CHECK_ACCESS(this_ptr_ptr);
52412         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
52413         FREE(untag_ptr(this_ptr));
52414         PaymentSendFailure_free(this_ptr_conv);
52415 }
52416
52417 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
52418         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
52419         *ret_copy = PaymentSendFailure_clone(arg);
52420         uint64_t ret_ref = tag_ptr(ret_copy, true);
52421         return ret_ref;
52422 }
52423 int64_t  __attribute__((export_name("TS_PaymentSendFailure_clone_ptr"))) TS_PaymentSendFailure_clone_ptr(uint64_t arg) {
52424         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
52425         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
52426         return ret_conv;
52427 }
52428
52429 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_clone"))) TS_PaymentSendFailure_clone(uint64_t orig) {
52430         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
52431         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
52432         *ret_copy = PaymentSendFailure_clone(orig_conv);
52433         uint64_t ret_ref = tag_ptr(ret_copy, true);
52434         return ret_ref;
52435 }
52436
52437 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_parameter_error"))) TS_PaymentSendFailure_parameter_error(uint64_t a) {
52438         void* a_ptr = untag_ptr(a);
52439         CHECK_ACCESS(a_ptr);
52440         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
52441         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
52442         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
52443         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
52444         uint64_t ret_ref = tag_ptr(ret_copy, true);
52445         return ret_ref;
52446 }
52447
52448 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_path_parameter_error"))) TS_PaymentSendFailure_path_parameter_error(uint64_tArray a) {
52449         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
52450         a_constr.datalen = a->arr_len;
52451         if (a_constr.datalen > 0)
52452                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
52453         else
52454                 a_constr.data = NULL;
52455         uint64_t* a_vals = a->elems;
52456         for (size_t w = 0; w < a_constr.datalen; w++) {
52457                 uint64_t a_conv_22 = a_vals[w];
52458                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
52459                 CHECK_ACCESS(a_conv_22_ptr);
52460                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
52461                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
52462                 a_constr.data[w] = a_conv_22_conv;
52463         }
52464         FREE(a);
52465         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
52466         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
52467         uint64_t ret_ref = tag_ptr(ret_copy, true);
52468         return ret_ref;
52469 }
52470
52471 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_all_failed_resend_safe"))) TS_PaymentSendFailure_all_failed_resend_safe(uint64_tArray a) {
52472         LDKCVec_APIErrorZ a_constr;
52473         a_constr.datalen = a->arr_len;
52474         if (a_constr.datalen > 0)
52475                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
52476         else
52477                 a_constr.data = NULL;
52478         uint64_t* a_vals = a->elems;
52479         for (size_t k = 0; k < a_constr.datalen; k++) {
52480                 uint64_t a_conv_10 = a_vals[k];
52481                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
52482                 CHECK_ACCESS(a_conv_10_ptr);
52483                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
52484                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
52485                 a_constr.data[k] = a_conv_10_conv;
52486         }
52487         FREE(a);
52488         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
52489         *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr);
52490         uint64_t ret_ref = tag_ptr(ret_copy, true);
52491         return ret_ref;
52492 }
52493
52494 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_duplicate_payment"))) TS_PaymentSendFailure_duplicate_payment() {
52495         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
52496         *ret_copy = PaymentSendFailure_duplicate_payment();
52497         uint64_t ret_ref = tag_ptr(ret_copy, true);
52498         return ret_ref;
52499 }
52500
52501 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) {
52502         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
52503         results_constr.datalen = results->arr_len;
52504         if (results_constr.datalen > 0)
52505                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
52506         else
52507                 results_constr.data = NULL;
52508         uint64_t* results_vals = results->elems;
52509         for (size_t w = 0; w < results_constr.datalen; w++) {
52510                 uint64_t results_conv_22 = results_vals[w];
52511                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
52512                 CHECK_ACCESS(results_conv_22_ptr);
52513                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
52514                 results_constr.data[w] = results_conv_22_conv;
52515         }
52516         FREE(results);
52517         LDKRouteParameters failed_paths_retry_conv;
52518         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
52519         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
52520         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
52521         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
52522         LDKThirtyTwoBytes payment_id_ref;
52523         CHECK(payment_id->arr_len == 32);
52524         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
52525         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
52526         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
52527         uint64_t ret_ref = tag_ptr(ret_copy, true);
52528         return ret_ref;
52529 }
52530
52531 jboolean  __attribute__((export_name("TS_PaymentSendFailure_eq"))) TS_PaymentSendFailure_eq(uint64_t a, uint64_t b) {
52532         LDKPaymentSendFailure* a_conv = (LDKPaymentSendFailure*)untag_ptr(a);
52533         LDKPaymentSendFailure* b_conv = (LDKPaymentSendFailure*)untag_ptr(b);
52534         jboolean ret_conv = PaymentSendFailure_eq(a_conv, b_conv);
52535         return ret_conv;
52536 }
52537
52538 void  __attribute__((export_name("TS_ProbeSendFailure_free"))) TS_ProbeSendFailure_free(uint64_t this_ptr) {
52539         if (!ptr_is_owned(this_ptr)) return;
52540         void* this_ptr_ptr = untag_ptr(this_ptr);
52541         CHECK_ACCESS(this_ptr_ptr);
52542         LDKProbeSendFailure this_ptr_conv = *(LDKProbeSendFailure*)(this_ptr_ptr);
52543         FREE(untag_ptr(this_ptr));
52544         ProbeSendFailure_free(this_ptr_conv);
52545 }
52546
52547 static inline uint64_t ProbeSendFailure_clone_ptr(LDKProbeSendFailure *NONNULL_PTR arg) {
52548         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
52549         *ret_copy = ProbeSendFailure_clone(arg);
52550         uint64_t ret_ref = tag_ptr(ret_copy, true);
52551         return ret_ref;
52552 }
52553 int64_t  __attribute__((export_name("TS_ProbeSendFailure_clone_ptr"))) TS_ProbeSendFailure_clone_ptr(uint64_t arg) {
52554         LDKProbeSendFailure* arg_conv = (LDKProbeSendFailure*)untag_ptr(arg);
52555         int64_t ret_conv = ProbeSendFailure_clone_ptr(arg_conv);
52556         return ret_conv;
52557 }
52558
52559 uint64_t  __attribute__((export_name("TS_ProbeSendFailure_clone"))) TS_ProbeSendFailure_clone(uint64_t orig) {
52560         LDKProbeSendFailure* orig_conv = (LDKProbeSendFailure*)untag_ptr(orig);
52561         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
52562         *ret_copy = ProbeSendFailure_clone(orig_conv);
52563         uint64_t ret_ref = tag_ptr(ret_copy, true);
52564         return ret_ref;
52565 }
52566
52567 uint64_t  __attribute__((export_name("TS_ProbeSendFailure_route_not_found"))) TS_ProbeSendFailure_route_not_found() {
52568         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
52569         *ret_copy = ProbeSendFailure_route_not_found();
52570         uint64_t ret_ref = tag_ptr(ret_copy, true);
52571         return ret_ref;
52572 }
52573
52574 uint64_t  __attribute__((export_name("TS_ProbeSendFailure_sending_failed"))) TS_ProbeSendFailure_sending_failed(uint64_t a) {
52575         void* a_ptr = untag_ptr(a);
52576         CHECK_ACCESS(a_ptr);
52577         LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
52578         a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(a));
52579         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
52580         *ret_copy = ProbeSendFailure_sending_failed(a_conv);
52581         uint64_t ret_ref = tag_ptr(ret_copy, true);
52582         return ret_ref;
52583 }
52584
52585 jboolean  __attribute__((export_name("TS_ProbeSendFailure_eq"))) TS_ProbeSendFailure_eq(uint64_t a, uint64_t b) {
52586         LDKProbeSendFailure* a_conv = (LDKProbeSendFailure*)untag_ptr(a);
52587         LDKProbeSendFailure* b_conv = (LDKProbeSendFailure*)untag_ptr(b);
52588         jboolean ret_conv = ProbeSendFailure_eq(a_conv, b_conv);
52589         return ret_conv;
52590 }
52591
52592 void  __attribute__((export_name("TS_RecipientOnionFields_free"))) TS_RecipientOnionFields_free(uint64_t this_obj) {
52593         LDKRecipientOnionFields this_obj_conv;
52594         this_obj_conv.inner = untag_ptr(this_obj);
52595         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52597         RecipientOnionFields_free(this_obj_conv);
52598 }
52599
52600 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_get_payment_secret"))) TS_RecipientOnionFields_get_payment_secret(uint64_t this_ptr) {
52601         LDKRecipientOnionFields this_ptr_conv;
52602         this_ptr_conv.inner = untag_ptr(this_ptr);
52603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52605         this_ptr_conv.is_owned = false;
52606         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
52607         *ret_copy = RecipientOnionFields_get_payment_secret(&this_ptr_conv);
52608         uint64_t ret_ref = tag_ptr(ret_copy, true);
52609         return ret_ref;
52610 }
52611
52612 void  __attribute__((export_name("TS_RecipientOnionFields_set_payment_secret"))) TS_RecipientOnionFields_set_payment_secret(uint64_t this_ptr, uint64_t val) {
52613         LDKRecipientOnionFields this_ptr_conv;
52614         this_ptr_conv.inner = untag_ptr(this_ptr);
52615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52617         this_ptr_conv.is_owned = false;
52618         void* val_ptr = untag_ptr(val);
52619         CHECK_ACCESS(val_ptr);
52620         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
52621         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
52622         RecipientOnionFields_set_payment_secret(&this_ptr_conv, val_conv);
52623 }
52624
52625 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_get_payment_metadata"))) TS_RecipientOnionFields_get_payment_metadata(uint64_t this_ptr) {
52626         LDKRecipientOnionFields this_ptr_conv;
52627         this_ptr_conv.inner = untag_ptr(this_ptr);
52628         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52630         this_ptr_conv.is_owned = false;
52631         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
52632         *ret_copy = RecipientOnionFields_get_payment_metadata(&this_ptr_conv);
52633         uint64_t ret_ref = tag_ptr(ret_copy, true);
52634         return ret_ref;
52635 }
52636
52637 void  __attribute__((export_name("TS_RecipientOnionFields_set_payment_metadata"))) TS_RecipientOnionFields_set_payment_metadata(uint64_t this_ptr, uint64_t val) {
52638         LDKRecipientOnionFields this_ptr_conv;
52639         this_ptr_conv.inner = untag_ptr(this_ptr);
52640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52642         this_ptr_conv.is_owned = false;
52643         void* val_ptr = untag_ptr(val);
52644         CHECK_ACCESS(val_ptr);
52645         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
52646         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
52647         RecipientOnionFields_set_payment_metadata(&this_ptr_conv, val_conv);
52648 }
52649
52650 static inline uint64_t RecipientOnionFields_clone_ptr(LDKRecipientOnionFields *NONNULL_PTR arg) {
52651         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(arg);
52652         uint64_t ret_ref = 0;
52653         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52654         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52655         return ret_ref;
52656 }
52657 int64_t  __attribute__((export_name("TS_RecipientOnionFields_clone_ptr"))) TS_RecipientOnionFields_clone_ptr(uint64_t arg) {
52658         LDKRecipientOnionFields arg_conv;
52659         arg_conv.inner = untag_ptr(arg);
52660         arg_conv.is_owned = ptr_is_owned(arg);
52661         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52662         arg_conv.is_owned = false;
52663         int64_t ret_conv = RecipientOnionFields_clone_ptr(&arg_conv);
52664         return ret_conv;
52665 }
52666
52667 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_clone"))) TS_RecipientOnionFields_clone(uint64_t orig) {
52668         LDKRecipientOnionFields orig_conv;
52669         orig_conv.inner = untag_ptr(orig);
52670         orig_conv.is_owned = ptr_is_owned(orig);
52671         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52672         orig_conv.is_owned = false;
52673         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(&orig_conv);
52674         uint64_t ret_ref = 0;
52675         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52676         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52677         return ret_ref;
52678 }
52679
52680 jboolean  __attribute__((export_name("TS_RecipientOnionFields_eq"))) TS_RecipientOnionFields_eq(uint64_t a, uint64_t b) {
52681         LDKRecipientOnionFields a_conv;
52682         a_conv.inner = untag_ptr(a);
52683         a_conv.is_owned = ptr_is_owned(a);
52684         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52685         a_conv.is_owned = false;
52686         LDKRecipientOnionFields b_conv;
52687         b_conv.inner = untag_ptr(b);
52688         b_conv.is_owned = ptr_is_owned(b);
52689         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52690         b_conv.is_owned = false;
52691         jboolean ret_conv = RecipientOnionFields_eq(&a_conv, &b_conv);
52692         return ret_conv;
52693 }
52694
52695 int8_tArray  __attribute__((export_name("TS_RecipientOnionFields_write"))) TS_RecipientOnionFields_write(uint64_t obj) {
52696         LDKRecipientOnionFields obj_conv;
52697         obj_conv.inner = untag_ptr(obj);
52698         obj_conv.is_owned = ptr_is_owned(obj);
52699         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52700         obj_conv.is_owned = false;
52701         LDKCVec_u8Z ret_var = RecipientOnionFields_write(&obj_conv);
52702         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52703         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52704         CVec_u8Z_free(ret_var);
52705         return ret_arr;
52706 }
52707
52708 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_read"))) TS_RecipientOnionFields_read(int8_tArray ser) {
52709         LDKu8slice ser_ref;
52710         ser_ref.datalen = ser->arr_len;
52711         ser_ref.data = ser->elems;
52712         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
52713         *ret_conv = RecipientOnionFields_read(ser_ref);
52714         FREE(ser);
52715         return tag_ptr(ret_conv, true);
52716 }
52717
52718 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_secret_only"))) TS_RecipientOnionFields_secret_only(int8_tArray payment_secret) {
52719         LDKThirtyTwoBytes payment_secret_ref;
52720         CHECK(payment_secret->arr_len == 32);
52721         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
52722         LDKRecipientOnionFields ret_var = RecipientOnionFields_secret_only(payment_secret_ref);
52723         uint64_t ret_ref = 0;
52724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52726         return ret_ref;
52727 }
52728
52729 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_spontaneous_empty"))) TS_RecipientOnionFields_spontaneous_empty() {
52730         LDKRecipientOnionFields ret_var = RecipientOnionFields_spontaneous_empty();
52731         uint64_t ret_ref = 0;
52732         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52733         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52734         return ret_ref;
52735 }
52736
52737 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_with_custom_tlvs"))) TS_RecipientOnionFields_with_custom_tlvs(uint64_t this_arg, uint64_tArray custom_tlvs) {
52738         LDKRecipientOnionFields this_arg_conv;
52739         this_arg_conv.inner = untag_ptr(this_arg);
52740         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52742         this_arg_conv = RecipientOnionFields_clone(&this_arg_conv);
52743         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
52744         custom_tlvs_constr.datalen = custom_tlvs->arr_len;
52745         if (custom_tlvs_constr.datalen > 0)
52746                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
52747         else
52748                 custom_tlvs_constr.data = NULL;
52749         uint64_t* custom_tlvs_vals = custom_tlvs->elems;
52750         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
52751                 uint64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
52752                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
52753                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
52754                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
52755                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
52756                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
52757         }
52758         FREE(custom_tlvs);
52759         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
52760         *ret_conv = RecipientOnionFields_with_custom_tlvs(this_arg_conv, custom_tlvs_constr);
52761         return tag_ptr(ret_conv, true);
52762 }
52763
52764 uint64_tArray  __attribute__((export_name("TS_RecipientOnionFields_custom_tlvs"))) TS_RecipientOnionFields_custom_tlvs(uint64_t this_arg) {
52765         LDKRecipientOnionFields this_arg_conv;
52766         this_arg_conv.inner = untag_ptr(this_arg);
52767         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52769         this_arg_conv.is_owned = false;
52770         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret_var = RecipientOnionFields_custom_tlvs(&this_arg_conv);
52771         uint64_tArray ret_arr = NULL;
52772         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
52773         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
52774         for (size_t x = 0; x < ret_var.datalen; x++) {
52775                 LDKC2Tuple_u64CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
52776                 *ret_conv_23_conv = ret_var.data[x];
52777                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
52778         }
52779         
52780         FREE(ret_var.data);
52781         return ret_arr;
52782 }
52783
52784 void  __attribute__((export_name("TS_CustomMessageReader_free"))) TS_CustomMessageReader_free(uint64_t this_ptr) {
52785         if (!ptr_is_owned(this_ptr)) return;
52786         void* this_ptr_ptr = untag_ptr(this_ptr);
52787         CHECK_ACCESS(this_ptr_ptr);
52788         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
52789         FREE(untag_ptr(this_ptr));
52790         CustomMessageReader_free(this_ptr_conv);
52791 }
52792
52793 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
52794         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
52795         *ret_ret = Type_clone(arg);
52796         return tag_ptr(ret_ret, true);
52797 }
52798 int64_t  __attribute__((export_name("TS_Type_clone_ptr"))) TS_Type_clone_ptr(uint64_t arg) {
52799         void* arg_ptr = untag_ptr(arg);
52800         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
52801         LDKType* arg_conv = (LDKType*)arg_ptr;
52802         int64_t ret_conv = Type_clone_ptr(arg_conv);
52803         return ret_conv;
52804 }
52805
52806 uint64_t  __attribute__((export_name("TS_Type_clone"))) TS_Type_clone(uint64_t orig) {
52807         void* orig_ptr = untag_ptr(orig);
52808         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
52809         LDKType* orig_conv = (LDKType*)orig_ptr;
52810         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
52811         *ret_ret = Type_clone(orig_conv);
52812         return tag_ptr(ret_ret, true);
52813 }
52814
52815 void  __attribute__((export_name("TS_Type_free"))) TS_Type_free(uint64_t this_ptr) {
52816         if (!ptr_is_owned(this_ptr)) return;
52817         void* this_ptr_ptr = untag_ptr(this_ptr);
52818         CHECK_ACCESS(this_ptr_ptr);
52819         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
52820         FREE(untag_ptr(this_ptr));
52821         Type_free(this_ptr_conv);
52822 }
52823
52824 void  __attribute__((export_name("TS_Offer_free"))) TS_Offer_free(uint64_t this_obj) {
52825         LDKOffer this_obj_conv;
52826         this_obj_conv.inner = untag_ptr(this_obj);
52827         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52829         Offer_free(this_obj_conv);
52830 }
52831
52832 static inline uint64_t Offer_clone_ptr(LDKOffer *NONNULL_PTR arg) {
52833         LDKOffer ret_var = Offer_clone(arg);
52834         uint64_t ret_ref = 0;
52835         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52836         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52837         return ret_ref;
52838 }
52839 int64_t  __attribute__((export_name("TS_Offer_clone_ptr"))) TS_Offer_clone_ptr(uint64_t arg) {
52840         LDKOffer arg_conv;
52841         arg_conv.inner = untag_ptr(arg);
52842         arg_conv.is_owned = ptr_is_owned(arg);
52843         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52844         arg_conv.is_owned = false;
52845         int64_t ret_conv = Offer_clone_ptr(&arg_conv);
52846         return ret_conv;
52847 }
52848
52849 uint64_t  __attribute__((export_name("TS_Offer_clone"))) TS_Offer_clone(uint64_t orig) {
52850         LDKOffer orig_conv;
52851         orig_conv.inner = untag_ptr(orig);
52852         orig_conv.is_owned = ptr_is_owned(orig);
52853         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52854         orig_conv.is_owned = false;
52855         LDKOffer ret_var = Offer_clone(&orig_conv);
52856         uint64_t ret_ref = 0;
52857         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52858         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52859         return ret_ref;
52860 }
52861
52862 ptrArray  __attribute__((export_name("TS_Offer_chains"))) TS_Offer_chains(uint64_t this_arg) {
52863         LDKOffer this_arg_conv;
52864         this_arg_conv.inner = untag_ptr(this_arg);
52865         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52867         this_arg_conv.is_owned = false;
52868         LDKCVec_ThirtyTwoBytesZ ret_var = Offer_chains(&this_arg_conv);
52869         ptrArray ret_arr = NULL;
52870         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
52871         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
52872         for (size_t m = 0; m < ret_var.datalen; m++) {
52873                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
52874                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
52875                 ret_arr_ptr[m] = ret_conv_12_arr;
52876         }
52877         
52878         FREE(ret_var.data);
52879         return ret_arr;
52880 }
52881
52882 uint64_t  __attribute__((export_name("TS_Offer_metadata"))) TS_Offer_metadata(uint64_t this_arg) {
52883         LDKOffer this_arg_conv;
52884         this_arg_conv.inner = untag_ptr(this_arg);
52885         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52887         this_arg_conv.is_owned = false;
52888         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
52889         *ret_copy = Offer_metadata(&this_arg_conv);
52890         uint64_t ret_ref = tag_ptr(ret_copy, true);
52891         return ret_ref;
52892 }
52893
52894 uint64_t  __attribute__((export_name("TS_Offer_amount"))) TS_Offer_amount(uint64_t this_arg) {
52895         LDKOffer this_arg_conv;
52896         this_arg_conv.inner = untag_ptr(this_arg);
52897         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52899         this_arg_conv.is_owned = false;
52900         LDKAmount ret_var = Offer_amount(&this_arg_conv);
52901         uint64_t ret_ref = 0;
52902         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52903         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52904         return ret_ref;
52905 }
52906
52907 uint64_t  __attribute__((export_name("TS_Offer_description"))) TS_Offer_description(uint64_t this_arg) {
52908         LDKOffer this_arg_conv;
52909         this_arg_conv.inner = untag_ptr(this_arg);
52910         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52912         this_arg_conv.is_owned = false;
52913         LDKPrintableString ret_var = Offer_description(&this_arg_conv);
52914         uint64_t ret_ref = 0;
52915         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52916         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52917         return ret_ref;
52918 }
52919
52920 uint64_t  __attribute__((export_name("TS_Offer_offer_features"))) TS_Offer_offer_features(uint64_t this_arg) {
52921         LDKOffer this_arg_conv;
52922         this_arg_conv.inner = untag_ptr(this_arg);
52923         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52925         this_arg_conv.is_owned = false;
52926         LDKOfferFeatures ret_var = Offer_offer_features(&this_arg_conv);
52927         uint64_t ret_ref = 0;
52928         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52929         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52930         return ret_ref;
52931 }
52932
52933 uint64_t  __attribute__((export_name("TS_Offer_absolute_expiry"))) TS_Offer_absolute_expiry(uint64_t this_arg) {
52934         LDKOffer this_arg_conv;
52935         this_arg_conv.inner = untag_ptr(this_arg);
52936         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52938         this_arg_conv.is_owned = false;
52939         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
52940         *ret_copy = Offer_absolute_expiry(&this_arg_conv);
52941         uint64_t ret_ref = tag_ptr(ret_copy, true);
52942         return ret_ref;
52943 }
52944
52945 uint64_t  __attribute__((export_name("TS_Offer_issuer"))) TS_Offer_issuer(uint64_t this_arg) {
52946         LDKOffer this_arg_conv;
52947         this_arg_conv.inner = untag_ptr(this_arg);
52948         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52950         this_arg_conv.is_owned = false;
52951         LDKPrintableString ret_var = Offer_issuer(&this_arg_conv);
52952         uint64_t ret_ref = 0;
52953         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52954         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52955         return ret_ref;
52956 }
52957
52958 uint64_tArray  __attribute__((export_name("TS_Offer_paths"))) TS_Offer_paths(uint64_t this_arg) {
52959         LDKOffer this_arg_conv;
52960         this_arg_conv.inner = untag_ptr(this_arg);
52961         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52963         this_arg_conv.is_owned = false;
52964         LDKCVec_BlindedPathZ ret_var = Offer_paths(&this_arg_conv);
52965         uint64_tArray ret_arr = NULL;
52966         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
52967         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
52968         for (size_t n = 0; n < ret_var.datalen; n++) {
52969                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
52970                 uint64_t ret_conv_13_ref = 0;
52971                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
52972                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
52973                 ret_arr_ptr[n] = ret_conv_13_ref;
52974         }
52975         
52976         FREE(ret_var.data);
52977         return ret_arr;
52978 }
52979
52980 uint64_t  __attribute__((export_name("TS_Offer_supported_quantity"))) TS_Offer_supported_quantity(uint64_t this_arg) {
52981         LDKOffer this_arg_conv;
52982         this_arg_conv.inner = untag_ptr(this_arg);
52983         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52985         this_arg_conv.is_owned = false;
52986         LDKQuantity ret_var = Offer_supported_quantity(&this_arg_conv);
52987         uint64_t ret_ref = 0;
52988         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52989         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52990         return ret_ref;
52991 }
52992
52993 int8_tArray  __attribute__((export_name("TS_Offer_signing_pubkey"))) TS_Offer_signing_pubkey(uint64_t this_arg) {
52994         LDKOffer this_arg_conv;
52995         this_arg_conv.inner = untag_ptr(this_arg);
52996         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52998         this_arg_conv.is_owned = false;
52999         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
53000         memcpy(ret_arr->elems, Offer_signing_pubkey(&this_arg_conv).compressed_form, 33);
53001         return ret_arr;
53002 }
53003
53004 jboolean  __attribute__((export_name("TS_Offer_supports_chain"))) TS_Offer_supports_chain(uint64_t this_arg, int8_tArray chain) {
53005         LDKOffer this_arg_conv;
53006         this_arg_conv.inner = untag_ptr(this_arg);
53007         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53009         this_arg_conv.is_owned = false;
53010         LDKThirtyTwoBytes chain_ref;
53011         CHECK(chain->arr_len == 32);
53012         memcpy(chain_ref.data, chain->elems, 32); FREE(chain);
53013         jboolean ret_conv = Offer_supports_chain(&this_arg_conv, chain_ref);
53014         return ret_conv;
53015 }
53016
53017 jboolean  __attribute__((export_name("TS_Offer_is_valid_quantity"))) TS_Offer_is_valid_quantity(uint64_t this_arg, int64_t quantity) {
53018         LDKOffer this_arg_conv;
53019         this_arg_conv.inner = untag_ptr(this_arg);
53020         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53022         this_arg_conv.is_owned = false;
53023         jboolean ret_conv = Offer_is_valid_quantity(&this_arg_conv, quantity);
53024         return ret_conv;
53025 }
53026
53027 jboolean  __attribute__((export_name("TS_Offer_expects_quantity"))) TS_Offer_expects_quantity(uint64_t this_arg) {
53028         LDKOffer this_arg_conv;
53029         this_arg_conv.inner = untag_ptr(this_arg);
53030         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53032         this_arg_conv.is_owned = false;
53033         jboolean ret_conv = Offer_expects_quantity(&this_arg_conv);
53034         return ret_conv;
53035 }
53036
53037 int8_tArray  __attribute__((export_name("TS_Offer_write"))) TS_Offer_write(uint64_t obj) {
53038         LDKOffer obj_conv;
53039         obj_conv.inner = untag_ptr(obj);
53040         obj_conv.is_owned = ptr_is_owned(obj);
53041         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53042         obj_conv.is_owned = false;
53043         LDKCVec_u8Z ret_var = Offer_write(&obj_conv);
53044         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53045         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53046         CVec_u8Z_free(ret_var);
53047         return ret_arr;
53048 }
53049
53050 void  __attribute__((export_name("TS_Amount_free"))) TS_Amount_free(uint64_t this_obj) {
53051         LDKAmount this_obj_conv;
53052         this_obj_conv.inner = untag_ptr(this_obj);
53053         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53055         Amount_free(this_obj_conv);
53056 }
53057
53058 static inline uint64_t Amount_clone_ptr(LDKAmount *NONNULL_PTR arg) {
53059         LDKAmount ret_var = Amount_clone(arg);
53060         uint64_t ret_ref = 0;
53061         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53062         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53063         return ret_ref;
53064 }
53065 int64_t  __attribute__((export_name("TS_Amount_clone_ptr"))) TS_Amount_clone_ptr(uint64_t arg) {
53066         LDKAmount arg_conv;
53067         arg_conv.inner = untag_ptr(arg);
53068         arg_conv.is_owned = ptr_is_owned(arg);
53069         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53070         arg_conv.is_owned = false;
53071         int64_t ret_conv = Amount_clone_ptr(&arg_conv);
53072         return ret_conv;
53073 }
53074
53075 uint64_t  __attribute__((export_name("TS_Amount_clone"))) TS_Amount_clone(uint64_t orig) {
53076         LDKAmount orig_conv;
53077         orig_conv.inner = untag_ptr(orig);
53078         orig_conv.is_owned = ptr_is_owned(orig);
53079         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53080         orig_conv.is_owned = false;
53081         LDKAmount ret_var = Amount_clone(&orig_conv);
53082         uint64_t ret_ref = 0;
53083         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53084         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53085         return ret_ref;
53086 }
53087
53088 void  __attribute__((export_name("TS_Quantity_free"))) TS_Quantity_free(uint64_t this_obj) {
53089         LDKQuantity this_obj_conv;
53090         this_obj_conv.inner = untag_ptr(this_obj);
53091         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53093         Quantity_free(this_obj_conv);
53094 }
53095
53096 static inline uint64_t Quantity_clone_ptr(LDKQuantity *NONNULL_PTR arg) {
53097         LDKQuantity ret_var = Quantity_clone(arg);
53098         uint64_t ret_ref = 0;
53099         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53100         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53101         return ret_ref;
53102 }
53103 int64_t  __attribute__((export_name("TS_Quantity_clone_ptr"))) TS_Quantity_clone_ptr(uint64_t arg) {
53104         LDKQuantity arg_conv;
53105         arg_conv.inner = untag_ptr(arg);
53106         arg_conv.is_owned = ptr_is_owned(arg);
53107         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53108         arg_conv.is_owned = false;
53109         int64_t ret_conv = Quantity_clone_ptr(&arg_conv);
53110         return ret_conv;
53111 }
53112
53113 uint64_t  __attribute__((export_name("TS_Quantity_clone"))) TS_Quantity_clone(uint64_t orig) {
53114         LDKQuantity orig_conv;
53115         orig_conv.inner = untag_ptr(orig);
53116         orig_conv.is_owned = ptr_is_owned(orig);
53117         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53118         orig_conv.is_owned = false;
53119         LDKQuantity ret_var = Quantity_clone(&orig_conv);
53120         uint64_t ret_ref = 0;
53121         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53122         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53123         return ret_ref;
53124 }
53125
53126 uint64_t  __attribute__((export_name("TS_Offer_from_str"))) TS_Offer_from_str(jstring s) {
53127         LDKStr s_conv = str_ref_to_owned_c(s);
53128         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
53129         *ret_conv = Offer_from_str(s_conv);
53130         return tag_ptr(ret_conv, true);
53131 }
53132
53133 void  __attribute__((export_name("TS_UnsignedBolt12Invoice_free"))) TS_UnsignedBolt12Invoice_free(uint64_t this_obj) {
53134         LDKUnsignedBolt12Invoice this_obj_conv;
53135         this_obj_conv.inner = untag_ptr(this_obj);
53136         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53138         UnsignedBolt12Invoice_free(this_obj_conv);
53139 }
53140
53141 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_tagged_hash"))) TS_UnsignedBolt12Invoice_tagged_hash(uint64_t this_arg) {
53142         LDKUnsignedBolt12Invoice this_arg_conv;
53143         this_arg_conv.inner = untag_ptr(this_arg);
53144         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53146         this_arg_conv.is_owned = false;
53147         LDKTaggedHash ret_var = UnsignedBolt12Invoice_tagged_hash(&this_arg_conv);
53148         uint64_t ret_ref = 0;
53149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53151         return ret_ref;
53152 }
53153
53154 void  __attribute__((export_name("TS_Bolt12Invoice_free"))) TS_Bolt12Invoice_free(uint64_t this_obj) {
53155         LDKBolt12Invoice this_obj_conv;
53156         this_obj_conv.inner = untag_ptr(this_obj);
53157         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53159         Bolt12Invoice_free(this_obj_conv);
53160 }
53161
53162 static inline uint64_t Bolt12Invoice_clone_ptr(LDKBolt12Invoice *NONNULL_PTR arg) {
53163         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(arg);
53164         uint64_t ret_ref = 0;
53165         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53166         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53167         return ret_ref;
53168 }
53169 int64_t  __attribute__((export_name("TS_Bolt12Invoice_clone_ptr"))) TS_Bolt12Invoice_clone_ptr(uint64_t arg) {
53170         LDKBolt12Invoice arg_conv;
53171         arg_conv.inner = untag_ptr(arg);
53172         arg_conv.is_owned = ptr_is_owned(arg);
53173         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53174         arg_conv.is_owned = false;
53175         int64_t ret_conv = Bolt12Invoice_clone_ptr(&arg_conv);
53176         return ret_conv;
53177 }
53178
53179 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_clone"))) TS_Bolt12Invoice_clone(uint64_t orig) {
53180         LDKBolt12Invoice orig_conv;
53181         orig_conv.inner = untag_ptr(orig);
53182         orig_conv.is_owned = ptr_is_owned(orig);
53183         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53184         orig_conv.is_owned = false;
53185         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(&orig_conv);
53186         uint64_t ret_ref = 0;
53187         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53188         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53189         return ret_ref;
53190 }
53191
53192 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_offer_chains"))) TS_UnsignedBolt12Invoice_offer_chains(uint64_t this_arg) {
53193         LDKUnsignedBolt12Invoice this_arg_conv;
53194         this_arg_conv.inner = untag_ptr(this_arg);
53195         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53197         this_arg_conv.is_owned = false;
53198         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
53199         *ret_copy = UnsignedBolt12Invoice_offer_chains(&this_arg_conv);
53200         uint64_t ret_ref = tag_ptr(ret_copy, true);
53201         return ret_ref;
53202 }
53203
53204 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_chain"))) TS_UnsignedBolt12Invoice_chain(uint64_t this_arg) {
53205         LDKUnsignedBolt12Invoice this_arg_conv;
53206         this_arg_conv.inner = untag_ptr(this_arg);
53207         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53209         this_arg_conv.is_owned = false;
53210         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
53211         memcpy(ret_arr->elems, UnsignedBolt12Invoice_chain(&this_arg_conv).data, 32);
53212         return ret_arr;
53213 }
53214
53215 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_metadata"))) TS_UnsignedBolt12Invoice_metadata(uint64_t this_arg) {
53216         LDKUnsignedBolt12Invoice this_arg_conv;
53217         this_arg_conv.inner = untag_ptr(this_arg);
53218         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53220         this_arg_conv.is_owned = false;
53221         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
53222         *ret_copy = UnsignedBolt12Invoice_metadata(&this_arg_conv);
53223         uint64_t ret_ref = tag_ptr(ret_copy, true);
53224         return ret_ref;
53225 }
53226
53227 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_amount"))) TS_UnsignedBolt12Invoice_amount(uint64_t this_arg) {
53228         LDKUnsignedBolt12Invoice this_arg_conv;
53229         this_arg_conv.inner = untag_ptr(this_arg);
53230         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53232         this_arg_conv.is_owned = false;
53233         LDKAmount ret_var = UnsignedBolt12Invoice_amount(&this_arg_conv);
53234         uint64_t ret_ref = 0;
53235         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53236         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53237         return ret_ref;
53238 }
53239
53240 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_offer_features"))) TS_UnsignedBolt12Invoice_offer_features(uint64_t this_arg) {
53241         LDKUnsignedBolt12Invoice this_arg_conv;
53242         this_arg_conv.inner = untag_ptr(this_arg);
53243         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53245         this_arg_conv.is_owned = false;
53246         LDKOfferFeatures ret_var = UnsignedBolt12Invoice_offer_features(&this_arg_conv);
53247         uint64_t ret_ref = 0;
53248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53249         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53250         return ret_ref;
53251 }
53252
53253 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_description"))) TS_UnsignedBolt12Invoice_description(uint64_t this_arg) {
53254         LDKUnsignedBolt12Invoice this_arg_conv;
53255         this_arg_conv.inner = untag_ptr(this_arg);
53256         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53258         this_arg_conv.is_owned = false;
53259         LDKPrintableString ret_var = UnsignedBolt12Invoice_description(&this_arg_conv);
53260         uint64_t ret_ref = 0;
53261         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53262         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53263         return ret_ref;
53264 }
53265
53266 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_absolute_expiry"))) TS_UnsignedBolt12Invoice_absolute_expiry(uint64_t this_arg) {
53267         LDKUnsignedBolt12Invoice this_arg_conv;
53268         this_arg_conv.inner = untag_ptr(this_arg);
53269         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53271         this_arg_conv.is_owned = false;
53272         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
53273         *ret_copy = UnsignedBolt12Invoice_absolute_expiry(&this_arg_conv);
53274         uint64_t ret_ref = tag_ptr(ret_copy, true);
53275         return ret_ref;
53276 }
53277
53278 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_issuer"))) TS_UnsignedBolt12Invoice_issuer(uint64_t this_arg) {
53279         LDKUnsignedBolt12Invoice this_arg_conv;
53280         this_arg_conv.inner = untag_ptr(this_arg);
53281         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53283         this_arg_conv.is_owned = false;
53284         LDKPrintableString ret_var = UnsignedBolt12Invoice_issuer(&this_arg_conv);
53285         uint64_t ret_ref = 0;
53286         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53287         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53288         return ret_ref;
53289 }
53290
53291 uint64_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_message_paths"))) TS_UnsignedBolt12Invoice_message_paths(uint64_t this_arg) {
53292         LDKUnsignedBolt12Invoice this_arg_conv;
53293         this_arg_conv.inner = untag_ptr(this_arg);
53294         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53296         this_arg_conv.is_owned = false;
53297         LDKCVec_BlindedPathZ ret_var = UnsignedBolt12Invoice_message_paths(&this_arg_conv);
53298         uint64_tArray ret_arr = NULL;
53299         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
53300         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
53301         for (size_t n = 0; n < ret_var.datalen; n++) {
53302                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
53303                 uint64_t ret_conv_13_ref = 0;
53304                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
53305                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
53306                 ret_arr_ptr[n] = ret_conv_13_ref;
53307         }
53308         
53309         FREE(ret_var.data);
53310         return ret_arr;
53311 }
53312
53313 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_supported_quantity"))) TS_UnsignedBolt12Invoice_supported_quantity(uint64_t this_arg) {
53314         LDKUnsignedBolt12Invoice this_arg_conv;
53315         this_arg_conv.inner = untag_ptr(this_arg);
53316         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53318         this_arg_conv.is_owned = false;
53319         LDKQuantity ret_var = UnsignedBolt12Invoice_supported_quantity(&this_arg_conv);
53320         uint64_t ret_ref = 0;
53321         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53322         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53323         return ret_ref;
53324 }
53325
53326 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_payer_metadata"))) TS_UnsignedBolt12Invoice_payer_metadata(uint64_t this_arg) {
53327         LDKUnsignedBolt12Invoice this_arg_conv;
53328         this_arg_conv.inner = untag_ptr(this_arg);
53329         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53331         this_arg_conv.is_owned = false;
53332         LDKu8slice ret_var = UnsignedBolt12Invoice_payer_metadata(&this_arg_conv);
53333         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53334         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53335         return ret_arr;
53336 }
53337
53338 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_invoice_request_features"))) TS_UnsignedBolt12Invoice_invoice_request_features(uint64_t this_arg) {
53339         LDKUnsignedBolt12Invoice this_arg_conv;
53340         this_arg_conv.inner = untag_ptr(this_arg);
53341         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53343         this_arg_conv.is_owned = false;
53344         LDKInvoiceRequestFeatures ret_var = UnsignedBolt12Invoice_invoice_request_features(&this_arg_conv);
53345         uint64_t ret_ref = 0;
53346         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53347         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53348         return ret_ref;
53349 }
53350
53351 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_quantity"))) TS_UnsignedBolt12Invoice_quantity(uint64_t this_arg) {
53352         LDKUnsignedBolt12Invoice this_arg_conv;
53353         this_arg_conv.inner = untag_ptr(this_arg);
53354         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53356         this_arg_conv.is_owned = false;
53357         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
53358         *ret_copy = UnsignedBolt12Invoice_quantity(&this_arg_conv);
53359         uint64_t ret_ref = tag_ptr(ret_copy, true);
53360         return ret_ref;
53361 }
53362
53363 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_payer_id"))) TS_UnsignedBolt12Invoice_payer_id(uint64_t this_arg) {
53364         LDKUnsignedBolt12Invoice this_arg_conv;
53365         this_arg_conv.inner = untag_ptr(this_arg);
53366         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53368         this_arg_conv.is_owned = false;
53369         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
53370         memcpy(ret_arr->elems, UnsignedBolt12Invoice_payer_id(&this_arg_conv).compressed_form, 33);
53371         return ret_arr;
53372 }
53373
53374 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_payer_note"))) TS_UnsignedBolt12Invoice_payer_note(uint64_t this_arg) {
53375         LDKUnsignedBolt12Invoice this_arg_conv;
53376         this_arg_conv.inner = untag_ptr(this_arg);
53377         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53379         this_arg_conv.is_owned = false;
53380         LDKPrintableString ret_var = UnsignedBolt12Invoice_payer_note(&this_arg_conv);
53381         uint64_t ret_ref = 0;
53382         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53383         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53384         return ret_ref;
53385 }
53386
53387 int64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_created_at"))) TS_UnsignedBolt12Invoice_created_at(uint64_t this_arg) {
53388         LDKUnsignedBolt12Invoice this_arg_conv;
53389         this_arg_conv.inner = untag_ptr(this_arg);
53390         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53392         this_arg_conv.is_owned = false;
53393         int64_t ret_conv = UnsignedBolt12Invoice_created_at(&this_arg_conv);
53394         return ret_conv;
53395 }
53396
53397 int64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_relative_expiry"))) TS_UnsignedBolt12Invoice_relative_expiry(uint64_t this_arg) {
53398         LDKUnsignedBolt12Invoice this_arg_conv;
53399         this_arg_conv.inner = untag_ptr(this_arg);
53400         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53402         this_arg_conv.is_owned = false;
53403         int64_t ret_conv = UnsignedBolt12Invoice_relative_expiry(&this_arg_conv);
53404         return ret_conv;
53405 }
53406
53407 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_payment_hash"))) TS_UnsignedBolt12Invoice_payment_hash(uint64_t this_arg) {
53408         LDKUnsignedBolt12Invoice this_arg_conv;
53409         this_arg_conv.inner = untag_ptr(this_arg);
53410         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53412         this_arg_conv.is_owned = false;
53413         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
53414         memcpy(ret_arr->elems, UnsignedBolt12Invoice_payment_hash(&this_arg_conv).data, 32);
53415         return ret_arr;
53416 }
53417
53418 int64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_amount_msats"))) TS_UnsignedBolt12Invoice_amount_msats(uint64_t this_arg) {
53419         LDKUnsignedBolt12Invoice this_arg_conv;
53420         this_arg_conv.inner = untag_ptr(this_arg);
53421         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53423         this_arg_conv.is_owned = false;
53424         int64_t ret_conv = UnsignedBolt12Invoice_amount_msats(&this_arg_conv);
53425         return ret_conv;
53426 }
53427
53428 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_invoice_features"))) TS_UnsignedBolt12Invoice_invoice_features(uint64_t this_arg) {
53429         LDKUnsignedBolt12Invoice this_arg_conv;
53430         this_arg_conv.inner = untag_ptr(this_arg);
53431         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53433         this_arg_conv.is_owned = false;
53434         LDKBolt12InvoiceFeatures ret_var = UnsignedBolt12Invoice_invoice_features(&this_arg_conv);
53435         uint64_t ret_ref = 0;
53436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53438         return ret_ref;
53439 }
53440
53441 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_signing_pubkey"))) TS_UnsignedBolt12Invoice_signing_pubkey(uint64_t this_arg) {
53442         LDKUnsignedBolt12Invoice this_arg_conv;
53443         this_arg_conv.inner = untag_ptr(this_arg);
53444         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53446         this_arg_conv.is_owned = false;
53447         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
53448         memcpy(ret_arr->elems, UnsignedBolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form, 33);
53449         return ret_arr;
53450 }
53451
53452 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_offer_chains"))) TS_Bolt12Invoice_offer_chains(uint64_t this_arg) {
53453         LDKBolt12Invoice this_arg_conv;
53454         this_arg_conv.inner = untag_ptr(this_arg);
53455         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53457         this_arg_conv.is_owned = false;
53458         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
53459         *ret_copy = Bolt12Invoice_offer_chains(&this_arg_conv);
53460         uint64_t ret_ref = tag_ptr(ret_copy, true);
53461         return ret_ref;
53462 }
53463
53464 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_chain"))) TS_Bolt12Invoice_chain(uint64_t this_arg) {
53465         LDKBolt12Invoice this_arg_conv;
53466         this_arg_conv.inner = untag_ptr(this_arg);
53467         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53469         this_arg_conv.is_owned = false;
53470         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
53471         memcpy(ret_arr->elems, Bolt12Invoice_chain(&this_arg_conv).data, 32);
53472         return ret_arr;
53473 }
53474
53475 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_metadata"))) TS_Bolt12Invoice_metadata(uint64_t this_arg) {
53476         LDKBolt12Invoice this_arg_conv;
53477         this_arg_conv.inner = untag_ptr(this_arg);
53478         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53480         this_arg_conv.is_owned = false;
53481         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
53482         *ret_copy = Bolt12Invoice_metadata(&this_arg_conv);
53483         uint64_t ret_ref = tag_ptr(ret_copy, true);
53484         return ret_ref;
53485 }
53486
53487 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_amount"))) TS_Bolt12Invoice_amount(uint64_t this_arg) {
53488         LDKBolt12Invoice this_arg_conv;
53489         this_arg_conv.inner = untag_ptr(this_arg);
53490         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53492         this_arg_conv.is_owned = false;
53493         LDKAmount ret_var = Bolt12Invoice_amount(&this_arg_conv);
53494         uint64_t ret_ref = 0;
53495         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53496         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53497         return ret_ref;
53498 }
53499
53500 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_offer_features"))) TS_Bolt12Invoice_offer_features(uint64_t this_arg) {
53501         LDKBolt12Invoice this_arg_conv;
53502         this_arg_conv.inner = untag_ptr(this_arg);
53503         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53505         this_arg_conv.is_owned = false;
53506         LDKOfferFeatures ret_var = Bolt12Invoice_offer_features(&this_arg_conv);
53507         uint64_t ret_ref = 0;
53508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53510         return ret_ref;
53511 }
53512
53513 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_description"))) TS_Bolt12Invoice_description(uint64_t this_arg) {
53514         LDKBolt12Invoice this_arg_conv;
53515         this_arg_conv.inner = untag_ptr(this_arg);
53516         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53518         this_arg_conv.is_owned = false;
53519         LDKPrintableString ret_var = Bolt12Invoice_description(&this_arg_conv);
53520         uint64_t ret_ref = 0;
53521         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53522         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53523         return ret_ref;
53524 }
53525
53526 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_absolute_expiry"))) TS_Bolt12Invoice_absolute_expiry(uint64_t this_arg) {
53527         LDKBolt12Invoice this_arg_conv;
53528         this_arg_conv.inner = untag_ptr(this_arg);
53529         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53531         this_arg_conv.is_owned = false;
53532         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
53533         *ret_copy = Bolt12Invoice_absolute_expiry(&this_arg_conv);
53534         uint64_t ret_ref = tag_ptr(ret_copy, true);
53535         return ret_ref;
53536 }
53537
53538 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_issuer"))) TS_Bolt12Invoice_issuer(uint64_t this_arg) {
53539         LDKBolt12Invoice this_arg_conv;
53540         this_arg_conv.inner = untag_ptr(this_arg);
53541         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53543         this_arg_conv.is_owned = false;
53544         LDKPrintableString ret_var = Bolt12Invoice_issuer(&this_arg_conv);
53545         uint64_t ret_ref = 0;
53546         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53547         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53548         return ret_ref;
53549 }
53550
53551 uint64_tArray  __attribute__((export_name("TS_Bolt12Invoice_message_paths"))) TS_Bolt12Invoice_message_paths(uint64_t this_arg) {
53552         LDKBolt12Invoice this_arg_conv;
53553         this_arg_conv.inner = untag_ptr(this_arg);
53554         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53556         this_arg_conv.is_owned = false;
53557         LDKCVec_BlindedPathZ ret_var = Bolt12Invoice_message_paths(&this_arg_conv);
53558         uint64_tArray ret_arr = NULL;
53559         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
53560         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
53561         for (size_t n = 0; n < ret_var.datalen; n++) {
53562                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
53563                 uint64_t ret_conv_13_ref = 0;
53564                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
53565                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
53566                 ret_arr_ptr[n] = ret_conv_13_ref;
53567         }
53568         
53569         FREE(ret_var.data);
53570         return ret_arr;
53571 }
53572
53573 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_supported_quantity"))) TS_Bolt12Invoice_supported_quantity(uint64_t this_arg) {
53574         LDKBolt12Invoice this_arg_conv;
53575         this_arg_conv.inner = untag_ptr(this_arg);
53576         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53578         this_arg_conv.is_owned = false;
53579         LDKQuantity ret_var = Bolt12Invoice_supported_quantity(&this_arg_conv);
53580         uint64_t ret_ref = 0;
53581         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53582         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53583         return ret_ref;
53584 }
53585
53586 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_payer_metadata"))) TS_Bolt12Invoice_payer_metadata(uint64_t this_arg) {
53587         LDKBolt12Invoice this_arg_conv;
53588         this_arg_conv.inner = untag_ptr(this_arg);
53589         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53591         this_arg_conv.is_owned = false;
53592         LDKu8slice ret_var = Bolt12Invoice_payer_metadata(&this_arg_conv);
53593         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53594         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53595         return ret_arr;
53596 }
53597
53598 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_invoice_request_features"))) TS_Bolt12Invoice_invoice_request_features(uint64_t this_arg) {
53599         LDKBolt12Invoice this_arg_conv;
53600         this_arg_conv.inner = untag_ptr(this_arg);
53601         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53603         this_arg_conv.is_owned = false;
53604         LDKInvoiceRequestFeatures ret_var = Bolt12Invoice_invoice_request_features(&this_arg_conv);
53605         uint64_t ret_ref = 0;
53606         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53607         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53608         return ret_ref;
53609 }
53610
53611 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_quantity"))) TS_Bolt12Invoice_quantity(uint64_t this_arg) {
53612         LDKBolt12Invoice this_arg_conv;
53613         this_arg_conv.inner = untag_ptr(this_arg);
53614         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53616         this_arg_conv.is_owned = false;
53617         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
53618         *ret_copy = Bolt12Invoice_quantity(&this_arg_conv);
53619         uint64_t ret_ref = tag_ptr(ret_copy, true);
53620         return ret_ref;
53621 }
53622
53623 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_payer_id"))) TS_Bolt12Invoice_payer_id(uint64_t this_arg) {
53624         LDKBolt12Invoice this_arg_conv;
53625         this_arg_conv.inner = untag_ptr(this_arg);
53626         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53628         this_arg_conv.is_owned = false;
53629         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
53630         memcpy(ret_arr->elems, Bolt12Invoice_payer_id(&this_arg_conv).compressed_form, 33);
53631         return ret_arr;
53632 }
53633
53634 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_payer_note"))) TS_Bolt12Invoice_payer_note(uint64_t this_arg) {
53635         LDKBolt12Invoice this_arg_conv;
53636         this_arg_conv.inner = untag_ptr(this_arg);
53637         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53639         this_arg_conv.is_owned = false;
53640         LDKPrintableString ret_var = Bolt12Invoice_payer_note(&this_arg_conv);
53641         uint64_t ret_ref = 0;
53642         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53643         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53644         return ret_ref;
53645 }
53646
53647 int64_t  __attribute__((export_name("TS_Bolt12Invoice_created_at"))) TS_Bolt12Invoice_created_at(uint64_t this_arg) {
53648         LDKBolt12Invoice this_arg_conv;
53649         this_arg_conv.inner = untag_ptr(this_arg);
53650         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53652         this_arg_conv.is_owned = false;
53653         int64_t ret_conv = Bolt12Invoice_created_at(&this_arg_conv);
53654         return ret_conv;
53655 }
53656
53657 int64_t  __attribute__((export_name("TS_Bolt12Invoice_relative_expiry"))) TS_Bolt12Invoice_relative_expiry(uint64_t this_arg) {
53658         LDKBolt12Invoice this_arg_conv;
53659         this_arg_conv.inner = untag_ptr(this_arg);
53660         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53662         this_arg_conv.is_owned = false;
53663         int64_t ret_conv = Bolt12Invoice_relative_expiry(&this_arg_conv);
53664         return ret_conv;
53665 }
53666
53667 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_payment_hash"))) TS_Bolt12Invoice_payment_hash(uint64_t this_arg) {
53668         LDKBolt12Invoice this_arg_conv;
53669         this_arg_conv.inner = untag_ptr(this_arg);
53670         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53672         this_arg_conv.is_owned = false;
53673         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
53674         memcpy(ret_arr->elems, Bolt12Invoice_payment_hash(&this_arg_conv).data, 32);
53675         return ret_arr;
53676 }
53677
53678 int64_t  __attribute__((export_name("TS_Bolt12Invoice_amount_msats"))) TS_Bolt12Invoice_amount_msats(uint64_t this_arg) {
53679         LDKBolt12Invoice this_arg_conv;
53680         this_arg_conv.inner = untag_ptr(this_arg);
53681         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53683         this_arg_conv.is_owned = false;
53684         int64_t ret_conv = Bolt12Invoice_amount_msats(&this_arg_conv);
53685         return ret_conv;
53686 }
53687
53688 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_invoice_features"))) TS_Bolt12Invoice_invoice_features(uint64_t this_arg) {
53689         LDKBolt12Invoice this_arg_conv;
53690         this_arg_conv.inner = untag_ptr(this_arg);
53691         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53693         this_arg_conv.is_owned = false;
53694         LDKBolt12InvoiceFeatures ret_var = Bolt12Invoice_invoice_features(&this_arg_conv);
53695         uint64_t ret_ref = 0;
53696         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53697         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53698         return ret_ref;
53699 }
53700
53701 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_signing_pubkey"))) TS_Bolt12Invoice_signing_pubkey(uint64_t this_arg) {
53702         LDKBolt12Invoice this_arg_conv;
53703         this_arg_conv.inner = untag_ptr(this_arg);
53704         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53706         this_arg_conv.is_owned = false;
53707         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
53708         memcpy(ret_arr->elems, Bolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form, 33);
53709         return ret_arr;
53710 }
53711
53712 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_signature"))) TS_Bolt12Invoice_signature(uint64_t this_arg) {
53713         LDKBolt12Invoice this_arg_conv;
53714         this_arg_conv.inner = untag_ptr(this_arg);
53715         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53717         this_arg_conv.is_owned = false;
53718         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
53719         memcpy(ret_arr->elems, Bolt12Invoice_signature(&this_arg_conv).compact_form, 64);
53720         return ret_arr;
53721 }
53722
53723 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_signable_hash"))) TS_Bolt12Invoice_signable_hash(uint64_t this_arg) {
53724         LDKBolt12Invoice this_arg_conv;
53725         this_arg_conv.inner = untag_ptr(this_arg);
53726         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53728         this_arg_conv.is_owned = false;
53729         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
53730         memcpy(ret_arr->elems, Bolt12Invoice_signable_hash(&this_arg_conv).data, 32);
53731         return ret_arr;
53732 }
53733
53734 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_verify"))) TS_Bolt12Invoice_verify(uint64_t this_arg, uint64_t key) {
53735         LDKBolt12Invoice this_arg_conv;
53736         this_arg_conv.inner = untag_ptr(this_arg);
53737         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53739         this_arg_conv.is_owned = false;
53740         LDKExpandedKey key_conv;
53741         key_conv.inner = untag_ptr(key);
53742         key_conv.is_owned = ptr_is_owned(key);
53743         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
53744         key_conv.is_owned = false;
53745         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
53746         *ret_conv = Bolt12Invoice_verify(&this_arg_conv, &key_conv);
53747         return tag_ptr(ret_conv, true);
53748 }
53749
53750 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_write"))) TS_UnsignedBolt12Invoice_write(uint64_t obj) {
53751         LDKUnsignedBolt12Invoice obj_conv;
53752         obj_conv.inner = untag_ptr(obj);
53753         obj_conv.is_owned = ptr_is_owned(obj);
53754         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53755         obj_conv.is_owned = false;
53756         LDKCVec_u8Z ret_var = UnsignedBolt12Invoice_write(&obj_conv);
53757         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53758         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53759         CVec_u8Z_free(ret_var);
53760         return ret_arr;
53761 }
53762
53763 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_write"))) TS_Bolt12Invoice_write(uint64_t obj) {
53764         LDKBolt12Invoice obj_conv;
53765         obj_conv.inner = untag_ptr(obj);
53766         obj_conv.is_owned = ptr_is_owned(obj);
53767         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53768         obj_conv.is_owned = false;
53769         LDKCVec_u8Z ret_var = Bolt12Invoice_write(&obj_conv);
53770         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53771         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53772         CVec_u8Z_free(ret_var);
53773         return ret_arr;
53774 }
53775
53776 void  __attribute__((export_name("TS_BlindedPayInfo_free"))) TS_BlindedPayInfo_free(uint64_t this_obj) {
53777         LDKBlindedPayInfo this_obj_conv;
53778         this_obj_conv.inner = untag_ptr(this_obj);
53779         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53781         BlindedPayInfo_free(this_obj_conv);
53782 }
53783
53784 int32_t  __attribute__((export_name("TS_BlindedPayInfo_get_fee_base_msat"))) TS_BlindedPayInfo_get_fee_base_msat(uint64_t this_ptr) {
53785         LDKBlindedPayInfo this_ptr_conv;
53786         this_ptr_conv.inner = untag_ptr(this_ptr);
53787         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53789         this_ptr_conv.is_owned = false;
53790         int32_t ret_conv = BlindedPayInfo_get_fee_base_msat(&this_ptr_conv);
53791         return ret_conv;
53792 }
53793
53794 void  __attribute__((export_name("TS_BlindedPayInfo_set_fee_base_msat"))) TS_BlindedPayInfo_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
53795         LDKBlindedPayInfo this_ptr_conv;
53796         this_ptr_conv.inner = untag_ptr(this_ptr);
53797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53799         this_ptr_conv.is_owned = false;
53800         BlindedPayInfo_set_fee_base_msat(&this_ptr_conv, val);
53801 }
53802
53803 int32_t  __attribute__((export_name("TS_BlindedPayInfo_get_fee_proportional_millionths"))) TS_BlindedPayInfo_get_fee_proportional_millionths(uint64_t this_ptr) {
53804         LDKBlindedPayInfo this_ptr_conv;
53805         this_ptr_conv.inner = untag_ptr(this_ptr);
53806         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53808         this_ptr_conv.is_owned = false;
53809         int32_t ret_conv = BlindedPayInfo_get_fee_proportional_millionths(&this_ptr_conv);
53810         return ret_conv;
53811 }
53812
53813 void  __attribute__((export_name("TS_BlindedPayInfo_set_fee_proportional_millionths"))) TS_BlindedPayInfo_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
53814         LDKBlindedPayInfo this_ptr_conv;
53815         this_ptr_conv.inner = untag_ptr(this_ptr);
53816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53818         this_ptr_conv.is_owned = false;
53819         BlindedPayInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
53820 }
53821
53822 int16_t  __attribute__((export_name("TS_BlindedPayInfo_get_cltv_expiry_delta"))) TS_BlindedPayInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
53823         LDKBlindedPayInfo this_ptr_conv;
53824         this_ptr_conv.inner = untag_ptr(this_ptr);
53825         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53827         this_ptr_conv.is_owned = false;
53828         int16_t ret_conv = BlindedPayInfo_get_cltv_expiry_delta(&this_ptr_conv);
53829         return ret_conv;
53830 }
53831
53832 void  __attribute__((export_name("TS_BlindedPayInfo_set_cltv_expiry_delta"))) TS_BlindedPayInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
53833         LDKBlindedPayInfo this_ptr_conv;
53834         this_ptr_conv.inner = untag_ptr(this_ptr);
53835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53837         this_ptr_conv.is_owned = false;
53838         BlindedPayInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
53839 }
53840
53841 int64_t  __attribute__((export_name("TS_BlindedPayInfo_get_htlc_minimum_msat"))) TS_BlindedPayInfo_get_htlc_minimum_msat(uint64_t this_ptr) {
53842         LDKBlindedPayInfo this_ptr_conv;
53843         this_ptr_conv.inner = untag_ptr(this_ptr);
53844         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53846         this_ptr_conv.is_owned = false;
53847         int64_t ret_conv = BlindedPayInfo_get_htlc_minimum_msat(&this_ptr_conv);
53848         return ret_conv;
53849 }
53850
53851 void  __attribute__((export_name("TS_BlindedPayInfo_set_htlc_minimum_msat"))) TS_BlindedPayInfo_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
53852         LDKBlindedPayInfo this_ptr_conv;
53853         this_ptr_conv.inner = untag_ptr(this_ptr);
53854         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53856         this_ptr_conv.is_owned = false;
53857         BlindedPayInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
53858 }
53859
53860 int64_t  __attribute__((export_name("TS_BlindedPayInfo_get_htlc_maximum_msat"))) TS_BlindedPayInfo_get_htlc_maximum_msat(uint64_t this_ptr) {
53861         LDKBlindedPayInfo this_ptr_conv;
53862         this_ptr_conv.inner = untag_ptr(this_ptr);
53863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53865         this_ptr_conv.is_owned = false;
53866         int64_t ret_conv = BlindedPayInfo_get_htlc_maximum_msat(&this_ptr_conv);
53867         return ret_conv;
53868 }
53869
53870 void  __attribute__((export_name("TS_BlindedPayInfo_set_htlc_maximum_msat"))) TS_BlindedPayInfo_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
53871         LDKBlindedPayInfo this_ptr_conv;
53872         this_ptr_conv.inner = untag_ptr(this_ptr);
53873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53875         this_ptr_conv.is_owned = false;
53876         BlindedPayInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
53877 }
53878
53879 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_get_features"))) TS_BlindedPayInfo_get_features(uint64_t this_ptr) {
53880         LDKBlindedPayInfo this_ptr_conv;
53881         this_ptr_conv.inner = untag_ptr(this_ptr);
53882         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53884         this_ptr_conv.is_owned = false;
53885         LDKBlindedHopFeatures ret_var = BlindedPayInfo_get_features(&this_ptr_conv);
53886         uint64_t ret_ref = 0;
53887         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53888         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53889         return ret_ref;
53890 }
53891
53892 void  __attribute__((export_name("TS_BlindedPayInfo_set_features"))) TS_BlindedPayInfo_set_features(uint64_t this_ptr, uint64_t val) {
53893         LDKBlindedPayInfo this_ptr_conv;
53894         this_ptr_conv.inner = untag_ptr(this_ptr);
53895         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53897         this_ptr_conv.is_owned = false;
53898         LDKBlindedHopFeatures val_conv;
53899         val_conv.inner = untag_ptr(val);
53900         val_conv.is_owned = ptr_is_owned(val);
53901         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53902         val_conv = BlindedHopFeatures_clone(&val_conv);
53903         BlindedPayInfo_set_features(&this_ptr_conv, val_conv);
53904 }
53905
53906 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) {
53907         LDKBlindedHopFeatures features_arg_conv;
53908         features_arg_conv.inner = untag_ptr(features_arg);
53909         features_arg_conv.is_owned = ptr_is_owned(features_arg);
53910         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
53911         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
53912         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);
53913         uint64_t ret_ref = 0;
53914         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53915         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53916         return ret_ref;
53917 }
53918
53919 static inline uint64_t BlindedPayInfo_clone_ptr(LDKBlindedPayInfo *NONNULL_PTR arg) {
53920         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(arg);
53921         uint64_t ret_ref = 0;
53922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53924         return ret_ref;
53925 }
53926 int64_t  __attribute__((export_name("TS_BlindedPayInfo_clone_ptr"))) TS_BlindedPayInfo_clone_ptr(uint64_t arg) {
53927         LDKBlindedPayInfo arg_conv;
53928         arg_conv.inner = untag_ptr(arg);
53929         arg_conv.is_owned = ptr_is_owned(arg);
53930         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53931         arg_conv.is_owned = false;
53932         int64_t ret_conv = BlindedPayInfo_clone_ptr(&arg_conv);
53933         return ret_conv;
53934 }
53935
53936 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_clone"))) TS_BlindedPayInfo_clone(uint64_t orig) {
53937         LDKBlindedPayInfo orig_conv;
53938         orig_conv.inner = untag_ptr(orig);
53939         orig_conv.is_owned = ptr_is_owned(orig);
53940         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53941         orig_conv.is_owned = false;
53942         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(&orig_conv);
53943         uint64_t ret_ref = 0;
53944         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53945         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53946         return ret_ref;
53947 }
53948
53949 int64_t  __attribute__((export_name("TS_BlindedPayInfo_hash"))) TS_BlindedPayInfo_hash(uint64_t o) {
53950         LDKBlindedPayInfo o_conv;
53951         o_conv.inner = untag_ptr(o);
53952         o_conv.is_owned = ptr_is_owned(o);
53953         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53954         o_conv.is_owned = false;
53955         int64_t ret_conv = BlindedPayInfo_hash(&o_conv);
53956         return ret_conv;
53957 }
53958
53959 jboolean  __attribute__((export_name("TS_BlindedPayInfo_eq"))) TS_BlindedPayInfo_eq(uint64_t a, uint64_t b) {
53960         LDKBlindedPayInfo a_conv;
53961         a_conv.inner = untag_ptr(a);
53962         a_conv.is_owned = ptr_is_owned(a);
53963         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53964         a_conv.is_owned = false;
53965         LDKBlindedPayInfo b_conv;
53966         b_conv.inner = untag_ptr(b);
53967         b_conv.is_owned = ptr_is_owned(b);
53968         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53969         b_conv.is_owned = false;
53970         jboolean ret_conv = BlindedPayInfo_eq(&a_conv, &b_conv);
53971         return ret_conv;
53972 }
53973
53974 int8_tArray  __attribute__((export_name("TS_BlindedPayInfo_write"))) TS_BlindedPayInfo_write(uint64_t obj) {
53975         LDKBlindedPayInfo obj_conv;
53976         obj_conv.inner = untag_ptr(obj);
53977         obj_conv.is_owned = ptr_is_owned(obj);
53978         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53979         obj_conv.is_owned = false;
53980         LDKCVec_u8Z ret_var = BlindedPayInfo_write(&obj_conv);
53981         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53982         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53983         CVec_u8Z_free(ret_var);
53984         return ret_arr;
53985 }
53986
53987 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_read"))) TS_BlindedPayInfo_read(int8_tArray ser) {
53988         LDKu8slice ser_ref;
53989         ser_ref.datalen = ser->arr_len;
53990         ser_ref.data = ser->elems;
53991         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
53992         *ret_conv = BlindedPayInfo_read(ser_ref);
53993         FREE(ser);
53994         return tag_ptr(ret_conv, true);
53995 }
53996
53997 void  __attribute__((export_name("TS_InvoiceError_free"))) TS_InvoiceError_free(uint64_t this_obj) {
53998         LDKInvoiceError this_obj_conv;
53999         this_obj_conv.inner = untag_ptr(this_obj);
54000         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54002         InvoiceError_free(this_obj_conv);
54003 }
54004
54005 uint64_t  __attribute__((export_name("TS_InvoiceError_get_erroneous_field"))) TS_InvoiceError_get_erroneous_field(uint64_t this_ptr) {
54006         LDKInvoiceError this_ptr_conv;
54007         this_ptr_conv.inner = untag_ptr(this_ptr);
54008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54010         this_ptr_conv.is_owned = false;
54011         LDKErroneousField ret_var = InvoiceError_get_erroneous_field(&this_ptr_conv);
54012         uint64_t ret_ref = 0;
54013         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54014         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54015         return ret_ref;
54016 }
54017
54018 void  __attribute__((export_name("TS_InvoiceError_set_erroneous_field"))) TS_InvoiceError_set_erroneous_field(uint64_t this_ptr, uint64_t val) {
54019         LDKInvoiceError this_ptr_conv;
54020         this_ptr_conv.inner = untag_ptr(this_ptr);
54021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54023         this_ptr_conv.is_owned = false;
54024         LDKErroneousField val_conv;
54025         val_conv.inner = untag_ptr(val);
54026         val_conv.is_owned = ptr_is_owned(val);
54027         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54028         val_conv = ErroneousField_clone(&val_conv);
54029         InvoiceError_set_erroneous_field(&this_ptr_conv, val_conv);
54030 }
54031
54032 uint64_t  __attribute__((export_name("TS_InvoiceError_get_message"))) TS_InvoiceError_get_message(uint64_t this_ptr) {
54033         LDKInvoiceError this_ptr_conv;
54034         this_ptr_conv.inner = untag_ptr(this_ptr);
54035         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54037         this_ptr_conv.is_owned = false;
54038         LDKUntrustedString ret_var = InvoiceError_get_message(&this_ptr_conv);
54039         uint64_t ret_ref = 0;
54040         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54041         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54042         return ret_ref;
54043 }
54044
54045 void  __attribute__((export_name("TS_InvoiceError_set_message"))) TS_InvoiceError_set_message(uint64_t this_ptr, uint64_t val) {
54046         LDKInvoiceError this_ptr_conv;
54047         this_ptr_conv.inner = untag_ptr(this_ptr);
54048         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54050         this_ptr_conv.is_owned = false;
54051         LDKUntrustedString val_conv;
54052         val_conv.inner = untag_ptr(val);
54053         val_conv.is_owned = ptr_is_owned(val);
54054         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54055         val_conv = UntrustedString_clone(&val_conv);
54056         InvoiceError_set_message(&this_ptr_conv, val_conv);
54057 }
54058
54059 uint64_t  __attribute__((export_name("TS_InvoiceError_new"))) TS_InvoiceError_new(uint64_t erroneous_field_arg, uint64_t message_arg) {
54060         LDKErroneousField erroneous_field_arg_conv;
54061         erroneous_field_arg_conv.inner = untag_ptr(erroneous_field_arg);
54062         erroneous_field_arg_conv.is_owned = ptr_is_owned(erroneous_field_arg);
54063         CHECK_INNER_FIELD_ACCESS_OR_NULL(erroneous_field_arg_conv);
54064         erroneous_field_arg_conv = ErroneousField_clone(&erroneous_field_arg_conv);
54065         LDKUntrustedString message_arg_conv;
54066         message_arg_conv.inner = untag_ptr(message_arg);
54067         message_arg_conv.is_owned = ptr_is_owned(message_arg);
54068         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_arg_conv);
54069         message_arg_conv = UntrustedString_clone(&message_arg_conv);
54070         LDKInvoiceError ret_var = InvoiceError_new(erroneous_field_arg_conv, message_arg_conv);
54071         uint64_t ret_ref = 0;
54072         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54073         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54074         return ret_ref;
54075 }
54076
54077 static inline uint64_t InvoiceError_clone_ptr(LDKInvoiceError *NONNULL_PTR arg) {
54078         LDKInvoiceError ret_var = InvoiceError_clone(arg);
54079         uint64_t ret_ref = 0;
54080         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54081         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54082         return ret_ref;
54083 }
54084 int64_t  __attribute__((export_name("TS_InvoiceError_clone_ptr"))) TS_InvoiceError_clone_ptr(uint64_t arg) {
54085         LDKInvoiceError arg_conv;
54086         arg_conv.inner = untag_ptr(arg);
54087         arg_conv.is_owned = ptr_is_owned(arg);
54088         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54089         arg_conv.is_owned = false;
54090         int64_t ret_conv = InvoiceError_clone_ptr(&arg_conv);
54091         return ret_conv;
54092 }
54093
54094 uint64_t  __attribute__((export_name("TS_InvoiceError_clone"))) TS_InvoiceError_clone(uint64_t orig) {
54095         LDKInvoiceError orig_conv;
54096         orig_conv.inner = untag_ptr(orig);
54097         orig_conv.is_owned = ptr_is_owned(orig);
54098         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54099         orig_conv.is_owned = false;
54100         LDKInvoiceError ret_var = InvoiceError_clone(&orig_conv);
54101         uint64_t ret_ref = 0;
54102         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54103         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54104         return ret_ref;
54105 }
54106
54107 void  __attribute__((export_name("TS_ErroneousField_free"))) TS_ErroneousField_free(uint64_t this_obj) {
54108         LDKErroneousField this_obj_conv;
54109         this_obj_conv.inner = untag_ptr(this_obj);
54110         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54112         ErroneousField_free(this_obj_conv);
54113 }
54114
54115 int64_t  __attribute__((export_name("TS_ErroneousField_get_tlv_fieldnum"))) TS_ErroneousField_get_tlv_fieldnum(uint64_t this_ptr) {
54116         LDKErroneousField this_ptr_conv;
54117         this_ptr_conv.inner = untag_ptr(this_ptr);
54118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54120         this_ptr_conv.is_owned = false;
54121         int64_t ret_conv = ErroneousField_get_tlv_fieldnum(&this_ptr_conv);
54122         return ret_conv;
54123 }
54124
54125 void  __attribute__((export_name("TS_ErroneousField_set_tlv_fieldnum"))) TS_ErroneousField_set_tlv_fieldnum(uint64_t this_ptr, int64_t val) {
54126         LDKErroneousField this_ptr_conv;
54127         this_ptr_conv.inner = untag_ptr(this_ptr);
54128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54130         this_ptr_conv.is_owned = false;
54131         ErroneousField_set_tlv_fieldnum(&this_ptr_conv, val);
54132 }
54133
54134 uint64_t  __attribute__((export_name("TS_ErroneousField_get_suggested_value"))) TS_ErroneousField_get_suggested_value(uint64_t this_ptr) {
54135         LDKErroneousField this_ptr_conv;
54136         this_ptr_conv.inner = untag_ptr(this_ptr);
54137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54139         this_ptr_conv.is_owned = false;
54140         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
54141         *ret_copy = ErroneousField_get_suggested_value(&this_ptr_conv);
54142         uint64_t ret_ref = tag_ptr(ret_copy, true);
54143         return ret_ref;
54144 }
54145
54146 void  __attribute__((export_name("TS_ErroneousField_set_suggested_value"))) TS_ErroneousField_set_suggested_value(uint64_t this_ptr, uint64_t val) {
54147         LDKErroneousField this_ptr_conv;
54148         this_ptr_conv.inner = untag_ptr(this_ptr);
54149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54151         this_ptr_conv.is_owned = false;
54152         void* val_ptr = untag_ptr(val);
54153         CHECK_ACCESS(val_ptr);
54154         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
54155         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
54156         ErroneousField_set_suggested_value(&this_ptr_conv, val_conv);
54157 }
54158
54159 uint64_t  __attribute__((export_name("TS_ErroneousField_new"))) TS_ErroneousField_new(int64_t tlv_fieldnum_arg, uint64_t suggested_value_arg) {
54160         void* suggested_value_arg_ptr = untag_ptr(suggested_value_arg);
54161         CHECK_ACCESS(suggested_value_arg_ptr);
54162         LDKCOption_CVec_u8ZZ suggested_value_arg_conv = *(LDKCOption_CVec_u8ZZ*)(suggested_value_arg_ptr);
54163         suggested_value_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(suggested_value_arg));
54164         LDKErroneousField ret_var = ErroneousField_new(tlv_fieldnum_arg, suggested_value_arg_conv);
54165         uint64_t ret_ref = 0;
54166         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54167         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54168         return ret_ref;
54169 }
54170
54171 static inline uint64_t ErroneousField_clone_ptr(LDKErroneousField *NONNULL_PTR arg) {
54172         LDKErroneousField ret_var = ErroneousField_clone(arg);
54173         uint64_t ret_ref = 0;
54174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54176         return ret_ref;
54177 }
54178 int64_t  __attribute__((export_name("TS_ErroneousField_clone_ptr"))) TS_ErroneousField_clone_ptr(uint64_t arg) {
54179         LDKErroneousField arg_conv;
54180         arg_conv.inner = untag_ptr(arg);
54181         arg_conv.is_owned = ptr_is_owned(arg);
54182         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54183         arg_conv.is_owned = false;
54184         int64_t ret_conv = ErroneousField_clone_ptr(&arg_conv);
54185         return ret_conv;
54186 }
54187
54188 uint64_t  __attribute__((export_name("TS_ErroneousField_clone"))) TS_ErroneousField_clone(uint64_t orig) {
54189         LDKErroneousField orig_conv;
54190         orig_conv.inner = untag_ptr(orig);
54191         orig_conv.is_owned = ptr_is_owned(orig);
54192         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54193         orig_conv.is_owned = false;
54194         LDKErroneousField ret_var = ErroneousField_clone(&orig_conv);
54195         uint64_t ret_ref = 0;
54196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54198         return ret_ref;
54199 }
54200
54201 int8_tArray  __attribute__((export_name("TS_InvoiceError_write"))) TS_InvoiceError_write(uint64_t obj) {
54202         LDKInvoiceError obj_conv;
54203         obj_conv.inner = untag_ptr(obj);
54204         obj_conv.is_owned = ptr_is_owned(obj);
54205         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54206         obj_conv.is_owned = false;
54207         LDKCVec_u8Z ret_var = InvoiceError_write(&obj_conv);
54208         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54209         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54210         CVec_u8Z_free(ret_var);
54211         return ret_arr;
54212 }
54213
54214 uint64_t  __attribute__((export_name("TS_InvoiceError_read"))) TS_InvoiceError_read(int8_tArray ser) {
54215         LDKu8slice ser_ref;
54216         ser_ref.datalen = ser->arr_len;
54217         ser_ref.data = ser->elems;
54218         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
54219         *ret_conv = InvoiceError_read(ser_ref);
54220         FREE(ser);
54221         return tag_ptr(ret_conv, true);
54222 }
54223
54224 void  __attribute__((export_name("TS_UnsignedInvoiceRequest_free"))) TS_UnsignedInvoiceRequest_free(uint64_t this_obj) {
54225         LDKUnsignedInvoiceRequest this_obj_conv;
54226         this_obj_conv.inner = untag_ptr(this_obj);
54227         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54229         UnsignedInvoiceRequest_free(this_obj_conv);
54230 }
54231
54232 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_tagged_hash"))) TS_UnsignedInvoiceRequest_tagged_hash(uint64_t this_arg) {
54233         LDKUnsignedInvoiceRequest this_arg_conv;
54234         this_arg_conv.inner = untag_ptr(this_arg);
54235         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54237         this_arg_conv.is_owned = false;
54238         LDKTaggedHash ret_var = UnsignedInvoiceRequest_tagged_hash(&this_arg_conv);
54239         uint64_t ret_ref = 0;
54240         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54241         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54242         return ret_ref;
54243 }
54244
54245 void  __attribute__((export_name("TS_InvoiceRequest_free"))) TS_InvoiceRequest_free(uint64_t this_obj) {
54246         LDKInvoiceRequest this_obj_conv;
54247         this_obj_conv.inner = untag_ptr(this_obj);
54248         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54250         InvoiceRequest_free(this_obj_conv);
54251 }
54252
54253 static inline uint64_t InvoiceRequest_clone_ptr(LDKInvoiceRequest *NONNULL_PTR arg) {
54254         LDKInvoiceRequest ret_var = InvoiceRequest_clone(arg);
54255         uint64_t ret_ref = 0;
54256         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54257         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54258         return ret_ref;
54259 }
54260 int64_t  __attribute__((export_name("TS_InvoiceRequest_clone_ptr"))) TS_InvoiceRequest_clone_ptr(uint64_t arg) {
54261         LDKInvoiceRequest arg_conv;
54262         arg_conv.inner = untag_ptr(arg);
54263         arg_conv.is_owned = ptr_is_owned(arg);
54264         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54265         arg_conv.is_owned = false;
54266         int64_t ret_conv = InvoiceRequest_clone_ptr(&arg_conv);
54267         return ret_conv;
54268 }
54269
54270 uint64_t  __attribute__((export_name("TS_InvoiceRequest_clone"))) TS_InvoiceRequest_clone(uint64_t orig) {
54271         LDKInvoiceRequest orig_conv;
54272         orig_conv.inner = untag_ptr(orig);
54273         orig_conv.is_owned = ptr_is_owned(orig);
54274         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54275         orig_conv.is_owned = false;
54276         LDKInvoiceRequest ret_var = InvoiceRequest_clone(&orig_conv);
54277         uint64_t ret_ref = 0;
54278         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54279         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54280         return ret_ref;
54281 }
54282
54283 void  __attribute__((export_name("TS_VerifiedInvoiceRequest_free"))) TS_VerifiedInvoiceRequest_free(uint64_t this_obj) {
54284         LDKVerifiedInvoiceRequest this_obj_conv;
54285         this_obj_conv.inner = untag_ptr(this_obj);
54286         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54288         VerifiedInvoiceRequest_free(this_obj_conv);
54289 }
54290
54291 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_get_keys"))) TS_VerifiedInvoiceRequest_get_keys(uint64_t this_ptr) {
54292         LDKVerifiedInvoiceRequest this_ptr_conv;
54293         this_ptr_conv.inner = untag_ptr(this_ptr);
54294         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54296         this_ptr_conv.is_owned = false;
54297         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
54298         *ret_copy = VerifiedInvoiceRequest_get_keys(&this_ptr_conv);
54299         uint64_t ret_ref = tag_ptr(ret_copy, true);
54300         return ret_ref;
54301 }
54302
54303 void  __attribute__((export_name("TS_VerifiedInvoiceRequest_set_keys"))) TS_VerifiedInvoiceRequest_set_keys(uint64_t this_ptr, uint64_t val) {
54304         LDKVerifiedInvoiceRequest this_ptr_conv;
54305         this_ptr_conv.inner = untag_ptr(this_ptr);
54306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54308         this_ptr_conv.is_owned = false;
54309         void* val_ptr = untag_ptr(val);
54310         CHECK_ACCESS(val_ptr);
54311         LDKCOption_SecretKeyZ val_conv = *(LDKCOption_SecretKeyZ*)(val_ptr);
54312         val_conv = COption_SecretKeyZ_clone((LDKCOption_SecretKeyZ*)untag_ptr(val));
54313         VerifiedInvoiceRequest_set_keys(&this_ptr_conv, val_conv);
54314 }
54315
54316 static inline uint64_t VerifiedInvoiceRequest_clone_ptr(LDKVerifiedInvoiceRequest *NONNULL_PTR arg) {
54317         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(arg);
54318         uint64_t ret_ref = 0;
54319         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54320         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54321         return ret_ref;
54322 }
54323 int64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_clone_ptr"))) TS_VerifiedInvoiceRequest_clone_ptr(uint64_t arg) {
54324         LDKVerifiedInvoiceRequest arg_conv;
54325         arg_conv.inner = untag_ptr(arg);
54326         arg_conv.is_owned = ptr_is_owned(arg);
54327         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54328         arg_conv.is_owned = false;
54329         int64_t ret_conv = VerifiedInvoiceRequest_clone_ptr(&arg_conv);
54330         return ret_conv;
54331 }
54332
54333 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_clone"))) TS_VerifiedInvoiceRequest_clone(uint64_t orig) {
54334         LDKVerifiedInvoiceRequest orig_conv;
54335         orig_conv.inner = untag_ptr(orig);
54336         orig_conv.is_owned = ptr_is_owned(orig);
54337         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54338         orig_conv.is_owned = false;
54339         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(&orig_conv);
54340         uint64_t ret_ref = 0;
54341         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54342         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54343         return ret_ref;
54344 }
54345
54346 ptrArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_chains"))) TS_UnsignedInvoiceRequest_chains(uint64_t this_arg) {
54347         LDKUnsignedInvoiceRequest this_arg_conv;
54348         this_arg_conv.inner = untag_ptr(this_arg);
54349         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54351         this_arg_conv.is_owned = false;
54352         LDKCVec_ThirtyTwoBytesZ ret_var = UnsignedInvoiceRequest_chains(&this_arg_conv);
54353         ptrArray ret_arr = NULL;
54354         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
54355         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
54356         for (size_t m = 0; m < ret_var.datalen; m++) {
54357                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
54358                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
54359                 ret_arr_ptr[m] = ret_conv_12_arr;
54360         }
54361         
54362         FREE(ret_var.data);
54363         return ret_arr;
54364 }
54365
54366 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_metadata"))) TS_UnsignedInvoiceRequest_metadata(uint64_t this_arg) {
54367         LDKUnsignedInvoiceRequest this_arg_conv;
54368         this_arg_conv.inner = untag_ptr(this_arg);
54369         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54371         this_arg_conv.is_owned = false;
54372         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
54373         *ret_copy = UnsignedInvoiceRequest_metadata(&this_arg_conv);
54374         uint64_t ret_ref = tag_ptr(ret_copy, true);
54375         return ret_ref;
54376 }
54377
54378 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_amount"))) TS_UnsignedInvoiceRequest_amount(uint64_t this_arg) {
54379         LDKUnsignedInvoiceRequest this_arg_conv;
54380         this_arg_conv.inner = untag_ptr(this_arg);
54381         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54383         this_arg_conv.is_owned = false;
54384         LDKAmount ret_var = UnsignedInvoiceRequest_amount(&this_arg_conv);
54385         uint64_t ret_ref = 0;
54386         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54387         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54388         return ret_ref;
54389 }
54390
54391 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_description"))) TS_UnsignedInvoiceRequest_description(uint64_t this_arg) {
54392         LDKUnsignedInvoiceRequest this_arg_conv;
54393         this_arg_conv.inner = untag_ptr(this_arg);
54394         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54396         this_arg_conv.is_owned = false;
54397         LDKPrintableString ret_var = UnsignedInvoiceRequest_description(&this_arg_conv);
54398         uint64_t ret_ref = 0;
54399         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54400         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54401         return ret_ref;
54402 }
54403
54404 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_offer_features"))) TS_UnsignedInvoiceRequest_offer_features(uint64_t this_arg) {
54405         LDKUnsignedInvoiceRequest this_arg_conv;
54406         this_arg_conv.inner = untag_ptr(this_arg);
54407         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54409         this_arg_conv.is_owned = false;
54410         LDKOfferFeatures ret_var = UnsignedInvoiceRequest_offer_features(&this_arg_conv);
54411         uint64_t ret_ref = 0;
54412         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54413         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54414         return ret_ref;
54415 }
54416
54417 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_absolute_expiry"))) TS_UnsignedInvoiceRequest_absolute_expiry(uint64_t this_arg) {
54418         LDKUnsignedInvoiceRequest this_arg_conv;
54419         this_arg_conv.inner = untag_ptr(this_arg);
54420         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54422         this_arg_conv.is_owned = false;
54423         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
54424         *ret_copy = UnsignedInvoiceRequest_absolute_expiry(&this_arg_conv);
54425         uint64_t ret_ref = tag_ptr(ret_copy, true);
54426         return ret_ref;
54427 }
54428
54429 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_issuer"))) TS_UnsignedInvoiceRequest_issuer(uint64_t this_arg) {
54430         LDKUnsignedInvoiceRequest this_arg_conv;
54431         this_arg_conv.inner = untag_ptr(this_arg);
54432         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54434         this_arg_conv.is_owned = false;
54435         LDKPrintableString ret_var = UnsignedInvoiceRequest_issuer(&this_arg_conv);
54436         uint64_t ret_ref = 0;
54437         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54438         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54439         return ret_ref;
54440 }
54441
54442 uint64_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_paths"))) TS_UnsignedInvoiceRequest_paths(uint64_t this_arg) {
54443         LDKUnsignedInvoiceRequest this_arg_conv;
54444         this_arg_conv.inner = untag_ptr(this_arg);
54445         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54447         this_arg_conv.is_owned = false;
54448         LDKCVec_BlindedPathZ ret_var = UnsignedInvoiceRequest_paths(&this_arg_conv);
54449         uint64_tArray ret_arr = NULL;
54450         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
54451         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
54452         for (size_t n = 0; n < ret_var.datalen; n++) {
54453                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
54454                 uint64_t ret_conv_13_ref = 0;
54455                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
54456                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
54457                 ret_arr_ptr[n] = ret_conv_13_ref;
54458         }
54459         
54460         FREE(ret_var.data);
54461         return ret_arr;
54462 }
54463
54464 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_supported_quantity"))) TS_UnsignedInvoiceRequest_supported_quantity(uint64_t this_arg) {
54465         LDKUnsignedInvoiceRequest this_arg_conv;
54466         this_arg_conv.inner = untag_ptr(this_arg);
54467         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54469         this_arg_conv.is_owned = false;
54470         LDKQuantity ret_var = UnsignedInvoiceRequest_supported_quantity(&this_arg_conv);
54471         uint64_t ret_ref = 0;
54472         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54473         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54474         return ret_ref;
54475 }
54476
54477 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_signing_pubkey"))) TS_UnsignedInvoiceRequest_signing_pubkey(uint64_t this_arg) {
54478         LDKUnsignedInvoiceRequest this_arg_conv;
54479         this_arg_conv.inner = untag_ptr(this_arg);
54480         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54482         this_arg_conv.is_owned = false;
54483         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
54484         memcpy(ret_arr->elems, UnsignedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form, 33);
54485         return ret_arr;
54486 }
54487
54488 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_payer_metadata"))) TS_UnsignedInvoiceRequest_payer_metadata(uint64_t this_arg) {
54489         LDKUnsignedInvoiceRequest this_arg_conv;
54490         this_arg_conv.inner = untag_ptr(this_arg);
54491         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54493         this_arg_conv.is_owned = false;
54494         LDKu8slice ret_var = UnsignedInvoiceRequest_payer_metadata(&this_arg_conv);
54495         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54496         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54497         return ret_arr;
54498 }
54499
54500 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_chain"))) TS_UnsignedInvoiceRequest_chain(uint64_t this_arg) {
54501         LDKUnsignedInvoiceRequest this_arg_conv;
54502         this_arg_conv.inner = untag_ptr(this_arg);
54503         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54505         this_arg_conv.is_owned = false;
54506         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54507         memcpy(ret_arr->elems, UnsignedInvoiceRequest_chain(&this_arg_conv).data, 32);
54508         return ret_arr;
54509 }
54510
54511 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_amount_msats"))) TS_UnsignedInvoiceRequest_amount_msats(uint64_t this_arg) {
54512         LDKUnsignedInvoiceRequest this_arg_conv;
54513         this_arg_conv.inner = untag_ptr(this_arg);
54514         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54516         this_arg_conv.is_owned = false;
54517         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
54518         *ret_copy = UnsignedInvoiceRequest_amount_msats(&this_arg_conv);
54519         uint64_t ret_ref = tag_ptr(ret_copy, true);
54520         return ret_ref;
54521 }
54522
54523 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_invoice_request_features"))) TS_UnsignedInvoiceRequest_invoice_request_features(uint64_t this_arg) {
54524         LDKUnsignedInvoiceRequest this_arg_conv;
54525         this_arg_conv.inner = untag_ptr(this_arg);
54526         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54528         this_arg_conv.is_owned = false;
54529         LDKInvoiceRequestFeatures ret_var = UnsignedInvoiceRequest_invoice_request_features(&this_arg_conv);
54530         uint64_t ret_ref = 0;
54531         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54532         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54533         return ret_ref;
54534 }
54535
54536 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_quantity"))) TS_UnsignedInvoiceRequest_quantity(uint64_t this_arg) {
54537         LDKUnsignedInvoiceRequest this_arg_conv;
54538         this_arg_conv.inner = untag_ptr(this_arg);
54539         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54541         this_arg_conv.is_owned = false;
54542         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
54543         *ret_copy = UnsignedInvoiceRequest_quantity(&this_arg_conv);
54544         uint64_t ret_ref = tag_ptr(ret_copy, true);
54545         return ret_ref;
54546 }
54547
54548 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_payer_id"))) TS_UnsignedInvoiceRequest_payer_id(uint64_t this_arg) {
54549         LDKUnsignedInvoiceRequest this_arg_conv;
54550         this_arg_conv.inner = untag_ptr(this_arg);
54551         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54553         this_arg_conv.is_owned = false;
54554         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
54555         memcpy(ret_arr->elems, UnsignedInvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
54556         return ret_arr;
54557 }
54558
54559 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_payer_note"))) TS_UnsignedInvoiceRequest_payer_note(uint64_t this_arg) {
54560         LDKUnsignedInvoiceRequest this_arg_conv;
54561         this_arg_conv.inner = untag_ptr(this_arg);
54562         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54564         this_arg_conv.is_owned = false;
54565         LDKPrintableString ret_var = UnsignedInvoiceRequest_payer_note(&this_arg_conv);
54566         uint64_t ret_ref = 0;
54567         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54568         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54569         return ret_ref;
54570 }
54571
54572 ptrArray  __attribute__((export_name("TS_InvoiceRequest_chains"))) TS_InvoiceRequest_chains(uint64_t this_arg) {
54573         LDKInvoiceRequest this_arg_conv;
54574         this_arg_conv.inner = untag_ptr(this_arg);
54575         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54577         this_arg_conv.is_owned = false;
54578         LDKCVec_ThirtyTwoBytesZ ret_var = InvoiceRequest_chains(&this_arg_conv);
54579         ptrArray ret_arr = NULL;
54580         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
54581         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
54582         for (size_t m = 0; m < ret_var.datalen; m++) {
54583                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
54584                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
54585                 ret_arr_ptr[m] = ret_conv_12_arr;
54586         }
54587         
54588         FREE(ret_var.data);
54589         return ret_arr;
54590 }
54591
54592 uint64_t  __attribute__((export_name("TS_InvoiceRequest_metadata"))) TS_InvoiceRequest_metadata(uint64_t this_arg) {
54593         LDKInvoiceRequest this_arg_conv;
54594         this_arg_conv.inner = untag_ptr(this_arg);
54595         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54597         this_arg_conv.is_owned = false;
54598         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
54599         *ret_copy = InvoiceRequest_metadata(&this_arg_conv);
54600         uint64_t ret_ref = tag_ptr(ret_copy, true);
54601         return ret_ref;
54602 }
54603
54604 uint64_t  __attribute__((export_name("TS_InvoiceRequest_amount"))) TS_InvoiceRequest_amount(uint64_t this_arg) {
54605         LDKInvoiceRequest this_arg_conv;
54606         this_arg_conv.inner = untag_ptr(this_arg);
54607         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54609         this_arg_conv.is_owned = false;
54610         LDKAmount ret_var = InvoiceRequest_amount(&this_arg_conv);
54611         uint64_t ret_ref = 0;
54612         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54613         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54614         return ret_ref;
54615 }
54616
54617 uint64_t  __attribute__((export_name("TS_InvoiceRequest_description"))) TS_InvoiceRequest_description(uint64_t this_arg) {
54618         LDKInvoiceRequest this_arg_conv;
54619         this_arg_conv.inner = untag_ptr(this_arg);
54620         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54622         this_arg_conv.is_owned = false;
54623         LDKPrintableString ret_var = InvoiceRequest_description(&this_arg_conv);
54624         uint64_t ret_ref = 0;
54625         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54626         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54627         return ret_ref;
54628 }
54629
54630 uint64_t  __attribute__((export_name("TS_InvoiceRequest_offer_features"))) TS_InvoiceRequest_offer_features(uint64_t this_arg) {
54631         LDKInvoiceRequest this_arg_conv;
54632         this_arg_conv.inner = untag_ptr(this_arg);
54633         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54635         this_arg_conv.is_owned = false;
54636         LDKOfferFeatures ret_var = InvoiceRequest_offer_features(&this_arg_conv);
54637         uint64_t ret_ref = 0;
54638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54640         return ret_ref;
54641 }
54642
54643 uint64_t  __attribute__((export_name("TS_InvoiceRequest_absolute_expiry"))) TS_InvoiceRequest_absolute_expiry(uint64_t this_arg) {
54644         LDKInvoiceRequest this_arg_conv;
54645         this_arg_conv.inner = untag_ptr(this_arg);
54646         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54648         this_arg_conv.is_owned = false;
54649         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
54650         *ret_copy = InvoiceRequest_absolute_expiry(&this_arg_conv);
54651         uint64_t ret_ref = tag_ptr(ret_copy, true);
54652         return ret_ref;
54653 }
54654
54655 uint64_t  __attribute__((export_name("TS_InvoiceRequest_issuer"))) TS_InvoiceRequest_issuer(uint64_t this_arg) {
54656         LDKInvoiceRequest this_arg_conv;
54657         this_arg_conv.inner = untag_ptr(this_arg);
54658         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54660         this_arg_conv.is_owned = false;
54661         LDKPrintableString ret_var = InvoiceRequest_issuer(&this_arg_conv);
54662         uint64_t ret_ref = 0;
54663         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54664         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54665         return ret_ref;
54666 }
54667
54668 uint64_tArray  __attribute__((export_name("TS_InvoiceRequest_paths"))) TS_InvoiceRequest_paths(uint64_t this_arg) {
54669         LDKInvoiceRequest this_arg_conv;
54670         this_arg_conv.inner = untag_ptr(this_arg);
54671         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54673         this_arg_conv.is_owned = false;
54674         LDKCVec_BlindedPathZ ret_var = InvoiceRequest_paths(&this_arg_conv);
54675         uint64_tArray ret_arr = NULL;
54676         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
54677         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
54678         for (size_t n = 0; n < ret_var.datalen; n++) {
54679                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
54680                 uint64_t ret_conv_13_ref = 0;
54681                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
54682                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
54683                 ret_arr_ptr[n] = ret_conv_13_ref;
54684         }
54685         
54686         FREE(ret_var.data);
54687         return ret_arr;
54688 }
54689
54690 uint64_t  __attribute__((export_name("TS_InvoiceRequest_supported_quantity"))) TS_InvoiceRequest_supported_quantity(uint64_t this_arg) {
54691         LDKInvoiceRequest this_arg_conv;
54692         this_arg_conv.inner = untag_ptr(this_arg);
54693         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54695         this_arg_conv.is_owned = false;
54696         LDKQuantity ret_var = InvoiceRequest_supported_quantity(&this_arg_conv);
54697         uint64_t ret_ref = 0;
54698         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54699         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54700         return ret_ref;
54701 }
54702
54703 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_signing_pubkey"))) TS_InvoiceRequest_signing_pubkey(uint64_t this_arg) {
54704         LDKInvoiceRequest this_arg_conv;
54705         this_arg_conv.inner = untag_ptr(this_arg);
54706         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54708         this_arg_conv.is_owned = false;
54709         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
54710         memcpy(ret_arr->elems, InvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form, 33);
54711         return ret_arr;
54712 }
54713
54714 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_payer_metadata"))) TS_InvoiceRequest_payer_metadata(uint64_t this_arg) {
54715         LDKInvoiceRequest this_arg_conv;
54716         this_arg_conv.inner = untag_ptr(this_arg);
54717         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54719         this_arg_conv.is_owned = false;
54720         LDKu8slice ret_var = InvoiceRequest_payer_metadata(&this_arg_conv);
54721         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54722         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54723         return ret_arr;
54724 }
54725
54726 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_chain"))) TS_InvoiceRequest_chain(uint64_t this_arg) {
54727         LDKInvoiceRequest this_arg_conv;
54728         this_arg_conv.inner = untag_ptr(this_arg);
54729         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54731         this_arg_conv.is_owned = false;
54732         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54733         memcpy(ret_arr->elems, InvoiceRequest_chain(&this_arg_conv).data, 32);
54734         return ret_arr;
54735 }
54736
54737 uint64_t  __attribute__((export_name("TS_InvoiceRequest_amount_msats"))) TS_InvoiceRequest_amount_msats(uint64_t this_arg) {
54738         LDKInvoiceRequest this_arg_conv;
54739         this_arg_conv.inner = untag_ptr(this_arg);
54740         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54742         this_arg_conv.is_owned = false;
54743         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
54744         *ret_copy = InvoiceRequest_amount_msats(&this_arg_conv);
54745         uint64_t ret_ref = tag_ptr(ret_copy, true);
54746         return ret_ref;
54747 }
54748
54749 uint64_t  __attribute__((export_name("TS_InvoiceRequest_invoice_request_features"))) TS_InvoiceRequest_invoice_request_features(uint64_t this_arg) {
54750         LDKInvoiceRequest this_arg_conv;
54751         this_arg_conv.inner = untag_ptr(this_arg);
54752         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54754         this_arg_conv.is_owned = false;
54755         LDKInvoiceRequestFeatures ret_var = InvoiceRequest_invoice_request_features(&this_arg_conv);
54756         uint64_t ret_ref = 0;
54757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54759         return ret_ref;
54760 }
54761
54762 uint64_t  __attribute__((export_name("TS_InvoiceRequest_quantity"))) TS_InvoiceRequest_quantity(uint64_t this_arg) {
54763         LDKInvoiceRequest this_arg_conv;
54764         this_arg_conv.inner = untag_ptr(this_arg);
54765         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54767         this_arg_conv.is_owned = false;
54768         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
54769         *ret_copy = InvoiceRequest_quantity(&this_arg_conv);
54770         uint64_t ret_ref = tag_ptr(ret_copy, true);
54771         return ret_ref;
54772 }
54773
54774 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_payer_id"))) TS_InvoiceRequest_payer_id(uint64_t this_arg) {
54775         LDKInvoiceRequest this_arg_conv;
54776         this_arg_conv.inner = untag_ptr(this_arg);
54777         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54779         this_arg_conv.is_owned = false;
54780         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
54781         memcpy(ret_arr->elems, InvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
54782         return ret_arr;
54783 }
54784
54785 uint64_t  __attribute__((export_name("TS_InvoiceRequest_payer_note"))) TS_InvoiceRequest_payer_note(uint64_t this_arg) {
54786         LDKInvoiceRequest this_arg_conv;
54787         this_arg_conv.inner = untag_ptr(this_arg);
54788         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54790         this_arg_conv.is_owned = false;
54791         LDKPrintableString ret_var = InvoiceRequest_payer_note(&this_arg_conv);
54792         uint64_t ret_ref = 0;
54793         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54794         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54795         return ret_ref;
54796 }
54797
54798 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_signature"))) TS_InvoiceRequest_signature(uint64_t this_arg) {
54799         LDKInvoiceRequest this_arg_conv;
54800         this_arg_conv.inner = untag_ptr(this_arg);
54801         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54803         this_arg_conv.is_owned = false;
54804         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
54805         memcpy(ret_arr->elems, InvoiceRequest_signature(&this_arg_conv).compact_form, 64);
54806         return ret_arr;
54807 }
54808
54809 uint64_t  __attribute__((export_name("TS_InvoiceRequest_verify"))) TS_InvoiceRequest_verify(uint64_t this_arg, uint64_t key) {
54810         LDKInvoiceRequest this_arg_conv;
54811         this_arg_conv.inner = untag_ptr(this_arg);
54812         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54814         this_arg_conv = InvoiceRequest_clone(&this_arg_conv);
54815         LDKExpandedKey key_conv;
54816         key_conv.inner = untag_ptr(key);
54817         key_conv.is_owned = ptr_is_owned(key);
54818         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
54819         key_conv.is_owned = false;
54820         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
54821         *ret_conv = InvoiceRequest_verify(this_arg_conv, &key_conv);
54822         return tag_ptr(ret_conv, true);
54823 }
54824
54825 ptrArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_chains"))) TS_VerifiedInvoiceRequest_chains(uint64_t this_arg) {
54826         LDKVerifiedInvoiceRequest this_arg_conv;
54827         this_arg_conv.inner = untag_ptr(this_arg);
54828         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54830         this_arg_conv.is_owned = false;
54831         LDKCVec_ThirtyTwoBytesZ ret_var = VerifiedInvoiceRequest_chains(&this_arg_conv);
54832         ptrArray ret_arr = NULL;
54833         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
54834         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
54835         for (size_t m = 0; m < ret_var.datalen; m++) {
54836                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
54837                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
54838                 ret_arr_ptr[m] = ret_conv_12_arr;
54839         }
54840         
54841         FREE(ret_var.data);
54842         return ret_arr;
54843 }
54844
54845 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_metadata"))) TS_VerifiedInvoiceRequest_metadata(uint64_t this_arg) {
54846         LDKVerifiedInvoiceRequest this_arg_conv;
54847         this_arg_conv.inner = untag_ptr(this_arg);
54848         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54850         this_arg_conv.is_owned = false;
54851         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
54852         *ret_copy = VerifiedInvoiceRequest_metadata(&this_arg_conv);
54853         uint64_t ret_ref = tag_ptr(ret_copy, true);
54854         return ret_ref;
54855 }
54856
54857 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_amount"))) TS_VerifiedInvoiceRequest_amount(uint64_t this_arg) {
54858         LDKVerifiedInvoiceRequest this_arg_conv;
54859         this_arg_conv.inner = untag_ptr(this_arg);
54860         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54862         this_arg_conv.is_owned = false;
54863         LDKAmount ret_var = VerifiedInvoiceRequest_amount(&this_arg_conv);
54864         uint64_t ret_ref = 0;
54865         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54866         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54867         return ret_ref;
54868 }
54869
54870 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_description"))) TS_VerifiedInvoiceRequest_description(uint64_t this_arg) {
54871         LDKVerifiedInvoiceRequest this_arg_conv;
54872         this_arg_conv.inner = untag_ptr(this_arg);
54873         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54875         this_arg_conv.is_owned = false;
54876         LDKPrintableString ret_var = VerifiedInvoiceRequest_description(&this_arg_conv);
54877         uint64_t ret_ref = 0;
54878         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54879         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54880         return ret_ref;
54881 }
54882
54883 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_offer_features"))) TS_VerifiedInvoiceRequest_offer_features(uint64_t this_arg) {
54884         LDKVerifiedInvoiceRequest this_arg_conv;
54885         this_arg_conv.inner = untag_ptr(this_arg);
54886         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54888         this_arg_conv.is_owned = false;
54889         LDKOfferFeatures ret_var = VerifiedInvoiceRequest_offer_features(&this_arg_conv);
54890         uint64_t ret_ref = 0;
54891         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54892         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54893         return ret_ref;
54894 }
54895
54896 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_absolute_expiry"))) TS_VerifiedInvoiceRequest_absolute_expiry(uint64_t this_arg) {
54897         LDKVerifiedInvoiceRequest this_arg_conv;
54898         this_arg_conv.inner = untag_ptr(this_arg);
54899         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54901         this_arg_conv.is_owned = false;
54902         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
54903         *ret_copy = VerifiedInvoiceRequest_absolute_expiry(&this_arg_conv);
54904         uint64_t ret_ref = tag_ptr(ret_copy, true);
54905         return ret_ref;
54906 }
54907
54908 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_issuer"))) TS_VerifiedInvoiceRequest_issuer(uint64_t this_arg) {
54909         LDKVerifiedInvoiceRequest this_arg_conv;
54910         this_arg_conv.inner = untag_ptr(this_arg);
54911         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54913         this_arg_conv.is_owned = false;
54914         LDKPrintableString ret_var = VerifiedInvoiceRequest_issuer(&this_arg_conv);
54915         uint64_t ret_ref = 0;
54916         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54917         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54918         return ret_ref;
54919 }
54920
54921 uint64_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_paths"))) TS_VerifiedInvoiceRequest_paths(uint64_t this_arg) {
54922         LDKVerifiedInvoiceRequest this_arg_conv;
54923         this_arg_conv.inner = untag_ptr(this_arg);
54924         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54926         this_arg_conv.is_owned = false;
54927         LDKCVec_BlindedPathZ ret_var = VerifiedInvoiceRequest_paths(&this_arg_conv);
54928         uint64_tArray ret_arr = NULL;
54929         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
54930         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
54931         for (size_t n = 0; n < ret_var.datalen; n++) {
54932                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
54933                 uint64_t ret_conv_13_ref = 0;
54934                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
54935                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
54936                 ret_arr_ptr[n] = ret_conv_13_ref;
54937         }
54938         
54939         FREE(ret_var.data);
54940         return ret_arr;
54941 }
54942
54943 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_supported_quantity"))) TS_VerifiedInvoiceRequest_supported_quantity(uint64_t this_arg) {
54944         LDKVerifiedInvoiceRequest this_arg_conv;
54945         this_arg_conv.inner = untag_ptr(this_arg);
54946         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54948         this_arg_conv.is_owned = false;
54949         LDKQuantity ret_var = VerifiedInvoiceRequest_supported_quantity(&this_arg_conv);
54950         uint64_t ret_ref = 0;
54951         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54952         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54953         return ret_ref;
54954 }
54955
54956 int8_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_signing_pubkey"))) TS_VerifiedInvoiceRequest_signing_pubkey(uint64_t this_arg) {
54957         LDKVerifiedInvoiceRequest this_arg_conv;
54958         this_arg_conv.inner = untag_ptr(this_arg);
54959         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54961         this_arg_conv.is_owned = false;
54962         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
54963         memcpy(ret_arr->elems, VerifiedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form, 33);
54964         return ret_arr;
54965 }
54966
54967 int8_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_payer_metadata"))) TS_VerifiedInvoiceRequest_payer_metadata(uint64_t this_arg) {
54968         LDKVerifiedInvoiceRequest this_arg_conv;
54969         this_arg_conv.inner = untag_ptr(this_arg);
54970         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54972         this_arg_conv.is_owned = false;
54973         LDKu8slice ret_var = VerifiedInvoiceRequest_payer_metadata(&this_arg_conv);
54974         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54975         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54976         return ret_arr;
54977 }
54978
54979 int8_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_chain"))) TS_VerifiedInvoiceRequest_chain(uint64_t this_arg) {
54980         LDKVerifiedInvoiceRequest this_arg_conv;
54981         this_arg_conv.inner = untag_ptr(this_arg);
54982         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54984         this_arg_conv.is_owned = false;
54985         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54986         memcpy(ret_arr->elems, VerifiedInvoiceRequest_chain(&this_arg_conv).data, 32);
54987         return ret_arr;
54988 }
54989
54990 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_amount_msats"))) TS_VerifiedInvoiceRequest_amount_msats(uint64_t this_arg) {
54991         LDKVerifiedInvoiceRequest this_arg_conv;
54992         this_arg_conv.inner = untag_ptr(this_arg);
54993         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54995         this_arg_conv.is_owned = false;
54996         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
54997         *ret_copy = VerifiedInvoiceRequest_amount_msats(&this_arg_conv);
54998         uint64_t ret_ref = tag_ptr(ret_copy, true);
54999         return ret_ref;
55000 }
55001
55002 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_invoice_request_features"))) TS_VerifiedInvoiceRequest_invoice_request_features(uint64_t this_arg) {
55003         LDKVerifiedInvoiceRequest this_arg_conv;
55004         this_arg_conv.inner = untag_ptr(this_arg);
55005         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55007         this_arg_conv.is_owned = false;
55008         LDKInvoiceRequestFeatures ret_var = VerifiedInvoiceRequest_invoice_request_features(&this_arg_conv);
55009         uint64_t ret_ref = 0;
55010         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55011         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55012         return ret_ref;
55013 }
55014
55015 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_quantity"))) TS_VerifiedInvoiceRequest_quantity(uint64_t this_arg) {
55016         LDKVerifiedInvoiceRequest this_arg_conv;
55017         this_arg_conv.inner = untag_ptr(this_arg);
55018         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55020         this_arg_conv.is_owned = false;
55021         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
55022         *ret_copy = VerifiedInvoiceRequest_quantity(&this_arg_conv);
55023         uint64_t ret_ref = tag_ptr(ret_copy, true);
55024         return ret_ref;
55025 }
55026
55027 int8_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_payer_id"))) TS_VerifiedInvoiceRequest_payer_id(uint64_t this_arg) {
55028         LDKVerifiedInvoiceRequest this_arg_conv;
55029         this_arg_conv.inner = untag_ptr(this_arg);
55030         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55032         this_arg_conv.is_owned = false;
55033         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
55034         memcpy(ret_arr->elems, VerifiedInvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
55035         return ret_arr;
55036 }
55037
55038 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_payer_note"))) TS_VerifiedInvoiceRequest_payer_note(uint64_t this_arg) {
55039         LDKVerifiedInvoiceRequest this_arg_conv;
55040         this_arg_conv.inner = untag_ptr(this_arg);
55041         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55043         this_arg_conv.is_owned = false;
55044         LDKPrintableString ret_var = VerifiedInvoiceRequest_payer_note(&this_arg_conv);
55045         uint64_t ret_ref = 0;
55046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55048         return ret_ref;
55049 }
55050
55051 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_write"))) TS_UnsignedInvoiceRequest_write(uint64_t obj) {
55052         LDKUnsignedInvoiceRequest obj_conv;
55053         obj_conv.inner = untag_ptr(obj);
55054         obj_conv.is_owned = ptr_is_owned(obj);
55055         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55056         obj_conv.is_owned = false;
55057         LDKCVec_u8Z ret_var = UnsignedInvoiceRequest_write(&obj_conv);
55058         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55059         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55060         CVec_u8Z_free(ret_var);
55061         return ret_arr;
55062 }
55063
55064 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_write"))) TS_InvoiceRequest_write(uint64_t obj) {
55065         LDKInvoiceRequest obj_conv;
55066         obj_conv.inner = untag_ptr(obj);
55067         obj_conv.is_owned = ptr_is_owned(obj);
55068         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55069         obj_conv.is_owned = false;
55070         LDKCVec_u8Z ret_var = InvoiceRequest_write(&obj_conv);
55071         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55072         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55073         CVec_u8Z_free(ret_var);
55074         return ret_arr;
55075 }
55076
55077 void  __attribute__((export_name("TS_TaggedHash_free"))) TS_TaggedHash_free(uint64_t this_obj) {
55078         LDKTaggedHash this_obj_conv;
55079         this_obj_conv.inner = untag_ptr(this_obj);
55080         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55082         TaggedHash_free(this_obj_conv);
55083 }
55084
55085 void  __attribute__((export_name("TS_Bolt12ParseError_free"))) TS_Bolt12ParseError_free(uint64_t this_obj) {
55086         LDKBolt12ParseError this_obj_conv;
55087         this_obj_conv.inner = untag_ptr(this_obj);
55088         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55090         Bolt12ParseError_free(this_obj_conv);
55091 }
55092
55093 static inline uint64_t Bolt12ParseError_clone_ptr(LDKBolt12ParseError *NONNULL_PTR arg) {
55094         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(arg);
55095         uint64_t ret_ref = 0;
55096         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55097         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55098         return ret_ref;
55099 }
55100 int64_t  __attribute__((export_name("TS_Bolt12ParseError_clone_ptr"))) TS_Bolt12ParseError_clone_ptr(uint64_t arg) {
55101         LDKBolt12ParseError arg_conv;
55102         arg_conv.inner = untag_ptr(arg);
55103         arg_conv.is_owned = ptr_is_owned(arg);
55104         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55105         arg_conv.is_owned = false;
55106         int64_t ret_conv = Bolt12ParseError_clone_ptr(&arg_conv);
55107         return ret_conv;
55108 }
55109
55110 uint64_t  __attribute__((export_name("TS_Bolt12ParseError_clone"))) TS_Bolt12ParseError_clone(uint64_t orig) {
55111         LDKBolt12ParseError orig_conv;
55112         orig_conv.inner = untag_ptr(orig);
55113         orig_conv.is_owned = ptr_is_owned(orig);
55114         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55115         orig_conv.is_owned = false;
55116         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(&orig_conv);
55117         uint64_t ret_ref = 0;
55118         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55119         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55120         return ret_ref;
55121 }
55122
55123 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_clone"))) TS_Bolt12SemanticError_clone(uint64_t orig) {
55124         LDKBolt12SemanticError* orig_conv = (LDKBolt12SemanticError*)untag_ptr(orig);
55125         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_clone(orig_conv));
55126         return ret_conv;
55127 }
55128
55129 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_already_expired"))) TS_Bolt12SemanticError_already_expired() {
55130         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_already_expired());
55131         return ret_conv;
55132 }
55133
55134 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unsupported_chain"))) TS_Bolt12SemanticError_unsupported_chain() {
55135         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unsupported_chain());
55136         return ret_conv;
55137 }
55138
55139 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_chain"))) TS_Bolt12SemanticError_unexpected_chain() {
55140         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_chain());
55141         return ret_conv;
55142 }
55143
55144 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_amount"))) TS_Bolt12SemanticError_missing_amount() {
55145         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_amount());
55146         return ret_conv;
55147 }
55148
55149 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_amount"))) TS_Bolt12SemanticError_invalid_amount() {
55150         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_amount());
55151         return ret_conv;
55152 }
55153
55154 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_insufficient_amount"))) TS_Bolt12SemanticError_insufficient_amount() {
55155         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_insufficient_amount());
55156         return ret_conv;
55157 }
55158
55159 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_amount"))) TS_Bolt12SemanticError_unexpected_amount() {
55160         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_amount());
55161         return ret_conv;
55162 }
55163
55164 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unsupported_currency"))) TS_Bolt12SemanticError_unsupported_currency() {
55165         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unsupported_currency());
55166         return ret_conv;
55167 }
55168
55169 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unknown_required_features"))) TS_Bolt12SemanticError_unknown_required_features() {
55170         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unknown_required_features());
55171         return ret_conv;
55172 }
55173
55174 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_features"))) TS_Bolt12SemanticError_unexpected_features() {
55175         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_features());
55176         return ret_conv;
55177 }
55178
55179 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_description"))) TS_Bolt12SemanticError_missing_description() {
55180         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_description());
55181         return ret_conv;
55182 }
55183
55184 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_signing_pubkey"))) TS_Bolt12SemanticError_missing_signing_pubkey() {
55185         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_signing_pubkey());
55186         return ret_conv;
55187 }
55188
55189 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_signing_pubkey"))) TS_Bolt12SemanticError_invalid_signing_pubkey() {
55190         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_signing_pubkey());
55191         return ret_conv;
55192 }
55193
55194 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_signing_pubkey"))) TS_Bolt12SemanticError_unexpected_signing_pubkey() {
55195         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_signing_pubkey());
55196         return ret_conv;
55197 }
55198
55199 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_quantity"))) TS_Bolt12SemanticError_missing_quantity() {
55200         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_quantity());
55201         return ret_conv;
55202 }
55203
55204 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_quantity"))) TS_Bolt12SemanticError_invalid_quantity() {
55205         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_quantity());
55206         return ret_conv;
55207 }
55208
55209 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_quantity"))) TS_Bolt12SemanticError_unexpected_quantity() {
55210         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_quantity());
55211         return ret_conv;
55212 }
55213
55214 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_metadata"))) TS_Bolt12SemanticError_invalid_metadata() {
55215         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_metadata());
55216         return ret_conv;
55217 }
55218
55219 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_metadata"))) TS_Bolt12SemanticError_unexpected_metadata() {
55220         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_metadata());
55221         return ret_conv;
55222 }
55223
55224 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_payer_metadata"))) TS_Bolt12SemanticError_missing_payer_metadata() {
55225         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_payer_metadata());
55226         return ret_conv;
55227 }
55228
55229 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_payer_id"))) TS_Bolt12SemanticError_missing_payer_id() {
55230         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_payer_id());
55231         return ret_conv;
55232 }
55233
55234 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_paths"))) TS_Bolt12SemanticError_missing_paths() {
55235         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_paths());
55236         return ret_conv;
55237 }
55238
55239 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_pay_info"))) TS_Bolt12SemanticError_invalid_pay_info() {
55240         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_pay_info());
55241         return ret_conv;
55242 }
55243
55244 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_creation_time"))) TS_Bolt12SemanticError_missing_creation_time() {
55245         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_creation_time());
55246         return ret_conv;
55247 }
55248
55249 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_payment_hash"))) TS_Bolt12SemanticError_missing_payment_hash() {
55250         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_payment_hash());
55251         return ret_conv;
55252 }
55253
55254 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_signature"))) TS_Bolt12SemanticError_missing_signature() {
55255         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_signature());
55256         return ret_conv;
55257 }
55258
55259 void  __attribute__((export_name("TS_Refund_free"))) TS_Refund_free(uint64_t this_obj) {
55260         LDKRefund this_obj_conv;
55261         this_obj_conv.inner = untag_ptr(this_obj);
55262         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55264         Refund_free(this_obj_conv);
55265 }
55266
55267 static inline uint64_t Refund_clone_ptr(LDKRefund *NONNULL_PTR arg) {
55268         LDKRefund ret_var = Refund_clone(arg);
55269         uint64_t ret_ref = 0;
55270         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55271         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55272         return ret_ref;
55273 }
55274 int64_t  __attribute__((export_name("TS_Refund_clone_ptr"))) TS_Refund_clone_ptr(uint64_t arg) {
55275         LDKRefund arg_conv;
55276         arg_conv.inner = untag_ptr(arg);
55277         arg_conv.is_owned = ptr_is_owned(arg);
55278         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55279         arg_conv.is_owned = false;
55280         int64_t ret_conv = Refund_clone_ptr(&arg_conv);
55281         return ret_conv;
55282 }
55283
55284 uint64_t  __attribute__((export_name("TS_Refund_clone"))) TS_Refund_clone(uint64_t orig) {
55285         LDKRefund orig_conv;
55286         orig_conv.inner = untag_ptr(orig);
55287         orig_conv.is_owned = ptr_is_owned(orig);
55288         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55289         orig_conv.is_owned = false;
55290         LDKRefund ret_var = Refund_clone(&orig_conv);
55291         uint64_t ret_ref = 0;
55292         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55293         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55294         return ret_ref;
55295 }
55296
55297 uint64_t  __attribute__((export_name("TS_Refund_description"))) TS_Refund_description(uint64_t this_arg) {
55298         LDKRefund this_arg_conv;
55299         this_arg_conv.inner = untag_ptr(this_arg);
55300         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55302         this_arg_conv.is_owned = false;
55303         LDKPrintableString ret_var = Refund_description(&this_arg_conv);
55304         uint64_t ret_ref = 0;
55305         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55306         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55307         return ret_ref;
55308 }
55309
55310 uint64_t  __attribute__((export_name("TS_Refund_absolute_expiry"))) TS_Refund_absolute_expiry(uint64_t this_arg) {
55311         LDKRefund this_arg_conv;
55312         this_arg_conv.inner = untag_ptr(this_arg);
55313         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55315         this_arg_conv.is_owned = false;
55316         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
55317         *ret_copy = Refund_absolute_expiry(&this_arg_conv);
55318         uint64_t ret_ref = tag_ptr(ret_copy, true);
55319         return ret_ref;
55320 }
55321
55322 uint64_t  __attribute__((export_name("TS_Refund_issuer"))) TS_Refund_issuer(uint64_t this_arg) {
55323         LDKRefund this_arg_conv;
55324         this_arg_conv.inner = untag_ptr(this_arg);
55325         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55327         this_arg_conv.is_owned = false;
55328         LDKPrintableString ret_var = Refund_issuer(&this_arg_conv);
55329         uint64_t ret_ref = 0;
55330         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55331         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55332         return ret_ref;
55333 }
55334
55335 uint64_tArray  __attribute__((export_name("TS_Refund_paths"))) TS_Refund_paths(uint64_t this_arg) {
55336         LDKRefund this_arg_conv;
55337         this_arg_conv.inner = untag_ptr(this_arg);
55338         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55340         this_arg_conv.is_owned = false;
55341         LDKCVec_BlindedPathZ ret_var = Refund_paths(&this_arg_conv);
55342         uint64_tArray ret_arr = NULL;
55343         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
55344         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
55345         for (size_t n = 0; n < ret_var.datalen; n++) {
55346                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
55347                 uint64_t ret_conv_13_ref = 0;
55348                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
55349                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
55350                 ret_arr_ptr[n] = ret_conv_13_ref;
55351         }
55352         
55353         FREE(ret_var.data);
55354         return ret_arr;
55355 }
55356
55357 int8_tArray  __attribute__((export_name("TS_Refund_payer_metadata"))) TS_Refund_payer_metadata(uint64_t this_arg) {
55358         LDKRefund this_arg_conv;
55359         this_arg_conv.inner = untag_ptr(this_arg);
55360         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55362         this_arg_conv.is_owned = false;
55363         LDKu8slice ret_var = Refund_payer_metadata(&this_arg_conv);
55364         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55365         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55366         return ret_arr;
55367 }
55368
55369 int8_tArray  __attribute__((export_name("TS_Refund_chain"))) TS_Refund_chain(uint64_t this_arg) {
55370         LDKRefund this_arg_conv;
55371         this_arg_conv.inner = untag_ptr(this_arg);
55372         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55374         this_arg_conv.is_owned = false;
55375         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
55376         memcpy(ret_arr->elems, Refund_chain(&this_arg_conv).data, 32);
55377         return ret_arr;
55378 }
55379
55380 int64_t  __attribute__((export_name("TS_Refund_amount_msats"))) TS_Refund_amount_msats(uint64_t this_arg) {
55381         LDKRefund this_arg_conv;
55382         this_arg_conv.inner = untag_ptr(this_arg);
55383         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55385         this_arg_conv.is_owned = false;
55386         int64_t ret_conv = Refund_amount_msats(&this_arg_conv);
55387         return ret_conv;
55388 }
55389
55390 uint64_t  __attribute__((export_name("TS_Refund_features"))) TS_Refund_features(uint64_t this_arg) {
55391         LDKRefund this_arg_conv;
55392         this_arg_conv.inner = untag_ptr(this_arg);
55393         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55395         this_arg_conv.is_owned = false;
55396         LDKInvoiceRequestFeatures ret_var = Refund_features(&this_arg_conv);
55397         uint64_t ret_ref = 0;
55398         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55399         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55400         return ret_ref;
55401 }
55402
55403 uint64_t  __attribute__((export_name("TS_Refund_quantity"))) TS_Refund_quantity(uint64_t this_arg) {
55404         LDKRefund this_arg_conv;
55405         this_arg_conv.inner = untag_ptr(this_arg);
55406         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55408         this_arg_conv.is_owned = false;
55409         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
55410         *ret_copy = Refund_quantity(&this_arg_conv);
55411         uint64_t ret_ref = tag_ptr(ret_copy, true);
55412         return ret_ref;
55413 }
55414
55415 int8_tArray  __attribute__((export_name("TS_Refund_payer_id"))) TS_Refund_payer_id(uint64_t this_arg) {
55416         LDKRefund this_arg_conv;
55417         this_arg_conv.inner = untag_ptr(this_arg);
55418         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55420         this_arg_conv.is_owned = false;
55421         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
55422         memcpy(ret_arr->elems, Refund_payer_id(&this_arg_conv).compressed_form, 33);
55423         return ret_arr;
55424 }
55425
55426 uint64_t  __attribute__((export_name("TS_Refund_payer_note"))) TS_Refund_payer_note(uint64_t this_arg) {
55427         LDKRefund this_arg_conv;
55428         this_arg_conv.inner = untag_ptr(this_arg);
55429         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55431         this_arg_conv.is_owned = false;
55432         LDKPrintableString ret_var = Refund_payer_note(&this_arg_conv);
55433         uint64_t ret_ref = 0;
55434         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55435         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55436         return ret_ref;
55437 }
55438
55439 int8_tArray  __attribute__((export_name("TS_Refund_write"))) TS_Refund_write(uint64_t obj) {
55440         LDKRefund obj_conv;
55441         obj_conv.inner = untag_ptr(obj);
55442         obj_conv.is_owned = ptr_is_owned(obj);
55443         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55444         obj_conv.is_owned = false;
55445         LDKCVec_u8Z ret_var = Refund_write(&obj_conv);
55446         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55447         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55448         CVec_u8Z_free(ret_var);
55449         return ret_arr;
55450 }
55451
55452 uint64_t  __attribute__((export_name("TS_Refund_from_str"))) TS_Refund_from_str(jstring s) {
55453         LDKStr s_conv = str_ref_to_owned_c(s);
55454         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
55455         *ret_conv = Refund_from_str(s_conv);
55456         return tag_ptr(ret_conv, true);
55457 }
55458
55459 uint32_t  __attribute__((export_name("TS_UtxoLookupError_clone"))) TS_UtxoLookupError_clone(uint64_t orig) {
55460         LDKUtxoLookupError* orig_conv = (LDKUtxoLookupError*)untag_ptr(orig);
55461         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_clone(orig_conv));
55462         return ret_conv;
55463 }
55464
55465 uint32_t  __attribute__((export_name("TS_UtxoLookupError_unknown_chain"))) TS_UtxoLookupError_unknown_chain() {
55466         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_unknown_chain());
55467         return ret_conv;
55468 }
55469
55470 uint32_t  __attribute__((export_name("TS_UtxoLookupError_unknown_tx"))) TS_UtxoLookupError_unknown_tx() {
55471         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_unknown_tx());
55472         return ret_conv;
55473 }
55474
55475 void  __attribute__((export_name("TS_UtxoResult_free"))) TS_UtxoResult_free(uint64_t this_ptr) {
55476         if (!ptr_is_owned(this_ptr)) return;
55477         void* this_ptr_ptr = untag_ptr(this_ptr);
55478         CHECK_ACCESS(this_ptr_ptr);
55479         LDKUtxoResult this_ptr_conv = *(LDKUtxoResult*)(this_ptr_ptr);
55480         FREE(untag_ptr(this_ptr));
55481         UtxoResult_free(this_ptr_conv);
55482 }
55483
55484 static inline uint64_t UtxoResult_clone_ptr(LDKUtxoResult *NONNULL_PTR arg) {
55485         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
55486         *ret_copy = UtxoResult_clone(arg);
55487         uint64_t ret_ref = tag_ptr(ret_copy, true);
55488         return ret_ref;
55489 }
55490 int64_t  __attribute__((export_name("TS_UtxoResult_clone_ptr"))) TS_UtxoResult_clone_ptr(uint64_t arg) {
55491         LDKUtxoResult* arg_conv = (LDKUtxoResult*)untag_ptr(arg);
55492         int64_t ret_conv = UtxoResult_clone_ptr(arg_conv);
55493         return ret_conv;
55494 }
55495
55496 uint64_t  __attribute__((export_name("TS_UtxoResult_clone"))) TS_UtxoResult_clone(uint64_t orig) {
55497         LDKUtxoResult* orig_conv = (LDKUtxoResult*)untag_ptr(orig);
55498         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
55499         *ret_copy = UtxoResult_clone(orig_conv);
55500         uint64_t ret_ref = tag_ptr(ret_copy, true);
55501         return ret_ref;
55502 }
55503
55504 uint64_t  __attribute__((export_name("TS_UtxoResult_sync"))) TS_UtxoResult_sync(uint64_t a) {
55505         void* a_ptr = untag_ptr(a);
55506         CHECK_ACCESS(a_ptr);
55507         LDKCResult_TxOutUtxoLookupErrorZ a_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(a_ptr);
55508         a_conv = CResult_TxOutUtxoLookupErrorZ_clone((LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(a));
55509         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
55510         *ret_copy = UtxoResult_sync(a_conv);
55511         uint64_t ret_ref = tag_ptr(ret_copy, true);
55512         return ret_ref;
55513 }
55514
55515 uint64_t  __attribute__((export_name("TS_UtxoResult_async"))) TS_UtxoResult_async(uint64_t a) {
55516         LDKUtxoFuture a_conv;
55517         a_conv.inner = untag_ptr(a);
55518         a_conv.is_owned = ptr_is_owned(a);
55519         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55520         a_conv = UtxoFuture_clone(&a_conv);
55521         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
55522         *ret_copy = UtxoResult_async(a_conv);
55523         uint64_t ret_ref = tag_ptr(ret_copy, true);
55524         return ret_ref;
55525 }
55526
55527 void  __attribute__((export_name("TS_UtxoLookup_free"))) TS_UtxoLookup_free(uint64_t this_ptr) {
55528         if (!ptr_is_owned(this_ptr)) return;
55529         void* this_ptr_ptr = untag_ptr(this_ptr);
55530         CHECK_ACCESS(this_ptr_ptr);
55531         LDKUtxoLookup this_ptr_conv = *(LDKUtxoLookup*)(this_ptr_ptr);
55532         FREE(untag_ptr(this_ptr));
55533         UtxoLookup_free(this_ptr_conv);
55534 }
55535
55536 void  __attribute__((export_name("TS_UtxoFuture_free"))) TS_UtxoFuture_free(uint64_t this_obj) {
55537         LDKUtxoFuture this_obj_conv;
55538         this_obj_conv.inner = untag_ptr(this_obj);
55539         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55541         UtxoFuture_free(this_obj_conv);
55542 }
55543
55544 static inline uint64_t UtxoFuture_clone_ptr(LDKUtxoFuture *NONNULL_PTR arg) {
55545         LDKUtxoFuture ret_var = UtxoFuture_clone(arg);
55546         uint64_t ret_ref = 0;
55547         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55548         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55549         return ret_ref;
55550 }
55551 int64_t  __attribute__((export_name("TS_UtxoFuture_clone_ptr"))) TS_UtxoFuture_clone_ptr(uint64_t arg) {
55552         LDKUtxoFuture arg_conv;
55553         arg_conv.inner = untag_ptr(arg);
55554         arg_conv.is_owned = ptr_is_owned(arg);
55555         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55556         arg_conv.is_owned = false;
55557         int64_t ret_conv = UtxoFuture_clone_ptr(&arg_conv);
55558         return ret_conv;
55559 }
55560
55561 uint64_t  __attribute__((export_name("TS_UtxoFuture_clone"))) TS_UtxoFuture_clone(uint64_t orig) {
55562         LDKUtxoFuture orig_conv;
55563         orig_conv.inner = untag_ptr(orig);
55564         orig_conv.is_owned = ptr_is_owned(orig);
55565         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55566         orig_conv.is_owned = false;
55567         LDKUtxoFuture ret_var = UtxoFuture_clone(&orig_conv);
55568         uint64_t ret_ref = 0;
55569         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55570         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55571         return ret_ref;
55572 }
55573
55574 uint64_t  __attribute__((export_name("TS_UtxoFuture_new"))) TS_UtxoFuture_new() {
55575         LDKUtxoFuture ret_var = UtxoFuture_new();
55576         uint64_t ret_ref = 0;
55577         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55578         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55579         return ret_ref;
55580 }
55581
55582 void  __attribute__((export_name("TS_UtxoFuture_resolve_without_forwarding"))) TS_UtxoFuture_resolve_without_forwarding(uint64_t this_arg, uint64_t graph, uint64_t result) {
55583         LDKUtxoFuture this_arg_conv;
55584         this_arg_conv.inner = untag_ptr(this_arg);
55585         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55587         this_arg_conv.is_owned = false;
55588         LDKNetworkGraph graph_conv;
55589         graph_conv.inner = untag_ptr(graph);
55590         graph_conv.is_owned = ptr_is_owned(graph);
55591         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
55592         graph_conv.is_owned = false;
55593         void* result_ptr = untag_ptr(result);
55594         CHECK_ACCESS(result_ptr);
55595         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
55596         UtxoFuture_resolve_without_forwarding(&this_arg_conv, &graph_conv, result_conv);
55597 }
55598
55599 void  __attribute__((export_name("TS_UtxoFuture_resolve"))) TS_UtxoFuture_resolve(uint64_t this_arg, uint64_t graph, uint64_t gossip, uint64_t result) {
55600         LDKUtxoFuture this_arg_conv;
55601         this_arg_conv.inner = untag_ptr(this_arg);
55602         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55604         this_arg_conv.is_owned = false;
55605         LDKNetworkGraph graph_conv;
55606         graph_conv.inner = untag_ptr(graph);
55607         graph_conv.is_owned = ptr_is_owned(graph);
55608         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
55609         graph_conv.is_owned = false;
55610         LDKP2PGossipSync gossip_conv;
55611         gossip_conv.inner = untag_ptr(gossip);
55612         gossip_conv.is_owned = ptr_is_owned(gossip);
55613         CHECK_INNER_FIELD_ACCESS_OR_NULL(gossip_conv);
55614         gossip_conv.is_owned = false;
55615         void* result_ptr = untag_ptr(result);
55616         CHECK_ACCESS(result_ptr);
55617         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
55618         UtxoFuture_resolve(&this_arg_conv, &graph_conv, &gossip_conv, result_conv);
55619 }
55620
55621 void  __attribute__((export_name("TS_NodeId_free"))) TS_NodeId_free(uint64_t this_obj) {
55622         LDKNodeId this_obj_conv;
55623         this_obj_conv.inner = untag_ptr(this_obj);
55624         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55626         NodeId_free(this_obj_conv);
55627 }
55628
55629 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
55630         LDKNodeId ret_var = NodeId_clone(arg);
55631         uint64_t ret_ref = 0;
55632         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55633         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55634         return ret_ref;
55635 }
55636 int64_t  __attribute__((export_name("TS_NodeId_clone_ptr"))) TS_NodeId_clone_ptr(uint64_t arg) {
55637         LDKNodeId arg_conv;
55638         arg_conv.inner = untag_ptr(arg);
55639         arg_conv.is_owned = ptr_is_owned(arg);
55640         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55641         arg_conv.is_owned = false;
55642         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
55643         return ret_conv;
55644 }
55645
55646 uint64_t  __attribute__((export_name("TS_NodeId_clone"))) TS_NodeId_clone(uint64_t orig) {
55647         LDKNodeId orig_conv;
55648         orig_conv.inner = untag_ptr(orig);
55649         orig_conv.is_owned = ptr_is_owned(orig);
55650         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55651         orig_conv.is_owned = false;
55652         LDKNodeId ret_var = NodeId_clone(&orig_conv);
55653         uint64_t ret_ref = 0;
55654         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55655         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55656         return ret_ref;
55657 }
55658
55659 uint64_t  __attribute__((export_name("TS_NodeId_from_pubkey"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
55660         LDKPublicKey pubkey_ref;
55661         CHECK(pubkey->arr_len == 33);
55662         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
55663         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
55664         uint64_t ret_ref = 0;
55665         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55666         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55667         return ret_ref;
55668 }
55669
55670 int8_tArray  __attribute__((export_name("TS_NodeId_as_slice"))) TS_NodeId_as_slice(uint64_t this_arg) {
55671         LDKNodeId this_arg_conv;
55672         this_arg_conv.inner = untag_ptr(this_arg);
55673         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55675         this_arg_conv.is_owned = false;
55676         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
55677         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55678         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55679         return ret_arr;
55680 }
55681
55682 uint64_t  __attribute__((export_name("TS_NodeId_as_pubkey"))) TS_NodeId_as_pubkey(uint64_t this_arg) {
55683         LDKNodeId this_arg_conv;
55684         this_arg_conv.inner = untag_ptr(this_arg);
55685         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55687         this_arg_conv.is_owned = false;
55688         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
55689         *ret_conv = NodeId_as_pubkey(&this_arg_conv);
55690         return tag_ptr(ret_conv, true);
55691 }
55692
55693 int64_t  __attribute__((export_name("TS_NodeId_hash"))) TS_NodeId_hash(uint64_t o) {
55694         LDKNodeId o_conv;
55695         o_conv.inner = untag_ptr(o);
55696         o_conv.is_owned = ptr_is_owned(o);
55697         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55698         o_conv.is_owned = false;
55699         int64_t ret_conv = NodeId_hash(&o_conv);
55700         return ret_conv;
55701 }
55702
55703 int8_tArray  __attribute__((export_name("TS_NodeId_write"))) TS_NodeId_write(uint64_t obj) {
55704         LDKNodeId obj_conv;
55705         obj_conv.inner = untag_ptr(obj);
55706         obj_conv.is_owned = ptr_is_owned(obj);
55707         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55708         obj_conv.is_owned = false;
55709         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
55710         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55711         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55712         CVec_u8Z_free(ret_var);
55713         return ret_arr;
55714 }
55715
55716 uint64_t  __attribute__((export_name("TS_NodeId_read"))) TS_NodeId_read(int8_tArray ser) {
55717         LDKu8slice ser_ref;
55718         ser_ref.datalen = ser->arr_len;
55719         ser_ref.data = ser->elems;
55720         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
55721         *ret_conv = NodeId_read(ser_ref);
55722         FREE(ser);
55723         return tag_ptr(ret_conv, true);
55724 }
55725
55726 void  __attribute__((export_name("TS_NetworkGraph_free"))) TS_NetworkGraph_free(uint64_t this_obj) {
55727         LDKNetworkGraph this_obj_conv;
55728         this_obj_conv.inner = untag_ptr(this_obj);
55729         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55731         NetworkGraph_free(this_obj_conv);
55732 }
55733
55734 void  __attribute__((export_name("TS_ReadOnlyNetworkGraph_free"))) TS_ReadOnlyNetworkGraph_free(uint64_t this_obj) {
55735         LDKReadOnlyNetworkGraph this_obj_conv;
55736         this_obj_conv.inner = untag_ptr(this_obj);
55737         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55739         ReadOnlyNetworkGraph_free(this_obj_conv);
55740 }
55741
55742 void  __attribute__((export_name("TS_NetworkUpdate_free"))) TS_NetworkUpdate_free(uint64_t this_ptr) {
55743         if (!ptr_is_owned(this_ptr)) return;
55744         void* this_ptr_ptr = untag_ptr(this_ptr);
55745         CHECK_ACCESS(this_ptr_ptr);
55746         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
55747         FREE(untag_ptr(this_ptr));
55748         NetworkUpdate_free(this_ptr_conv);
55749 }
55750
55751 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
55752         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
55753         *ret_copy = NetworkUpdate_clone(arg);
55754         uint64_t ret_ref = tag_ptr(ret_copy, true);
55755         return ret_ref;
55756 }
55757 int64_t  __attribute__((export_name("TS_NetworkUpdate_clone_ptr"))) TS_NetworkUpdate_clone_ptr(uint64_t arg) {
55758         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
55759         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
55760         return ret_conv;
55761 }
55762
55763 uint64_t  __attribute__((export_name("TS_NetworkUpdate_clone"))) TS_NetworkUpdate_clone(uint64_t orig) {
55764         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
55765         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
55766         *ret_copy = NetworkUpdate_clone(orig_conv);
55767         uint64_t ret_ref = tag_ptr(ret_copy, true);
55768         return ret_ref;
55769 }
55770
55771 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_update_message"))) TS_NetworkUpdate_channel_update_message(uint64_t msg) {
55772         LDKChannelUpdate msg_conv;
55773         msg_conv.inner = untag_ptr(msg);
55774         msg_conv.is_owned = ptr_is_owned(msg);
55775         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
55776         msg_conv = ChannelUpdate_clone(&msg_conv);
55777         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
55778         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
55779         uint64_t ret_ref = tag_ptr(ret_copy, true);
55780         return ret_ref;
55781 }
55782
55783 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_failure"))) TS_NetworkUpdate_channel_failure(int64_t short_channel_id, jboolean is_permanent) {
55784         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
55785         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
55786         uint64_t ret_ref = tag_ptr(ret_copy, true);
55787         return ret_ref;
55788 }
55789
55790 uint64_t  __attribute__((export_name("TS_NetworkUpdate_node_failure"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
55791         LDKPublicKey node_id_ref;
55792         CHECK(node_id->arr_len == 33);
55793         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
55794         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
55795         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
55796         uint64_t ret_ref = tag_ptr(ret_copy, true);
55797         return ret_ref;
55798 }
55799
55800 jboolean  __attribute__((export_name("TS_NetworkUpdate_eq"))) TS_NetworkUpdate_eq(uint64_t a, uint64_t b) {
55801         LDKNetworkUpdate* a_conv = (LDKNetworkUpdate*)untag_ptr(a);
55802         LDKNetworkUpdate* b_conv = (LDKNetworkUpdate*)untag_ptr(b);
55803         jboolean ret_conv = NetworkUpdate_eq(a_conv, b_conv);
55804         return ret_conv;
55805 }
55806
55807 int8_tArray  __attribute__((export_name("TS_NetworkUpdate_write"))) TS_NetworkUpdate_write(uint64_t obj) {
55808         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
55809         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
55810         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55811         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55812         CVec_u8Z_free(ret_var);
55813         return ret_arr;
55814 }
55815
55816 uint64_t  __attribute__((export_name("TS_NetworkUpdate_read"))) TS_NetworkUpdate_read(int8_tArray ser) {
55817         LDKu8slice ser_ref;
55818         ser_ref.datalen = ser->arr_len;
55819         ser_ref.data = ser->elems;
55820         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
55821         *ret_conv = NetworkUpdate_read(ser_ref);
55822         FREE(ser);
55823         return tag_ptr(ret_conv, true);
55824 }
55825
55826 void  __attribute__((export_name("TS_P2PGossipSync_free"))) TS_P2PGossipSync_free(uint64_t this_obj) {
55827         LDKP2PGossipSync this_obj_conv;
55828         this_obj_conv.inner = untag_ptr(this_obj);
55829         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55831         P2PGossipSync_free(this_obj_conv);
55832 }
55833
55834 uint64_t  __attribute__((export_name("TS_P2PGossipSync_new"))) TS_P2PGossipSync_new(uint64_t network_graph, uint64_t utxo_lookup, uint64_t logger) {
55835         LDKNetworkGraph network_graph_conv;
55836         network_graph_conv.inner = untag_ptr(network_graph);
55837         network_graph_conv.is_owned = ptr_is_owned(network_graph);
55838         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
55839         network_graph_conv.is_owned = false;
55840         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
55841         CHECK_ACCESS(utxo_lookup_ptr);
55842         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
55843         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
55844         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
55845                 // Manually implement clone for Java trait instances
55846                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
55847                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
55848                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
55849                 }
55850         }
55851         void* logger_ptr = untag_ptr(logger);
55852         CHECK_ACCESS(logger_ptr);
55853         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
55854         if (logger_conv.free == LDKLogger_JCalls_free) {
55855                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
55856                 LDKLogger_JCalls_cloned(&logger_conv);
55857         }
55858         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, utxo_lookup_conv, logger_conv);
55859         uint64_t ret_ref = 0;
55860         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55861         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55862         return ret_ref;
55863 }
55864
55865 void  __attribute__((export_name("TS_P2PGossipSync_add_utxo_lookup"))) TS_P2PGossipSync_add_utxo_lookup(uint64_t this_arg, uint64_t utxo_lookup) {
55866         LDKP2PGossipSync this_arg_conv;
55867         this_arg_conv.inner = untag_ptr(this_arg);
55868         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55870         this_arg_conv.is_owned = false;
55871         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
55872         CHECK_ACCESS(utxo_lookup_ptr);
55873         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
55874         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
55875         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
55876                 // Manually implement clone for Java trait instances
55877                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
55878                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
55879                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
55880                 }
55881         }
55882         P2PGossipSync_add_utxo_lookup(&this_arg_conv, utxo_lookup_conv);
55883 }
55884
55885 void  __attribute__((export_name("TS_NetworkGraph_handle_network_update"))) TS_NetworkGraph_handle_network_update(uint64_t this_arg, uint64_t network_update) {
55886         LDKNetworkGraph this_arg_conv;
55887         this_arg_conv.inner = untag_ptr(this_arg);
55888         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55890         this_arg_conv.is_owned = false;
55891         LDKNetworkUpdate* network_update_conv = (LDKNetworkUpdate*)untag_ptr(network_update);
55892         NetworkGraph_handle_network_update(&this_arg_conv, network_update_conv);
55893 }
55894
55895 int8_tArray  __attribute__((export_name("TS_NetworkGraph_get_genesis_hash"))) TS_NetworkGraph_get_genesis_hash(uint64_t this_arg) {
55896         LDKNetworkGraph this_arg_conv;
55897         this_arg_conv.inner = untag_ptr(this_arg);
55898         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55900         this_arg_conv.is_owned = false;
55901         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
55902         memcpy(ret_arr->elems, NetworkGraph_get_genesis_hash(&this_arg_conv).data, 32);
55903         return ret_arr;
55904 }
55905
55906 uint64_t  __attribute__((export_name("TS_verify_node_announcement"))) TS_verify_node_announcement(uint64_t msg) {
55907         LDKNodeAnnouncement msg_conv;
55908         msg_conv.inner = untag_ptr(msg);
55909         msg_conv.is_owned = ptr_is_owned(msg);
55910         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
55911         msg_conv.is_owned = false;
55912         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
55913         *ret_conv = verify_node_announcement(&msg_conv);
55914         return tag_ptr(ret_conv, true);
55915 }
55916
55917 uint64_t  __attribute__((export_name("TS_verify_channel_announcement"))) TS_verify_channel_announcement(uint64_t msg) {
55918         LDKChannelAnnouncement msg_conv;
55919         msg_conv.inner = untag_ptr(msg);
55920         msg_conv.is_owned = ptr_is_owned(msg);
55921         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
55922         msg_conv.is_owned = false;
55923         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
55924         *ret_conv = verify_channel_announcement(&msg_conv);
55925         return tag_ptr(ret_conv, true);
55926 }
55927
55928 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_RoutingMessageHandler"))) TS_P2PGossipSync_as_RoutingMessageHandler(uint64_t this_arg) {
55929         LDKP2PGossipSync this_arg_conv;
55930         this_arg_conv.inner = untag_ptr(this_arg);
55931         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55933         this_arg_conv.is_owned = false;
55934         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
55935         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
55936         return tag_ptr(ret_ret, true);
55937 }
55938
55939 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_MessageSendEventsProvider"))) TS_P2PGossipSync_as_MessageSendEventsProvider(uint64_t this_arg) {
55940         LDKP2PGossipSync this_arg_conv;
55941         this_arg_conv.inner = untag_ptr(this_arg);
55942         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55944         this_arg_conv.is_owned = false;
55945         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
55946         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
55947         return tag_ptr(ret_ret, true);
55948 }
55949
55950 void  __attribute__((export_name("TS_ChannelUpdateInfo_free"))) TS_ChannelUpdateInfo_free(uint64_t this_obj) {
55951         LDKChannelUpdateInfo this_obj_conv;
55952         this_obj_conv.inner = untag_ptr(this_obj);
55953         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55955         ChannelUpdateInfo_free(this_obj_conv);
55956 }
55957
55958 int32_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update"))) TS_ChannelUpdateInfo_get_last_update(uint64_t this_ptr) {
55959         LDKChannelUpdateInfo this_ptr_conv;
55960         this_ptr_conv.inner = untag_ptr(this_ptr);
55961         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55963         this_ptr_conv.is_owned = false;
55964         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
55965         return ret_conv;
55966 }
55967
55968 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update"))) TS_ChannelUpdateInfo_set_last_update(uint64_t this_ptr, int32_t val) {
55969         LDKChannelUpdateInfo this_ptr_conv;
55970         this_ptr_conv.inner = untag_ptr(this_ptr);
55971         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55973         this_ptr_conv.is_owned = false;
55974         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
55975 }
55976
55977 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_get_enabled"))) TS_ChannelUpdateInfo_get_enabled(uint64_t this_ptr) {
55978         LDKChannelUpdateInfo this_ptr_conv;
55979         this_ptr_conv.inner = untag_ptr(this_ptr);
55980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55982         this_ptr_conv.is_owned = false;
55983         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
55984         return ret_conv;
55985 }
55986
55987 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_enabled"))) TS_ChannelUpdateInfo_set_enabled(uint64_t this_ptr, jboolean val) {
55988         LDKChannelUpdateInfo this_ptr_conv;
55989         this_ptr_conv.inner = untag_ptr(this_ptr);
55990         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55992         this_ptr_conv.is_owned = false;
55993         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
55994 }
55995
55996 int16_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_cltv_expiry_delta"))) TS_ChannelUpdateInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
55997         LDKChannelUpdateInfo this_ptr_conv;
55998         this_ptr_conv.inner = untag_ptr(this_ptr);
55999         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56001         this_ptr_conv.is_owned = false;
56002         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
56003         return ret_conv;
56004 }
56005
56006 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_cltv_expiry_delta"))) TS_ChannelUpdateInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
56007         LDKChannelUpdateInfo this_ptr_conv;
56008         this_ptr_conv.inner = untag_ptr(this_ptr);
56009         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56011         this_ptr_conv.is_owned = false;
56012         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
56013 }
56014
56015 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_minimum_msat"))) TS_ChannelUpdateInfo_get_htlc_minimum_msat(uint64_t this_ptr) {
56016         LDKChannelUpdateInfo this_ptr_conv;
56017         this_ptr_conv.inner = untag_ptr(this_ptr);
56018         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56020         this_ptr_conv.is_owned = false;
56021         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
56022         return ret_conv;
56023 }
56024
56025 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_minimum_msat"))) TS_ChannelUpdateInfo_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
56026         LDKChannelUpdateInfo this_ptr_conv;
56027         this_ptr_conv.inner = untag_ptr(this_ptr);
56028         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56030         this_ptr_conv.is_owned = false;
56031         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
56032 }
56033
56034 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_maximum_msat"))) TS_ChannelUpdateInfo_get_htlc_maximum_msat(uint64_t this_ptr) {
56035         LDKChannelUpdateInfo this_ptr_conv;
56036         this_ptr_conv.inner = untag_ptr(this_ptr);
56037         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56039         this_ptr_conv.is_owned = false;
56040         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
56041         return ret_conv;
56042 }
56043
56044 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_maximum_msat"))) TS_ChannelUpdateInfo_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
56045         LDKChannelUpdateInfo this_ptr_conv;
56046         this_ptr_conv.inner = untag_ptr(this_ptr);
56047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56049         this_ptr_conv.is_owned = false;
56050         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
56051 }
56052
56053 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_fees"))) TS_ChannelUpdateInfo_get_fees(uint64_t this_ptr) {
56054         LDKChannelUpdateInfo this_ptr_conv;
56055         this_ptr_conv.inner = untag_ptr(this_ptr);
56056         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56058         this_ptr_conv.is_owned = false;
56059         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
56060         uint64_t ret_ref = 0;
56061         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56062         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56063         return ret_ref;
56064 }
56065
56066 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_fees"))) TS_ChannelUpdateInfo_set_fees(uint64_t this_ptr, uint64_t val) {
56067         LDKChannelUpdateInfo this_ptr_conv;
56068         this_ptr_conv.inner = untag_ptr(this_ptr);
56069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56071         this_ptr_conv.is_owned = false;
56072         LDKRoutingFees val_conv;
56073         val_conv.inner = untag_ptr(val);
56074         val_conv.is_owned = ptr_is_owned(val);
56075         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56076         val_conv = RoutingFees_clone(&val_conv);
56077         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
56078 }
56079
56080 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update_message"))) TS_ChannelUpdateInfo_get_last_update_message(uint64_t this_ptr) {
56081         LDKChannelUpdateInfo this_ptr_conv;
56082         this_ptr_conv.inner = untag_ptr(this_ptr);
56083         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56085         this_ptr_conv.is_owned = false;
56086         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
56087         uint64_t ret_ref = 0;
56088         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56089         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56090         return ret_ref;
56091 }
56092
56093 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update_message"))) TS_ChannelUpdateInfo_set_last_update_message(uint64_t this_ptr, uint64_t val) {
56094         LDKChannelUpdateInfo this_ptr_conv;
56095         this_ptr_conv.inner = untag_ptr(this_ptr);
56096         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56098         this_ptr_conv.is_owned = false;
56099         LDKChannelUpdate val_conv;
56100         val_conv.inner = untag_ptr(val);
56101         val_conv.is_owned = ptr_is_owned(val);
56102         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56103         val_conv = ChannelUpdate_clone(&val_conv);
56104         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
56105 }
56106
56107 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) {
56108         LDKRoutingFees fees_arg_conv;
56109         fees_arg_conv.inner = untag_ptr(fees_arg);
56110         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
56111         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
56112         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
56113         LDKChannelUpdate last_update_message_arg_conv;
56114         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
56115         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
56116         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
56117         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
56118         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);
56119         uint64_t ret_ref = 0;
56120         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56121         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56122         return ret_ref;
56123 }
56124
56125 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
56126         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
56127         uint64_t ret_ref = 0;
56128         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56129         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56130         return ret_ref;
56131 }
56132 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone_ptr"))) TS_ChannelUpdateInfo_clone_ptr(uint64_t arg) {
56133         LDKChannelUpdateInfo arg_conv;
56134         arg_conv.inner = untag_ptr(arg);
56135         arg_conv.is_owned = ptr_is_owned(arg);
56136         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56137         arg_conv.is_owned = false;
56138         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
56139         return ret_conv;
56140 }
56141
56142 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone"))) TS_ChannelUpdateInfo_clone(uint64_t orig) {
56143         LDKChannelUpdateInfo orig_conv;
56144         orig_conv.inner = untag_ptr(orig);
56145         orig_conv.is_owned = ptr_is_owned(orig);
56146         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56147         orig_conv.is_owned = false;
56148         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
56149         uint64_t ret_ref = 0;
56150         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56151         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56152         return ret_ref;
56153 }
56154
56155 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_eq"))) TS_ChannelUpdateInfo_eq(uint64_t a, uint64_t b) {
56156         LDKChannelUpdateInfo a_conv;
56157         a_conv.inner = untag_ptr(a);
56158         a_conv.is_owned = ptr_is_owned(a);
56159         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56160         a_conv.is_owned = false;
56161         LDKChannelUpdateInfo b_conv;
56162         b_conv.inner = untag_ptr(b);
56163         b_conv.is_owned = ptr_is_owned(b);
56164         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56165         b_conv.is_owned = false;
56166         jboolean ret_conv = ChannelUpdateInfo_eq(&a_conv, &b_conv);
56167         return ret_conv;
56168 }
56169
56170 int8_tArray  __attribute__((export_name("TS_ChannelUpdateInfo_write"))) TS_ChannelUpdateInfo_write(uint64_t obj) {
56171         LDKChannelUpdateInfo obj_conv;
56172         obj_conv.inner = untag_ptr(obj);
56173         obj_conv.is_owned = ptr_is_owned(obj);
56174         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56175         obj_conv.is_owned = false;
56176         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
56177         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56178         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56179         CVec_u8Z_free(ret_var);
56180         return ret_arr;
56181 }
56182
56183 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_read"))) TS_ChannelUpdateInfo_read(int8_tArray ser) {
56184         LDKu8slice ser_ref;
56185         ser_ref.datalen = ser->arr_len;
56186         ser_ref.data = ser->elems;
56187         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
56188         *ret_conv = ChannelUpdateInfo_read(ser_ref);
56189         FREE(ser);
56190         return tag_ptr(ret_conv, true);
56191 }
56192
56193 void  __attribute__((export_name("TS_ChannelInfo_free"))) TS_ChannelInfo_free(uint64_t this_obj) {
56194         LDKChannelInfo this_obj_conv;
56195         this_obj_conv.inner = untag_ptr(this_obj);
56196         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56198         ChannelInfo_free(this_obj_conv);
56199 }
56200
56201 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_features"))) TS_ChannelInfo_get_features(uint64_t this_ptr) {
56202         LDKChannelInfo this_ptr_conv;
56203         this_ptr_conv.inner = untag_ptr(this_ptr);
56204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56206         this_ptr_conv.is_owned = false;
56207         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
56208         uint64_t ret_ref = 0;
56209         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56210         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56211         return ret_ref;
56212 }
56213
56214 void  __attribute__((export_name("TS_ChannelInfo_set_features"))) TS_ChannelInfo_set_features(uint64_t this_ptr, uint64_t val) {
56215         LDKChannelInfo this_ptr_conv;
56216         this_ptr_conv.inner = untag_ptr(this_ptr);
56217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56219         this_ptr_conv.is_owned = false;
56220         LDKChannelFeatures val_conv;
56221         val_conv.inner = untag_ptr(val);
56222         val_conv.is_owned = ptr_is_owned(val);
56223         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56224         val_conv = ChannelFeatures_clone(&val_conv);
56225         ChannelInfo_set_features(&this_ptr_conv, val_conv);
56226 }
56227
56228 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_one"))) TS_ChannelInfo_get_node_one(uint64_t this_ptr) {
56229         LDKChannelInfo this_ptr_conv;
56230         this_ptr_conv.inner = untag_ptr(this_ptr);
56231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56233         this_ptr_conv.is_owned = false;
56234         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
56235         uint64_t ret_ref = 0;
56236         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56237         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56238         return ret_ref;
56239 }
56240
56241 void  __attribute__((export_name("TS_ChannelInfo_set_node_one"))) TS_ChannelInfo_set_node_one(uint64_t this_ptr, uint64_t val) {
56242         LDKChannelInfo this_ptr_conv;
56243         this_ptr_conv.inner = untag_ptr(this_ptr);
56244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56246         this_ptr_conv.is_owned = false;
56247         LDKNodeId val_conv;
56248         val_conv.inner = untag_ptr(val);
56249         val_conv.is_owned = ptr_is_owned(val);
56250         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56251         val_conv = NodeId_clone(&val_conv);
56252         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
56253 }
56254
56255 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_one_to_two"))) TS_ChannelInfo_get_one_to_two(uint64_t this_ptr) {
56256         LDKChannelInfo this_ptr_conv;
56257         this_ptr_conv.inner = untag_ptr(this_ptr);
56258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56260         this_ptr_conv.is_owned = false;
56261         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
56262         uint64_t ret_ref = 0;
56263         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56264         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56265         return ret_ref;
56266 }
56267
56268 void  __attribute__((export_name("TS_ChannelInfo_set_one_to_two"))) TS_ChannelInfo_set_one_to_two(uint64_t this_ptr, uint64_t val) {
56269         LDKChannelInfo this_ptr_conv;
56270         this_ptr_conv.inner = untag_ptr(this_ptr);
56271         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56273         this_ptr_conv.is_owned = false;
56274         LDKChannelUpdateInfo val_conv;
56275         val_conv.inner = untag_ptr(val);
56276         val_conv.is_owned = ptr_is_owned(val);
56277         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56278         val_conv = ChannelUpdateInfo_clone(&val_conv);
56279         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
56280 }
56281
56282 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_two"))) TS_ChannelInfo_get_node_two(uint64_t this_ptr) {
56283         LDKChannelInfo this_ptr_conv;
56284         this_ptr_conv.inner = untag_ptr(this_ptr);
56285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56287         this_ptr_conv.is_owned = false;
56288         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
56289         uint64_t ret_ref = 0;
56290         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56291         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56292         return ret_ref;
56293 }
56294
56295 void  __attribute__((export_name("TS_ChannelInfo_set_node_two"))) TS_ChannelInfo_set_node_two(uint64_t this_ptr, uint64_t val) {
56296         LDKChannelInfo this_ptr_conv;
56297         this_ptr_conv.inner = untag_ptr(this_ptr);
56298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56300         this_ptr_conv.is_owned = false;
56301         LDKNodeId val_conv;
56302         val_conv.inner = untag_ptr(val);
56303         val_conv.is_owned = ptr_is_owned(val);
56304         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56305         val_conv = NodeId_clone(&val_conv);
56306         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
56307 }
56308
56309 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_two_to_one"))) TS_ChannelInfo_get_two_to_one(uint64_t this_ptr) {
56310         LDKChannelInfo this_ptr_conv;
56311         this_ptr_conv.inner = untag_ptr(this_ptr);
56312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56314         this_ptr_conv.is_owned = false;
56315         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
56316         uint64_t ret_ref = 0;
56317         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56318         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56319         return ret_ref;
56320 }
56321
56322 void  __attribute__((export_name("TS_ChannelInfo_set_two_to_one"))) TS_ChannelInfo_set_two_to_one(uint64_t this_ptr, uint64_t val) {
56323         LDKChannelInfo this_ptr_conv;
56324         this_ptr_conv.inner = untag_ptr(this_ptr);
56325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56327         this_ptr_conv.is_owned = false;
56328         LDKChannelUpdateInfo val_conv;
56329         val_conv.inner = untag_ptr(val);
56330         val_conv.is_owned = ptr_is_owned(val);
56331         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56332         val_conv = ChannelUpdateInfo_clone(&val_conv);
56333         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
56334 }
56335
56336 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_capacity_sats"))) TS_ChannelInfo_get_capacity_sats(uint64_t this_ptr) {
56337         LDKChannelInfo this_ptr_conv;
56338         this_ptr_conv.inner = untag_ptr(this_ptr);
56339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56341         this_ptr_conv.is_owned = false;
56342         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
56343         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
56344         uint64_t ret_ref = tag_ptr(ret_copy, true);
56345         return ret_ref;
56346 }
56347
56348 void  __attribute__((export_name("TS_ChannelInfo_set_capacity_sats"))) TS_ChannelInfo_set_capacity_sats(uint64_t this_ptr, uint64_t val) {
56349         LDKChannelInfo this_ptr_conv;
56350         this_ptr_conv.inner = untag_ptr(this_ptr);
56351         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56353         this_ptr_conv.is_owned = false;
56354         void* val_ptr = untag_ptr(val);
56355         CHECK_ACCESS(val_ptr);
56356         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
56357         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
56358         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
56359 }
56360
56361 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_announcement_message"))) TS_ChannelInfo_get_announcement_message(uint64_t this_ptr) {
56362         LDKChannelInfo this_ptr_conv;
56363         this_ptr_conv.inner = untag_ptr(this_ptr);
56364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56366         this_ptr_conv.is_owned = false;
56367         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
56368         uint64_t ret_ref = 0;
56369         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56370         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56371         return ret_ref;
56372 }
56373
56374 void  __attribute__((export_name("TS_ChannelInfo_set_announcement_message"))) TS_ChannelInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
56375         LDKChannelInfo this_ptr_conv;
56376         this_ptr_conv.inner = untag_ptr(this_ptr);
56377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56379         this_ptr_conv.is_owned = false;
56380         LDKChannelAnnouncement val_conv;
56381         val_conv.inner = untag_ptr(val);
56382         val_conv.is_owned = ptr_is_owned(val);
56383         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56384         val_conv = ChannelAnnouncement_clone(&val_conv);
56385         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
56386 }
56387
56388 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
56389         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
56390         uint64_t ret_ref = 0;
56391         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56392         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56393         return ret_ref;
56394 }
56395 int64_t  __attribute__((export_name("TS_ChannelInfo_clone_ptr"))) TS_ChannelInfo_clone_ptr(uint64_t arg) {
56396         LDKChannelInfo arg_conv;
56397         arg_conv.inner = untag_ptr(arg);
56398         arg_conv.is_owned = ptr_is_owned(arg);
56399         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56400         arg_conv.is_owned = false;
56401         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
56402         return ret_conv;
56403 }
56404
56405 uint64_t  __attribute__((export_name("TS_ChannelInfo_clone"))) TS_ChannelInfo_clone(uint64_t orig) {
56406         LDKChannelInfo orig_conv;
56407         orig_conv.inner = untag_ptr(orig);
56408         orig_conv.is_owned = ptr_is_owned(orig);
56409         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56410         orig_conv.is_owned = false;
56411         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
56412         uint64_t ret_ref = 0;
56413         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56414         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56415         return ret_ref;
56416 }
56417
56418 jboolean  __attribute__((export_name("TS_ChannelInfo_eq"))) TS_ChannelInfo_eq(uint64_t a, uint64_t b) {
56419         LDKChannelInfo a_conv;
56420         a_conv.inner = untag_ptr(a);
56421         a_conv.is_owned = ptr_is_owned(a);
56422         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56423         a_conv.is_owned = false;
56424         LDKChannelInfo b_conv;
56425         b_conv.inner = untag_ptr(b);
56426         b_conv.is_owned = ptr_is_owned(b);
56427         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56428         b_conv.is_owned = false;
56429         jboolean ret_conv = ChannelInfo_eq(&a_conv, &b_conv);
56430         return ret_conv;
56431 }
56432
56433 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_directional_info"))) TS_ChannelInfo_get_directional_info(uint64_t this_arg, int8_t channel_flags) {
56434         LDKChannelInfo this_arg_conv;
56435         this_arg_conv.inner = untag_ptr(this_arg);
56436         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56438         this_arg_conv.is_owned = false;
56439         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
56440         uint64_t ret_ref = 0;
56441         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56442         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56443         return ret_ref;
56444 }
56445
56446 int8_tArray  __attribute__((export_name("TS_ChannelInfo_write"))) TS_ChannelInfo_write(uint64_t obj) {
56447         LDKChannelInfo obj_conv;
56448         obj_conv.inner = untag_ptr(obj);
56449         obj_conv.is_owned = ptr_is_owned(obj);
56450         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56451         obj_conv.is_owned = false;
56452         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
56453         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56454         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56455         CVec_u8Z_free(ret_var);
56456         return ret_arr;
56457 }
56458
56459 uint64_t  __attribute__((export_name("TS_ChannelInfo_read"))) TS_ChannelInfo_read(int8_tArray ser) {
56460         LDKu8slice ser_ref;
56461         ser_ref.datalen = ser->arr_len;
56462         ser_ref.data = ser->elems;
56463         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
56464         *ret_conv = ChannelInfo_read(ser_ref);
56465         FREE(ser);
56466         return tag_ptr(ret_conv, true);
56467 }
56468
56469 void  __attribute__((export_name("TS_DirectedChannelInfo_free"))) TS_DirectedChannelInfo_free(uint64_t this_obj) {
56470         LDKDirectedChannelInfo this_obj_conv;
56471         this_obj_conv.inner = untag_ptr(this_obj);
56472         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56474         DirectedChannelInfo_free(this_obj_conv);
56475 }
56476
56477 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
56478         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
56479         uint64_t ret_ref = 0;
56480         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56481         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56482         return ret_ref;
56483 }
56484 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone_ptr"))) TS_DirectedChannelInfo_clone_ptr(uint64_t arg) {
56485         LDKDirectedChannelInfo arg_conv;
56486         arg_conv.inner = untag_ptr(arg);
56487         arg_conv.is_owned = ptr_is_owned(arg);
56488         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56489         arg_conv.is_owned = false;
56490         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
56491         return ret_conv;
56492 }
56493
56494 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone"))) TS_DirectedChannelInfo_clone(uint64_t orig) {
56495         LDKDirectedChannelInfo orig_conv;
56496         orig_conv.inner = untag_ptr(orig);
56497         orig_conv.is_owned = ptr_is_owned(orig);
56498         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56499         orig_conv.is_owned = false;
56500         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
56501         uint64_t ret_ref = 0;
56502         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56503         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56504         return ret_ref;
56505 }
56506
56507 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_channel"))) TS_DirectedChannelInfo_channel(uint64_t this_arg) {
56508         LDKDirectedChannelInfo this_arg_conv;
56509         this_arg_conv.inner = untag_ptr(this_arg);
56510         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56512         this_arg_conv.is_owned = false;
56513         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
56514         uint64_t ret_ref = 0;
56515         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56516         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56517         return ret_ref;
56518 }
56519
56520 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_htlc_maximum_msat"))) TS_DirectedChannelInfo_htlc_maximum_msat(uint64_t this_arg) {
56521         LDKDirectedChannelInfo this_arg_conv;
56522         this_arg_conv.inner = untag_ptr(this_arg);
56523         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56525         this_arg_conv.is_owned = false;
56526         int64_t ret_conv = DirectedChannelInfo_htlc_maximum_msat(&this_arg_conv);
56527         return ret_conv;
56528 }
56529
56530 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_effective_capacity"))) TS_DirectedChannelInfo_effective_capacity(uint64_t this_arg) {
56531         LDKDirectedChannelInfo this_arg_conv;
56532         this_arg_conv.inner = untag_ptr(this_arg);
56533         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56535         this_arg_conv.is_owned = false;
56536         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
56537         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
56538         uint64_t ret_ref = tag_ptr(ret_copy, true);
56539         return ret_ref;
56540 }
56541
56542 void  __attribute__((export_name("TS_EffectiveCapacity_free"))) TS_EffectiveCapacity_free(uint64_t this_ptr) {
56543         if (!ptr_is_owned(this_ptr)) return;
56544         void* this_ptr_ptr = untag_ptr(this_ptr);
56545         CHECK_ACCESS(this_ptr_ptr);
56546         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
56547         FREE(untag_ptr(this_ptr));
56548         EffectiveCapacity_free(this_ptr_conv);
56549 }
56550
56551 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
56552         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
56553         *ret_copy = EffectiveCapacity_clone(arg);
56554         uint64_t ret_ref = tag_ptr(ret_copy, true);
56555         return ret_ref;
56556 }
56557 int64_t  __attribute__((export_name("TS_EffectiveCapacity_clone_ptr"))) TS_EffectiveCapacity_clone_ptr(uint64_t arg) {
56558         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
56559         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
56560         return ret_conv;
56561 }
56562
56563 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_clone"))) TS_EffectiveCapacity_clone(uint64_t orig) {
56564         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
56565         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
56566         *ret_copy = EffectiveCapacity_clone(orig_conv);
56567         uint64_t ret_ref = tag_ptr(ret_copy, true);
56568         return ret_ref;
56569 }
56570
56571 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_exact_liquidity"))) TS_EffectiveCapacity_exact_liquidity(int64_t liquidity_msat) {
56572         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
56573         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
56574         uint64_t ret_ref = tag_ptr(ret_copy, true);
56575         return ret_ref;
56576 }
56577
56578 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_advertised_max_htlc"))) TS_EffectiveCapacity_advertised_max_htlc(int64_t amount_msat) {
56579         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
56580         *ret_copy = EffectiveCapacity_advertised_max_htlc(amount_msat);
56581         uint64_t ret_ref = tag_ptr(ret_copy, true);
56582         return ret_ref;
56583 }
56584
56585 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_total"))) TS_EffectiveCapacity_total(int64_t capacity_msat, int64_t htlc_maximum_msat) {
56586         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
56587         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat);
56588         uint64_t ret_ref = tag_ptr(ret_copy, true);
56589         return ret_ref;
56590 }
56591
56592 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_infinite"))) TS_EffectiveCapacity_infinite() {
56593         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
56594         *ret_copy = EffectiveCapacity_infinite();
56595         uint64_t ret_ref = tag_ptr(ret_copy, true);
56596         return ret_ref;
56597 }
56598
56599 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_hint_max_htlc"))) TS_EffectiveCapacity_hint_max_htlc(int64_t amount_msat) {
56600         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
56601         *ret_copy = EffectiveCapacity_hint_max_htlc(amount_msat);
56602         uint64_t ret_ref = tag_ptr(ret_copy, true);
56603         return ret_ref;
56604 }
56605
56606 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_unknown"))) TS_EffectiveCapacity_unknown() {
56607         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
56608         *ret_copy = EffectiveCapacity_unknown();
56609         uint64_t ret_ref = tag_ptr(ret_copy, true);
56610         return ret_ref;
56611 }
56612
56613 int64_t  __attribute__((export_name("TS_EffectiveCapacity_as_msat"))) TS_EffectiveCapacity_as_msat(uint64_t this_arg) {
56614         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
56615         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
56616         return ret_conv;
56617 }
56618
56619 void  __attribute__((export_name("TS_RoutingFees_free"))) TS_RoutingFees_free(uint64_t this_obj) {
56620         LDKRoutingFees this_obj_conv;
56621         this_obj_conv.inner = untag_ptr(this_obj);
56622         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56624         RoutingFees_free(this_obj_conv);
56625 }
56626
56627 int32_t  __attribute__((export_name("TS_RoutingFees_get_base_msat"))) TS_RoutingFees_get_base_msat(uint64_t this_ptr) {
56628         LDKRoutingFees this_ptr_conv;
56629         this_ptr_conv.inner = untag_ptr(this_ptr);
56630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56632         this_ptr_conv.is_owned = false;
56633         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
56634         return ret_conv;
56635 }
56636
56637 void  __attribute__((export_name("TS_RoutingFees_set_base_msat"))) TS_RoutingFees_set_base_msat(uint64_t this_ptr, int32_t val) {
56638         LDKRoutingFees this_ptr_conv;
56639         this_ptr_conv.inner = untag_ptr(this_ptr);
56640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56642         this_ptr_conv.is_owned = false;
56643         RoutingFees_set_base_msat(&this_ptr_conv, val);
56644 }
56645
56646 int32_t  __attribute__((export_name("TS_RoutingFees_get_proportional_millionths"))) TS_RoutingFees_get_proportional_millionths(uint64_t this_ptr) {
56647         LDKRoutingFees this_ptr_conv;
56648         this_ptr_conv.inner = untag_ptr(this_ptr);
56649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56651         this_ptr_conv.is_owned = false;
56652         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
56653         return ret_conv;
56654 }
56655
56656 void  __attribute__((export_name("TS_RoutingFees_set_proportional_millionths"))) TS_RoutingFees_set_proportional_millionths(uint64_t this_ptr, int32_t val) {
56657         LDKRoutingFees this_ptr_conv;
56658         this_ptr_conv.inner = untag_ptr(this_ptr);
56659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56661         this_ptr_conv.is_owned = false;
56662         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
56663 }
56664
56665 uint64_t  __attribute__((export_name("TS_RoutingFees_new"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
56666         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
56667         uint64_t ret_ref = 0;
56668         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56669         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56670         return ret_ref;
56671 }
56672
56673 jboolean  __attribute__((export_name("TS_RoutingFees_eq"))) TS_RoutingFees_eq(uint64_t a, uint64_t b) {
56674         LDKRoutingFees a_conv;
56675         a_conv.inner = untag_ptr(a);
56676         a_conv.is_owned = ptr_is_owned(a);
56677         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56678         a_conv.is_owned = false;
56679         LDKRoutingFees b_conv;
56680         b_conv.inner = untag_ptr(b);
56681         b_conv.is_owned = ptr_is_owned(b);
56682         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56683         b_conv.is_owned = false;
56684         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
56685         return ret_conv;
56686 }
56687
56688 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
56689         LDKRoutingFees ret_var = RoutingFees_clone(arg);
56690         uint64_t ret_ref = 0;
56691         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56692         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56693         return ret_ref;
56694 }
56695 int64_t  __attribute__((export_name("TS_RoutingFees_clone_ptr"))) TS_RoutingFees_clone_ptr(uint64_t arg) {
56696         LDKRoutingFees arg_conv;
56697         arg_conv.inner = untag_ptr(arg);
56698         arg_conv.is_owned = ptr_is_owned(arg);
56699         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56700         arg_conv.is_owned = false;
56701         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
56702         return ret_conv;
56703 }
56704
56705 uint64_t  __attribute__((export_name("TS_RoutingFees_clone"))) TS_RoutingFees_clone(uint64_t orig) {
56706         LDKRoutingFees orig_conv;
56707         orig_conv.inner = untag_ptr(orig);
56708         orig_conv.is_owned = ptr_is_owned(orig);
56709         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56710         orig_conv.is_owned = false;
56711         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
56712         uint64_t ret_ref = 0;
56713         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56714         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56715         return ret_ref;
56716 }
56717
56718 int64_t  __attribute__((export_name("TS_RoutingFees_hash"))) TS_RoutingFees_hash(uint64_t o) {
56719         LDKRoutingFees o_conv;
56720         o_conv.inner = untag_ptr(o);
56721         o_conv.is_owned = ptr_is_owned(o);
56722         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
56723         o_conv.is_owned = false;
56724         int64_t ret_conv = RoutingFees_hash(&o_conv);
56725         return ret_conv;
56726 }
56727
56728 int8_tArray  __attribute__((export_name("TS_RoutingFees_write"))) TS_RoutingFees_write(uint64_t obj) {
56729         LDKRoutingFees obj_conv;
56730         obj_conv.inner = untag_ptr(obj);
56731         obj_conv.is_owned = ptr_is_owned(obj);
56732         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56733         obj_conv.is_owned = false;
56734         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
56735         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56736         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56737         CVec_u8Z_free(ret_var);
56738         return ret_arr;
56739 }
56740
56741 uint64_t  __attribute__((export_name("TS_RoutingFees_read"))) TS_RoutingFees_read(int8_tArray ser) {
56742         LDKu8slice ser_ref;
56743         ser_ref.datalen = ser->arr_len;
56744         ser_ref.data = ser->elems;
56745         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
56746         *ret_conv = RoutingFees_read(ser_ref);
56747         FREE(ser);
56748         return tag_ptr(ret_conv, true);
56749 }
56750
56751 void  __attribute__((export_name("TS_NodeAnnouncementInfo_free"))) TS_NodeAnnouncementInfo_free(uint64_t this_obj) {
56752         LDKNodeAnnouncementInfo this_obj_conv;
56753         this_obj_conv.inner = untag_ptr(this_obj);
56754         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56756         NodeAnnouncementInfo_free(this_obj_conv);
56757 }
56758
56759 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_features"))) TS_NodeAnnouncementInfo_get_features(uint64_t this_ptr) {
56760         LDKNodeAnnouncementInfo this_ptr_conv;
56761         this_ptr_conv.inner = untag_ptr(this_ptr);
56762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56764         this_ptr_conv.is_owned = false;
56765         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
56766         uint64_t ret_ref = 0;
56767         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56768         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56769         return ret_ref;
56770 }
56771
56772 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_features"))) TS_NodeAnnouncementInfo_set_features(uint64_t this_ptr, uint64_t val) {
56773         LDKNodeAnnouncementInfo this_ptr_conv;
56774         this_ptr_conv.inner = untag_ptr(this_ptr);
56775         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56777         this_ptr_conv.is_owned = false;
56778         LDKNodeFeatures val_conv;
56779         val_conv.inner = untag_ptr(val);
56780         val_conv.is_owned = ptr_is_owned(val);
56781         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56782         val_conv = NodeFeatures_clone(&val_conv);
56783         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
56784 }
56785
56786 int32_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_last_update"))) TS_NodeAnnouncementInfo_get_last_update(uint64_t this_ptr) {
56787         LDKNodeAnnouncementInfo this_ptr_conv;
56788         this_ptr_conv.inner = untag_ptr(this_ptr);
56789         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56791         this_ptr_conv.is_owned = false;
56792         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
56793         return ret_conv;
56794 }
56795
56796 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_last_update"))) TS_NodeAnnouncementInfo_set_last_update(uint64_t this_ptr, int32_t val) {
56797         LDKNodeAnnouncementInfo this_ptr_conv;
56798         this_ptr_conv.inner = untag_ptr(this_ptr);
56799         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56801         this_ptr_conv.is_owned = false;
56802         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
56803 }
56804
56805 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_get_rgb"))) TS_NodeAnnouncementInfo_get_rgb(uint64_t this_ptr) {
56806         LDKNodeAnnouncementInfo this_ptr_conv;
56807         this_ptr_conv.inner = untag_ptr(this_ptr);
56808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56810         this_ptr_conv.is_owned = false;
56811         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
56812         memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
56813         return ret_arr;
56814 }
56815
56816 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_rgb"))) TS_NodeAnnouncementInfo_set_rgb(uint64_t this_ptr, int8_tArray val) {
56817         LDKNodeAnnouncementInfo this_ptr_conv;
56818         this_ptr_conv.inner = untag_ptr(this_ptr);
56819         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56821         this_ptr_conv.is_owned = false;
56822         LDKThreeBytes val_ref;
56823         CHECK(val->arr_len == 3);
56824         memcpy(val_ref.data, val->elems, 3); FREE(val);
56825         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
56826 }
56827
56828 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_alias"))) TS_NodeAnnouncementInfo_get_alias(uint64_t this_ptr) {
56829         LDKNodeAnnouncementInfo this_ptr_conv;
56830         this_ptr_conv.inner = untag_ptr(this_ptr);
56831         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56833         this_ptr_conv.is_owned = false;
56834         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
56835         uint64_t ret_ref = 0;
56836         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56837         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56838         return ret_ref;
56839 }
56840
56841 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_alias"))) TS_NodeAnnouncementInfo_set_alias(uint64_t this_ptr, uint64_t val) {
56842         LDKNodeAnnouncementInfo this_ptr_conv;
56843         this_ptr_conv.inner = untag_ptr(this_ptr);
56844         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56846         this_ptr_conv.is_owned = false;
56847         LDKNodeAlias val_conv;
56848         val_conv.inner = untag_ptr(val);
56849         val_conv.is_owned = ptr_is_owned(val);
56850         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56851         val_conv = NodeAlias_clone(&val_conv);
56852         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
56853 }
56854
56855 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_announcement_message"))) TS_NodeAnnouncementInfo_get_announcement_message(uint64_t this_ptr) {
56856         LDKNodeAnnouncementInfo this_ptr_conv;
56857         this_ptr_conv.inner = untag_ptr(this_ptr);
56858         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56860         this_ptr_conv.is_owned = false;
56861         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
56862         uint64_t ret_ref = 0;
56863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56865         return ret_ref;
56866 }
56867
56868 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_announcement_message"))) TS_NodeAnnouncementInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
56869         LDKNodeAnnouncementInfo this_ptr_conv;
56870         this_ptr_conv.inner = untag_ptr(this_ptr);
56871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56873         this_ptr_conv.is_owned = false;
56874         LDKNodeAnnouncement val_conv;
56875         val_conv.inner = untag_ptr(val);
56876         val_conv.is_owned = ptr_is_owned(val);
56877         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56878         val_conv = NodeAnnouncement_clone(&val_conv);
56879         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
56880 }
56881
56882 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) {
56883         LDKNodeFeatures features_arg_conv;
56884         features_arg_conv.inner = untag_ptr(features_arg);
56885         features_arg_conv.is_owned = ptr_is_owned(features_arg);
56886         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
56887         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
56888         LDKThreeBytes rgb_arg_ref;
56889         CHECK(rgb_arg->arr_len == 3);
56890         memcpy(rgb_arg_ref.data, rgb_arg->elems, 3); FREE(rgb_arg);
56891         LDKNodeAlias alias_arg_conv;
56892         alias_arg_conv.inner = untag_ptr(alias_arg);
56893         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
56894         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
56895         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
56896         LDKNodeAnnouncement announcement_message_arg_conv;
56897         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
56898         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
56899         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
56900         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
56901         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, announcement_message_arg_conv);
56902         uint64_t ret_ref = 0;
56903         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56904         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56905         return ret_ref;
56906 }
56907
56908 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
56909         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
56910         uint64_t ret_ref = 0;
56911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56913         return ret_ref;
56914 }
56915 int64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone_ptr"))) TS_NodeAnnouncementInfo_clone_ptr(uint64_t arg) {
56916         LDKNodeAnnouncementInfo arg_conv;
56917         arg_conv.inner = untag_ptr(arg);
56918         arg_conv.is_owned = ptr_is_owned(arg);
56919         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56920         arg_conv.is_owned = false;
56921         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
56922         return ret_conv;
56923 }
56924
56925 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone"))) TS_NodeAnnouncementInfo_clone(uint64_t orig) {
56926         LDKNodeAnnouncementInfo orig_conv;
56927         orig_conv.inner = untag_ptr(orig);
56928         orig_conv.is_owned = ptr_is_owned(orig);
56929         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56930         orig_conv.is_owned = false;
56931         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
56932         uint64_t ret_ref = 0;
56933         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56934         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56935         return ret_ref;
56936 }
56937
56938 jboolean  __attribute__((export_name("TS_NodeAnnouncementInfo_eq"))) TS_NodeAnnouncementInfo_eq(uint64_t a, uint64_t b) {
56939         LDKNodeAnnouncementInfo a_conv;
56940         a_conv.inner = untag_ptr(a);
56941         a_conv.is_owned = ptr_is_owned(a);
56942         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56943         a_conv.is_owned = false;
56944         LDKNodeAnnouncementInfo b_conv;
56945         b_conv.inner = untag_ptr(b);
56946         b_conv.is_owned = ptr_is_owned(b);
56947         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56948         b_conv.is_owned = false;
56949         jboolean ret_conv = NodeAnnouncementInfo_eq(&a_conv, &b_conv);
56950         return ret_conv;
56951 }
56952
56953 uint64_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_addresses"))) TS_NodeAnnouncementInfo_addresses(uint64_t this_arg) {
56954         LDKNodeAnnouncementInfo this_arg_conv;
56955         this_arg_conv.inner = untag_ptr(this_arg);
56956         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56958         this_arg_conv.is_owned = false;
56959         LDKCVec_SocketAddressZ ret_var = NodeAnnouncementInfo_addresses(&this_arg_conv);
56960         uint64_tArray ret_arr = NULL;
56961         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
56962         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
56963         for (size_t p = 0; p < ret_var.datalen; p++) {
56964                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
56965                 *ret_conv_15_copy = ret_var.data[p];
56966                 uint64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
56967                 ret_arr_ptr[p] = ret_conv_15_ref;
56968         }
56969         
56970         FREE(ret_var.data);
56971         return ret_arr;
56972 }
56973
56974 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_write"))) TS_NodeAnnouncementInfo_write(uint64_t obj) {
56975         LDKNodeAnnouncementInfo obj_conv;
56976         obj_conv.inner = untag_ptr(obj);
56977         obj_conv.is_owned = ptr_is_owned(obj);
56978         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56979         obj_conv.is_owned = false;
56980         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
56981         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56982         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56983         CVec_u8Z_free(ret_var);
56984         return ret_arr;
56985 }
56986
56987 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_read"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
56988         LDKu8slice ser_ref;
56989         ser_ref.datalen = ser->arr_len;
56990         ser_ref.data = ser->elems;
56991         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
56992         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
56993         FREE(ser);
56994         return tag_ptr(ret_conv, true);
56995 }
56996
56997 void  __attribute__((export_name("TS_NodeAlias_free"))) TS_NodeAlias_free(uint64_t this_obj) {
56998         LDKNodeAlias this_obj_conv;
56999         this_obj_conv.inner = untag_ptr(this_obj);
57000         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57002         NodeAlias_free(this_obj_conv);
57003 }
57004
57005 int8_tArray  __attribute__((export_name("TS_NodeAlias_get_a"))) TS_NodeAlias_get_a(uint64_t this_ptr) {
57006         LDKNodeAlias this_ptr_conv;
57007         this_ptr_conv.inner = untag_ptr(this_ptr);
57008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57010         this_ptr_conv.is_owned = false;
57011         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
57012         memcpy(ret_arr->elems, *NodeAlias_get_a(&this_ptr_conv), 32);
57013         return ret_arr;
57014 }
57015
57016 void  __attribute__((export_name("TS_NodeAlias_set_a"))) TS_NodeAlias_set_a(uint64_t this_ptr, int8_tArray val) {
57017         LDKNodeAlias this_ptr_conv;
57018         this_ptr_conv.inner = untag_ptr(this_ptr);
57019         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57021         this_ptr_conv.is_owned = false;
57022         LDKThirtyTwoBytes val_ref;
57023         CHECK(val->arr_len == 32);
57024         memcpy(val_ref.data, val->elems, 32); FREE(val);
57025         NodeAlias_set_a(&this_ptr_conv, val_ref);
57026 }
57027
57028 uint64_t  __attribute__((export_name("TS_NodeAlias_new"))) TS_NodeAlias_new(int8_tArray a_arg) {
57029         LDKThirtyTwoBytes a_arg_ref;
57030         CHECK(a_arg->arr_len == 32);
57031         memcpy(a_arg_ref.data, a_arg->elems, 32); FREE(a_arg);
57032         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
57033         uint64_t ret_ref = 0;
57034         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57035         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57036         return ret_ref;
57037 }
57038
57039 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
57040         LDKNodeAlias ret_var = NodeAlias_clone(arg);
57041         uint64_t ret_ref = 0;
57042         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57043         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57044         return ret_ref;
57045 }
57046 int64_t  __attribute__((export_name("TS_NodeAlias_clone_ptr"))) TS_NodeAlias_clone_ptr(uint64_t arg) {
57047         LDKNodeAlias arg_conv;
57048         arg_conv.inner = untag_ptr(arg);
57049         arg_conv.is_owned = ptr_is_owned(arg);
57050         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57051         arg_conv.is_owned = false;
57052         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
57053         return ret_conv;
57054 }
57055
57056 uint64_t  __attribute__((export_name("TS_NodeAlias_clone"))) TS_NodeAlias_clone(uint64_t orig) {
57057         LDKNodeAlias orig_conv;
57058         orig_conv.inner = untag_ptr(orig);
57059         orig_conv.is_owned = ptr_is_owned(orig);
57060         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57061         orig_conv.is_owned = false;
57062         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
57063         uint64_t ret_ref = 0;
57064         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57065         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57066         return ret_ref;
57067 }
57068
57069 jboolean  __attribute__((export_name("TS_NodeAlias_eq"))) TS_NodeAlias_eq(uint64_t a, uint64_t b) {
57070         LDKNodeAlias a_conv;
57071         a_conv.inner = untag_ptr(a);
57072         a_conv.is_owned = ptr_is_owned(a);
57073         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57074         a_conv.is_owned = false;
57075         LDKNodeAlias b_conv;
57076         b_conv.inner = untag_ptr(b);
57077         b_conv.is_owned = ptr_is_owned(b);
57078         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57079         b_conv.is_owned = false;
57080         jboolean ret_conv = NodeAlias_eq(&a_conv, &b_conv);
57081         return ret_conv;
57082 }
57083
57084 int8_tArray  __attribute__((export_name("TS_NodeAlias_write"))) TS_NodeAlias_write(uint64_t obj) {
57085         LDKNodeAlias obj_conv;
57086         obj_conv.inner = untag_ptr(obj);
57087         obj_conv.is_owned = ptr_is_owned(obj);
57088         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57089         obj_conv.is_owned = false;
57090         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
57091         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57092         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57093         CVec_u8Z_free(ret_var);
57094         return ret_arr;
57095 }
57096
57097 uint64_t  __attribute__((export_name("TS_NodeAlias_read"))) TS_NodeAlias_read(int8_tArray ser) {
57098         LDKu8slice ser_ref;
57099         ser_ref.datalen = ser->arr_len;
57100         ser_ref.data = ser->elems;
57101         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
57102         *ret_conv = NodeAlias_read(ser_ref);
57103         FREE(ser);
57104         return tag_ptr(ret_conv, true);
57105 }
57106
57107 void  __attribute__((export_name("TS_NodeInfo_free"))) TS_NodeInfo_free(uint64_t this_obj) {
57108         LDKNodeInfo this_obj_conv;
57109         this_obj_conv.inner = untag_ptr(this_obj);
57110         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57112         NodeInfo_free(this_obj_conv);
57113 }
57114
57115 int64_tArray  __attribute__((export_name("TS_NodeInfo_get_channels"))) TS_NodeInfo_get_channels(uint64_t this_ptr) {
57116         LDKNodeInfo this_ptr_conv;
57117         this_ptr_conv.inner = untag_ptr(this_ptr);
57118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57120         this_ptr_conv.is_owned = false;
57121         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
57122         int64_tArray ret_arr = NULL;
57123         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
57124         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
57125         for (size_t i = 0; i < ret_var.datalen; i++) {
57126                 int64_t ret_conv_8_conv = ret_var.data[i];
57127                 ret_arr_ptr[i] = ret_conv_8_conv;
57128         }
57129         
57130         FREE(ret_var.data);
57131         return ret_arr;
57132 }
57133
57134 void  __attribute__((export_name("TS_NodeInfo_set_channels"))) TS_NodeInfo_set_channels(uint64_t this_ptr, int64_tArray val) {
57135         LDKNodeInfo this_ptr_conv;
57136         this_ptr_conv.inner = untag_ptr(this_ptr);
57137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57139         this_ptr_conv.is_owned = false;
57140         LDKCVec_u64Z val_constr;
57141         val_constr.datalen = val->arr_len;
57142         if (val_constr.datalen > 0)
57143                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
57144         else
57145                 val_constr.data = NULL;
57146         int64_t* val_vals = val->elems;
57147         for (size_t i = 0; i < val_constr.datalen; i++) {
57148                 int64_t val_conv_8 = val_vals[i];
57149                 val_constr.data[i] = val_conv_8;
57150         }
57151         FREE(val);
57152         NodeInfo_set_channels(&this_ptr_conv, val_constr);
57153 }
57154
57155 uint64_t  __attribute__((export_name("TS_NodeInfo_get_announcement_info"))) TS_NodeInfo_get_announcement_info(uint64_t this_ptr) {
57156         LDKNodeInfo this_ptr_conv;
57157         this_ptr_conv.inner = untag_ptr(this_ptr);
57158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57160         this_ptr_conv.is_owned = false;
57161         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
57162         uint64_t ret_ref = 0;
57163         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57164         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57165         return ret_ref;
57166 }
57167
57168 void  __attribute__((export_name("TS_NodeInfo_set_announcement_info"))) TS_NodeInfo_set_announcement_info(uint64_t this_ptr, uint64_t val) {
57169         LDKNodeInfo this_ptr_conv;
57170         this_ptr_conv.inner = untag_ptr(this_ptr);
57171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57173         this_ptr_conv.is_owned = false;
57174         LDKNodeAnnouncementInfo val_conv;
57175         val_conv.inner = untag_ptr(val);
57176         val_conv.is_owned = ptr_is_owned(val);
57177         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57178         val_conv = NodeAnnouncementInfo_clone(&val_conv);
57179         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
57180 }
57181
57182 uint64_t  __attribute__((export_name("TS_NodeInfo_new"))) TS_NodeInfo_new(int64_tArray channels_arg, uint64_t announcement_info_arg) {
57183         LDKCVec_u64Z channels_arg_constr;
57184         channels_arg_constr.datalen = channels_arg->arr_len;
57185         if (channels_arg_constr.datalen > 0)
57186                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
57187         else
57188                 channels_arg_constr.data = NULL;
57189         int64_t* channels_arg_vals = channels_arg->elems;
57190         for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
57191                 int64_t channels_arg_conv_8 = channels_arg_vals[i];
57192                 channels_arg_constr.data[i] = channels_arg_conv_8;
57193         }
57194         FREE(channels_arg);
57195         LDKNodeAnnouncementInfo announcement_info_arg_conv;
57196         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
57197         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
57198         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
57199         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
57200         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, announcement_info_arg_conv);
57201         uint64_t ret_ref = 0;
57202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57204         return ret_ref;
57205 }
57206
57207 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
57208         LDKNodeInfo ret_var = NodeInfo_clone(arg);
57209         uint64_t ret_ref = 0;
57210         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57211         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57212         return ret_ref;
57213 }
57214 int64_t  __attribute__((export_name("TS_NodeInfo_clone_ptr"))) TS_NodeInfo_clone_ptr(uint64_t arg) {
57215         LDKNodeInfo arg_conv;
57216         arg_conv.inner = untag_ptr(arg);
57217         arg_conv.is_owned = ptr_is_owned(arg);
57218         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57219         arg_conv.is_owned = false;
57220         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
57221         return ret_conv;
57222 }
57223
57224 uint64_t  __attribute__((export_name("TS_NodeInfo_clone"))) TS_NodeInfo_clone(uint64_t orig) {
57225         LDKNodeInfo orig_conv;
57226         orig_conv.inner = untag_ptr(orig);
57227         orig_conv.is_owned = ptr_is_owned(orig);
57228         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57229         orig_conv.is_owned = false;
57230         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
57231         uint64_t ret_ref = 0;
57232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57234         return ret_ref;
57235 }
57236
57237 jboolean  __attribute__((export_name("TS_NodeInfo_eq"))) TS_NodeInfo_eq(uint64_t a, uint64_t b) {
57238         LDKNodeInfo a_conv;
57239         a_conv.inner = untag_ptr(a);
57240         a_conv.is_owned = ptr_is_owned(a);
57241         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57242         a_conv.is_owned = false;
57243         LDKNodeInfo b_conv;
57244         b_conv.inner = untag_ptr(b);
57245         b_conv.is_owned = ptr_is_owned(b);
57246         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57247         b_conv.is_owned = false;
57248         jboolean ret_conv = NodeInfo_eq(&a_conv, &b_conv);
57249         return ret_conv;
57250 }
57251
57252 int8_tArray  __attribute__((export_name("TS_NodeInfo_write"))) TS_NodeInfo_write(uint64_t obj) {
57253         LDKNodeInfo obj_conv;
57254         obj_conv.inner = untag_ptr(obj);
57255         obj_conv.is_owned = ptr_is_owned(obj);
57256         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57257         obj_conv.is_owned = false;
57258         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
57259         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57260         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57261         CVec_u8Z_free(ret_var);
57262         return ret_arr;
57263 }
57264
57265 uint64_t  __attribute__((export_name("TS_NodeInfo_read"))) TS_NodeInfo_read(int8_tArray ser) {
57266         LDKu8slice ser_ref;
57267         ser_ref.datalen = ser->arr_len;
57268         ser_ref.data = ser->elems;
57269         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
57270         *ret_conv = NodeInfo_read(ser_ref);
57271         FREE(ser);
57272         return tag_ptr(ret_conv, true);
57273 }
57274
57275 int8_tArray  __attribute__((export_name("TS_NetworkGraph_write"))) TS_NetworkGraph_write(uint64_t obj) {
57276         LDKNetworkGraph obj_conv;
57277         obj_conv.inner = untag_ptr(obj);
57278         obj_conv.is_owned = ptr_is_owned(obj);
57279         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57280         obj_conv.is_owned = false;
57281         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
57282         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57283         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57284         CVec_u8Z_free(ret_var);
57285         return ret_arr;
57286 }
57287
57288 uint64_t  __attribute__((export_name("TS_NetworkGraph_read"))) TS_NetworkGraph_read(int8_tArray ser, uint64_t arg) {
57289         LDKu8slice ser_ref;
57290         ser_ref.datalen = ser->arr_len;
57291         ser_ref.data = ser->elems;
57292         void* arg_ptr = untag_ptr(arg);
57293         CHECK_ACCESS(arg_ptr);
57294         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
57295         if (arg_conv.free == LDKLogger_JCalls_free) {
57296                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57297                 LDKLogger_JCalls_cloned(&arg_conv);
57298         }
57299         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
57300         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
57301         FREE(ser);
57302         return tag_ptr(ret_conv, true);
57303 }
57304
57305 uint64_t  __attribute__((export_name("TS_NetworkGraph_new"))) TS_NetworkGraph_new(uint32_t network, uint64_t logger) {
57306         LDKNetwork network_conv = LDKNetwork_from_js(network);
57307         void* logger_ptr = untag_ptr(logger);
57308         CHECK_ACCESS(logger_ptr);
57309         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
57310         if (logger_conv.free == LDKLogger_JCalls_free) {
57311                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57312                 LDKLogger_JCalls_cloned(&logger_conv);
57313         }
57314         LDKNetworkGraph ret_var = NetworkGraph_new(network_conv, logger_conv);
57315         uint64_t ret_ref = 0;
57316         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57317         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57318         return ret_ref;
57319 }
57320
57321 uint64_t  __attribute__((export_name("TS_NetworkGraph_read_only"))) TS_NetworkGraph_read_only(uint64_t this_arg) {
57322         LDKNetworkGraph this_arg_conv;
57323         this_arg_conv.inner = untag_ptr(this_arg);
57324         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57326         this_arg_conv.is_owned = false;
57327         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
57328         uint64_t ret_ref = 0;
57329         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57330         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57331         return ret_ref;
57332 }
57333
57334 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) {
57335         LDKNetworkGraph this_arg_conv;
57336         this_arg_conv.inner = untag_ptr(this_arg);
57337         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57339         this_arg_conv.is_owned = false;
57340         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
57341         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
57342         uint64_t ret_ref = tag_ptr(ret_copy, true);
57343         return ret_ref;
57344 }
57345
57346 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) {
57347         LDKNetworkGraph this_arg_conv;
57348         this_arg_conv.inner = untag_ptr(this_arg);
57349         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57351         this_arg_conv.is_owned = false;
57352         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
57353 }
57354
57355 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_node_from_announcement"))) TS_NetworkGraph_update_node_from_announcement(uint64_t this_arg, uint64_t msg) {
57356         LDKNetworkGraph this_arg_conv;
57357         this_arg_conv.inner = untag_ptr(this_arg);
57358         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57360         this_arg_conv.is_owned = false;
57361         LDKNodeAnnouncement msg_conv;
57362         msg_conv.inner = untag_ptr(msg);
57363         msg_conv.is_owned = ptr_is_owned(msg);
57364         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
57365         msg_conv.is_owned = false;
57366         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
57367         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
57368         return tag_ptr(ret_conv, true);
57369 }
57370
57371 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) {
57372         LDKNetworkGraph this_arg_conv;
57373         this_arg_conv.inner = untag_ptr(this_arg);
57374         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57376         this_arg_conv.is_owned = false;
57377         LDKUnsignedNodeAnnouncement msg_conv;
57378         msg_conv.inner = untag_ptr(msg);
57379         msg_conv.is_owned = ptr_is_owned(msg);
57380         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
57381         msg_conv.is_owned = false;
57382         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
57383         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
57384         return tag_ptr(ret_conv, true);
57385 }
57386
57387 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) {
57388         LDKNetworkGraph this_arg_conv;
57389         this_arg_conv.inner = untag_ptr(this_arg);
57390         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57392         this_arg_conv.is_owned = false;
57393         LDKChannelAnnouncement msg_conv;
57394         msg_conv.inner = untag_ptr(msg);
57395         msg_conv.is_owned = ptr_is_owned(msg);
57396         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
57397         msg_conv.is_owned = false;
57398         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
57399         CHECK_ACCESS(utxo_lookup_ptr);
57400         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
57401         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
57402         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
57403                 // Manually implement clone for Java trait instances
57404                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
57405                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57406                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
57407                 }
57408         }
57409         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
57410         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
57411         return tag_ptr(ret_conv, true);
57412 }
57413
57414 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) {
57415         LDKNetworkGraph this_arg_conv;
57416         this_arg_conv.inner = untag_ptr(this_arg);
57417         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57419         this_arg_conv.is_owned = false;
57420         LDKChannelAnnouncement msg_conv;
57421         msg_conv.inner = untag_ptr(msg);
57422         msg_conv.is_owned = ptr_is_owned(msg);
57423         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
57424         msg_conv.is_owned = false;
57425         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
57426         *ret_conv = NetworkGraph_update_channel_from_announcement_no_lookup(&this_arg_conv, &msg_conv);
57427         return tag_ptr(ret_conv, true);
57428 }
57429
57430 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) {
57431         LDKNetworkGraph this_arg_conv;
57432         this_arg_conv.inner = untag_ptr(this_arg);
57433         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57435         this_arg_conv.is_owned = false;
57436         LDKUnsignedChannelAnnouncement msg_conv;
57437         msg_conv.inner = untag_ptr(msg);
57438         msg_conv.is_owned = ptr_is_owned(msg);
57439         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
57440         msg_conv.is_owned = false;
57441         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
57442         CHECK_ACCESS(utxo_lookup_ptr);
57443         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
57444         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
57445         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
57446                 // Manually implement clone for Java trait instances
57447                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
57448                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57449                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
57450                 }
57451         }
57452         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
57453         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
57454         return tag_ptr(ret_conv, true);
57455 }
57456
57457 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) {
57458         LDKNetworkGraph this_arg_conv;
57459         this_arg_conv.inner = untag_ptr(this_arg);
57460         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57462         this_arg_conv.is_owned = false;
57463         LDKChannelFeatures features_conv;
57464         features_conv.inner = untag_ptr(features);
57465         features_conv.is_owned = ptr_is_owned(features);
57466         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
57467         features_conv = ChannelFeatures_clone(&features_conv);
57468         LDKPublicKey node_id_1_ref;
57469         CHECK(node_id_1->arr_len == 33);
57470         memcpy(node_id_1_ref.compressed_form, node_id_1->elems, 33); FREE(node_id_1);
57471         LDKPublicKey node_id_2_ref;
57472         CHECK(node_id_2->arr_len == 33);
57473         memcpy(node_id_2_ref.compressed_form, node_id_2->elems, 33); FREE(node_id_2);
57474         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
57475         *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);
57476         return tag_ptr(ret_conv, true);
57477 }
57478
57479 void  __attribute__((export_name("TS_NetworkGraph_channel_failed_permanent"))) TS_NetworkGraph_channel_failed_permanent(uint64_t this_arg, int64_t short_channel_id) {
57480         LDKNetworkGraph this_arg_conv;
57481         this_arg_conv.inner = untag_ptr(this_arg);
57482         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57484         this_arg_conv.is_owned = false;
57485         NetworkGraph_channel_failed_permanent(&this_arg_conv, short_channel_id);
57486 }
57487
57488 void  __attribute__((export_name("TS_NetworkGraph_node_failed_permanent"))) TS_NetworkGraph_node_failed_permanent(uint64_t this_arg, int8_tArray node_id) {
57489         LDKNetworkGraph this_arg_conv;
57490         this_arg_conv.inner = untag_ptr(this_arg);
57491         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57493         this_arg_conv.is_owned = false;
57494         LDKPublicKey node_id_ref;
57495         CHECK(node_id->arr_len == 33);
57496         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
57497         NetworkGraph_node_failed_permanent(&this_arg_conv, node_id_ref);
57498 }
57499
57500 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) {
57501         LDKNetworkGraph this_arg_conv;
57502         this_arg_conv.inner = untag_ptr(this_arg);
57503         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57505         this_arg_conv.is_owned = false;
57506         NetworkGraph_remove_stale_channels_and_tracking_with_time(&this_arg_conv, current_time_unix);
57507 }
57508
57509 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel"))) TS_NetworkGraph_update_channel(uint64_t this_arg, uint64_t msg) {
57510         LDKNetworkGraph this_arg_conv;
57511         this_arg_conv.inner = untag_ptr(this_arg);
57512         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57514         this_arg_conv.is_owned = false;
57515         LDKChannelUpdate msg_conv;
57516         msg_conv.inner = untag_ptr(msg);
57517         msg_conv.is_owned = ptr_is_owned(msg);
57518         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
57519         msg_conv.is_owned = false;
57520         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
57521         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
57522         return tag_ptr(ret_conv, true);
57523 }
57524
57525 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel_unsigned"))) TS_NetworkGraph_update_channel_unsigned(uint64_t this_arg, uint64_t msg) {
57526         LDKNetworkGraph this_arg_conv;
57527         this_arg_conv.inner = untag_ptr(this_arg);
57528         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57530         this_arg_conv.is_owned = false;
57531         LDKUnsignedChannelUpdate msg_conv;
57532         msg_conv.inner = untag_ptr(msg);
57533         msg_conv.is_owned = ptr_is_owned(msg);
57534         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
57535         msg_conv.is_owned = false;
57536         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
57537         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
57538         return tag_ptr(ret_conv, true);
57539 }
57540
57541 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_channel"))) TS_ReadOnlyNetworkGraph_channel(uint64_t this_arg, int64_t short_channel_id) {
57542         LDKReadOnlyNetworkGraph this_arg_conv;
57543         this_arg_conv.inner = untag_ptr(this_arg);
57544         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57546         this_arg_conv.is_owned = false;
57547         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
57548         uint64_t ret_ref = 0;
57549         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57550         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57551         return ret_ref;
57552 }
57553
57554 int64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_channels"))) TS_ReadOnlyNetworkGraph_list_channels(uint64_t this_arg) {
57555         LDKReadOnlyNetworkGraph this_arg_conv;
57556         this_arg_conv.inner = untag_ptr(this_arg);
57557         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57559         this_arg_conv.is_owned = false;
57560         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
57561         int64_tArray ret_arr = NULL;
57562         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
57563         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
57564         for (size_t i = 0; i < ret_var.datalen; i++) {
57565                 int64_t ret_conv_8_conv = ret_var.data[i];
57566                 ret_arr_ptr[i] = ret_conv_8_conv;
57567         }
57568         
57569         FREE(ret_var.data);
57570         return ret_arr;
57571 }
57572
57573 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_node"))) TS_ReadOnlyNetworkGraph_node(uint64_t this_arg, uint64_t node_id) {
57574         LDKReadOnlyNetworkGraph this_arg_conv;
57575         this_arg_conv.inner = untag_ptr(this_arg);
57576         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57578         this_arg_conv.is_owned = false;
57579         LDKNodeId node_id_conv;
57580         node_id_conv.inner = untag_ptr(node_id);
57581         node_id_conv.is_owned = ptr_is_owned(node_id);
57582         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
57583         node_id_conv.is_owned = false;
57584         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
57585         uint64_t ret_ref = 0;
57586         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57587         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57588         return ret_ref;
57589 }
57590
57591 uint64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_nodes"))) TS_ReadOnlyNetworkGraph_list_nodes(uint64_t this_arg) {
57592         LDKReadOnlyNetworkGraph this_arg_conv;
57593         this_arg_conv.inner = untag_ptr(this_arg);
57594         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57596         this_arg_conv.is_owned = false;
57597         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
57598         uint64_tArray ret_arr = NULL;
57599         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
57600         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
57601         for (size_t i = 0; i < ret_var.datalen; i++) {
57602                 LDKNodeId ret_conv_8_var = ret_var.data[i];
57603                 uint64_t ret_conv_8_ref = 0;
57604                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
57605                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
57606                 ret_arr_ptr[i] = ret_conv_8_ref;
57607         }
57608         
57609         FREE(ret_var.data);
57610         return ret_arr;
57611 }
57612
57613 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_get_addresses"))) TS_ReadOnlyNetworkGraph_get_addresses(uint64_t this_arg, int8_tArray pubkey) {
57614         LDKReadOnlyNetworkGraph this_arg_conv;
57615         this_arg_conv.inner = untag_ptr(this_arg);
57616         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57618         this_arg_conv.is_owned = false;
57619         LDKPublicKey pubkey_ref;
57620         CHECK(pubkey->arr_len == 33);
57621         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
57622         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
57623         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
57624         uint64_t ret_ref = tag_ptr(ret_copy, true);
57625         return ret_ref;
57626 }
57627
57628 void  __attribute__((export_name("TS_DefaultRouter_free"))) TS_DefaultRouter_free(uint64_t this_obj) {
57629         LDKDefaultRouter this_obj_conv;
57630         this_obj_conv.inner = untag_ptr(this_obj);
57631         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57633         DefaultRouter_free(this_obj_conv);
57634 }
57635
57636 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) {
57637         LDKNetworkGraph network_graph_conv;
57638         network_graph_conv.inner = untag_ptr(network_graph);
57639         network_graph_conv.is_owned = ptr_is_owned(network_graph);
57640         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
57641         network_graph_conv.is_owned = false;
57642         void* logger_ptr = untag_ptr(logger);
57643         CHECK_ACCESS(logger_ptr);
57644         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
57645         if (logger_conv.free == LDKLogger_JCalls_free) {
57646                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57647                 LDKLogger_JCalls_cloned(&logger_conv);
57648         }
57649         LDKThirtyTwoBytes random_seed_bytes_ref;
57650         CHECK(random_seed_bytes->arr_len == 32);
57651         memcpy(random_seed_bytes_ref.data, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
57652         void* scorer_ptr = untag_ptr(scorer);
57653         CHECK_ACCESS(scorer_ptr);
57654         LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr);
57655         if (scorer_conv.free == LDKLockableScore_JCalls_free) {
57656                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57657                 LDKLockableScore_JCalls_cloned(&scorer_conv);
57658         }
57659         LDKProbabilisticScoringFeeParameters score_params_conv;
57660         score_params_conv.inner = untag_ptr(score_params);
57661         score_params_conv.is_owned = ptr_is_owned(score_params);
57662         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
57663         score_params_conv = ProbabilisticScoringFeeParameters_clone(&score_params_conv);
57664         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref, scorer_conv, score_params_conv);
57665         uint64_t ret_ref = 0;
57666         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57667         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57668         return ret_ref;
57669 }
57670
57671 uint64_t  __attribute__((export_name("TS_DefaultRouter_as_Router"))) TS_DefaultRouter_as_Router(uint64_t this_arg) {
57672         LDKDefaultRouter this_arg_conv;
57673         this_arg_conv.inner = untag_ptr(this_arg);
57674         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57676         this_arg_conv.is_owned = false;
57677         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
57678         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
57679         return tag_ptr(ret_ret, true);
57680 }
57681
57682 void  __attribute__((export_name("TS_Router_free"))) TS_Router_free(uint64_t this_ptr) {
57683         if (!ptr_is_owned(this_ptr)) return;
57684         void* this_ptr_ptr = untag_ptr(this_ptr);
57685         CHECK_ACCESS(this_ptr_ptr);
57686         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
57687         FREE(untag_ptr(this_ptr));
57688         Router_free(this_ptr_conv);
57689 }
57690
57691 void  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_free"))) TS_ScorerAccountingForInFlightHtlcs_free(uint64_t this_obj) {
57692         LDKScorerAccountingForInFlightHtlcs this_obj_conv;
57693         this_obj_conv.inner = untag_ptr(this_obj);
57694         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57696         ScorerAccountingForInFlightHtlcs_free(this_obj_conv);
57697 }
57698
57699 uint64_t  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_new"))) TS_ScorerAccountingForInFlightHtlcs_new(uint64_t scorer, uint64_t inflight_htlcs) {
57700         void* scorer_ptr = untag_ptr(scorer);
57701         CHECK_ACCESS(scorer_ptr);
57702         LDKScoreLookUp scorer_conv = *(LDKScoreLookUp*)(scorer_ptr);
57703         if (scorer_conv.free == LDKScoreLookUp_JCalls_free) {
57704                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57705                 LDKScoreLookUp_JCalls_cloned(&scorer_conv);
57706         }
57707         LDKInFlightHtlcs inflight_htlcs_conv;
57708         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
57709         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
57710         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
57711         inflight_htlcs_conv.is_owned = false;
57712         LDKScorerAccountingForInFlightHtlcs ret_var = ScorerAccountingForInFlightHtlcs_new(scorer_conv, &inflight_htlcs_conv);
57713         uint64_t ret_ref = 0;
57714         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57715         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57716         return ret_ref;
57717 }
57718
57719 uint64_t  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_as_ScoreLookUp"))) TS_ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(uint64_t this_arg) {
57720         LDKScorerAccountingForInFlightHtlcs this_arg_conv;
57721         this_arg_conv.inner = untag_ptr(this_arg);
57722         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57724         this_arg_conv.is_owned = false;
57725         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
57726         *ret_ret = ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(&this_arg_conv);
57727         return tag_ptr(ret_ret, true);
57728 }
57729
57730 void  __attribute__((export_name("TS_InFlightHtlcs_free"))) TS_InFlightHtlcs_free(uint64_t this_obj) {
57731         LDKInFlightHtlcs this_obj_conv;
57732         this_obj_conv.inner = untag_ptr(this_obj);
57733         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57735         InFlightHtlcs_free(this_obj_conv);
57736 }
57737
57738 static inline uint64_t InFlightHtlcs_clone_ptr(LDKInFlightHtlcs *NONNULL_PTR arg) {
57739         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(arg);
57740         uint64_t ret_ref = 0;
57741         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57742         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57743         return ret_ref;
57744 }
57745 int64_t  __attribute__((export_name("TS_InFlightHtlcs_clone_ptr"))) TS_InFlightHtlcs_clone_ptr(uint64_t arg) {
57746         LDKInFlightHtlcs arg_conv;
57747         arg_conv.inner = untag_ptr(arg);
57748         arg_conv.is_owned = ptr_is_owned(arg);
57749         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57750         arg_conv.is_owned = false;
57751         int64_t ret_conv = InFlightHtlcs_clone_ptr(&arg_conv);
57752         return ret_conv;
57753 }
57754
57755 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_clone"))) TS_InFlightHtlcs_clone(uint64_t orig) {
57756         LDKInFlightHtlcs orig_conv;
57757         orig_conv.inner = untag_ptr(orig);
57758         orig_conv.is_owned = ptr_is_owned(orig);
57759         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57760         orig_conv.is_owned = false;
57761         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(&orig_conv);
57762         uint64_t ret_ref = 0;
57763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57765         return ret_ref;
57766 }
57767
57768 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_new"))) TS_InFlightHtlcs_new() {
57769         LDKInFlightHtlcs ret_var = InFlightHtlcs_new();
57770         uint64_t ret_ref = 0;
57771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57773         return ret_ref;
57774 }
57775
57776 void  __attribute__((export_name("TS_InFlightHtlcs_process_path"))) TS_InFlightHtlcs_process_path(uint64_t this_arg, uint64_t path, int8_tArray payer_node_id) {
57777         LDKInFlightHtlcs this_arg_conv;
57778         this_arg_conv.inner = untag_ptr(this_arg);
57779         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57781         this_arg_conv.is_owned = false;
57782         LDKPath path_conv;
57783         path_conv.inner = untag_ptr(path);
57784         path_conv.is_owned = ptr_is_owned(path);
57785         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
57786         path_conv.is_owned = false;
57787         LDKPublicKey payer_node_id_ref;
57788         CHECK(payer_node_id->arr_len == 33);
57789         memcpy(payer_node_id_ref.compressed_form, payer_node_id->elems, 33); FREE(payer_node_id);
57790         InFlightHtlcs_process_path(&this_arg_conv, &path_conv, payer_node_id_ref);
57791 }
57792
57793 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) {
57794         LDKInFlightHtlcs this_arg_conv;
57795         this_arg_conv.inner = untag_ptr(this_arg);
57796         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57798         this_arg_conv.is_owned = false;
57799         LDKNodeId source_conv;
57800         source_conv.inner = untag_ptr(source);
57801         source_conv.is_owned = ptr_is_owned(source);
57802         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
57803         source_conv.is_owned = false;
57804         LDKNodeId target_conv;
57805         target_conv.inner = untag_ptr(target);
57806         target_conv.is_owned = ptr_is_owned(target);
57807         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
57808         target_conv.is_owned = false;
57809         InFlightHtlcs_add_inflight_htlc(&this_arg_conv, &source_conv, &target_conv, channel_scid, used_msat);
57810 }
57811
57812 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) {
57813         LDKInFlightHtlcs this_arg_conv;
57814         this_arg_conv.inner = untag_ptr(this_arg);
57815         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57817         this_arg_conv.is_owned = false;
57818         LDKNodeId source_conv;
57819         source_conv.inner = untag_ptr(source);
57820         source_conv.is_owned = ptr_is_owned(source);
57821         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
57822         source_conv.is_owned = false;
57823         LDKNodeId target_conv;
57824         target_conv.inner = untag_ptr(target);
57825         target_conv.is_owned = ptr_is_owned(target);
57826         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
57827         target_conv.is_owned = false;
57828         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
57829         *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid);
57830         uint64_t ret_ref = tag_ptr(ret_copy, true);
57831         return ret_ref;
57832 }
57833
57834 int8_tArray  __attribute__((export_name("TS_InFlightHtlcs_write"))) TS_InFlightHtlcs_write(uint64_t obj) {
57835         LDKInFlightHtlcs obj_conv;
57836         obj_conv.inner = untag_ptr(obj);
57837         obj_conv.is_owned = ptr_is_owned(obj);
57838         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57839         obj_conv.is_owned = false;
57840         LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv);
57841         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57842         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57843         CVec_u8Z_free(ret_var);
57844         return ret_arr;
57845 }
57846
57847 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_read"))) TS_InFlightHtlcs_read(int8_tArray ser) {
57848         LDKu8slice ser_ref;
57849         ser_ref.datalen = ser->arr_len;
57850         ser_ref.data = ser->elems;
57851         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
57852         *ret_conv = InFlightHtlcs_read(ser_ref);
57853         FREE(ser);
57854         return tag_ptr(ret_conv, true);
57855 }
57856
57857 void  __attribute__((export_name("TS_RouteHop_free"))) TS_RouteHop_free(uint64_t this_obj) {
57858         LDKRouteHop this_obj_conv;
57859         this_obj_conv.inner = untag_ptr(this_obj);
57860         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57862         RouteHop_free(this_obj_conv);
57863 }
57864
57865 int8_tArray  __attribute__((export_name("TS_RouteHop_get_pubkey"))) TS_RouteHop_get_pubkey(uint64_t this_ptr) {
57866         LDKRouteHop this_ptr_conv;
57867         this_ptr_conv.inner = untag_ptr(this_ptr);
57868         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57870         this_ptr_conv.is_owned = false;
57871         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
57872         memcpy(ret_arr->elems, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
57873         return ret_arr;
57874 }
57875
57876 void  __attribute__((export_name("TS_RouteHop_set_pubkey"))) TS_RouteHop_set_pubkey(uint64_t this_ptr, int8_tArray val) {
57877         LDKRouteHop this_ptr_conv;
57878         this_ptr_conv.inner = untag_ptr(this_ptr);
57879         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57881         this_ptr_conv.is_owned = false;
57882         LDKPublicKey val_ref;
57883         CHECK(val->arr_len == 33);
57884         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
57885         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
57886 }
57887
57888 uint64_t  __attribute__((export_name("TS_RouteHop_get_node_features"))) TS_RouteHop_get_node_features(uint64_t this_ptr) {
57889         LDKRouteHop this_ptr_conv;
57890         this_ptr_conv.inner = untag_ptr(this_ptr);
57891         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57893         this_ptr_conv.is_owned = false;
57894         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
57895         uint64_t ret_ref = 0;
57896         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57897         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57898         return ret_ref;
57899 }
57900
57901 void  __attribute__((export_name("TS_RouteHop_set_node_features"))) TS_RouteHop_set_node_features(uint64_t this_ptr, uint64_t val) {
57902         LDKRouteHop this_ptr_conv;
57903         this_ptr_conv.inner = untag_ptr(this_ptr);
57904         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57906         this_ptr_conv.is_owned = false;
57907         LDKNodeFeatures val_conv;
57908         val_conv.inner = untag_ptr(val);
57909         val_conv.is_owned = ptr_is_owned(val);
57910         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57911         val_conv = NodeFeatures_clone(&val_conv);
57912         RouteHop_set_node_features(&this_ptr_conv, val_conv);
57913 }
57914
57915 int64_t  __attribute__((export_name("TS_RouteHop_get_short_channel_id"))) TS_RouteHop_get_short_channel_id(uint64_t this_ptr) {
57916         LDKRouteHop this_ptr_conv;
57917         this_ptr_conv.inner = untag_ptr(this_ptr);
57918         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57920         this_ptr_conv.is_owned = false;
57921         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
57922         return ret_conv;
57923 }
57924
57925 void  __attribute__((export_name("TS_RouteHop_set_short_channel_id"))) TS_RouteHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
57926         LDKRouteHop this_ptr_conv;
57927         this_ptr_conv.inner = untag_ptr(this_ptr);
57928         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57930         this_ptr_conv.is_owned = false;
57931         RouteHop_set_short_channel_id(&this_ptr_conv, val);
57932 }
57933
57934 uint64_t  __attribute__((export_name("TS_RouteHop_get_channel_features"))) TS_RouteHop_get_channel_features(uint64_t this_ptr) {
57935         LDKRouteHop this_ptr_conv;
57936         this_ptr_conv.inner = untag_ptr(this_ptr);
57937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57939         this_ptr_conv.is_owned = false;
57940         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
57941         uint64_t ret_ref = 0;
57942         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57943         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57944         return ret_ref;
57945 }
57946
57947 void  __attribute__((export_name("TS_RouteHop_set_channel_features"))) TS_RouteHop_set_channel_features(uint64_t this_ptr, uint64_t val) {
57948         LDKRouteHop this_ptr_conv;
57949         this_ptr_conv.inner = untag_ptr(this_ptr);
57950         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57952         this_ptr_conv.is_owned = false;
57953         LDKChannelFeatures val_conv;
57954         val_conv.inner = untag_ptr(val);
57955         val_conv.is_owned = ptr_is_owned(val);
57956         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57957         val_conv = ChannelFeatures_clone(&val_conv);
57958         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
57959 }
57960
57961 int64_t  __attribute__((export_name("TS_RouteHop_get_fee_msat"))) TS_RouteHop_get_fee_msat(uint64_t this_ptr) {
57962         LDKRouteHop this_ptr_conv;
57963         this_ptr_conv.inner = untag_ptr(this_ptr);
57964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57966         this_ptr_conv.is_owned = false;
57967         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
57968         return ret_conv;
57969 }
57970
57971 void  __attribute__((export_name("TS_RouteHop_set_fee_msat"))) TS_RouteHop_set_fee_msat(uint64_t this_ptr, int64_t val) {
57972         LDKRouteHop this_ptr_conv;
57973         this_ptr_conv.inner = untag_ptr(this_ptr);
57974         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57976         this_ptr_conv.is_owned = false;
57977         RouteHop_set_fee_msat(&this_ptr_conv, val);
57978 }
57979
57980 int32_t  __attribute__((export_name("TS_RouteHop_get_cltv_expiry_delta"))) TS_RouteHop_get_cltv_expiry_delta(uint64_t this_ptr) {
57981         LDKRouteHop this_ptr_conv;
57982         this_ptr_conv.inner = untag_ptr(this_ptr);
57983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57985         this_ptr_conv.is_owned = false;
57986         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
57987         return ret_conv;
57988 }
57989
57990 void  __attribute__((export_name("TS_RouteHop_set_cltv_expiry_delta"))) TS_RouteHop_set_cltv_expiry_delta(uint64_t this_ptr, int32_t val) {
57991         LDKRouteHop this_ptr_conv;
57992         this_ptr_conv.inner = untag_ptr(this_ptr);
57993         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57995         this_ptr_conv.is_owned = false;
57996         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
57997 }
57998
57999 jboolean  __attribute__((export_name("TS_RouteHop_get_maybe_announced_channel"))) TS_RouteHop_get_maybe_announced_channel(uint64_t this_ptr) {
58000         LDKRouteHop this_ptr_conv;
58001         this_ptr_conv.inner = untag_ptr(this_ptr);
58002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58004         this_ptr_conv.is_owned = false;
58005         jboolean ret_conv = RouteHop_get_maybe_announced_channel(&this_ptr_conv);
58006         return ret_conv;
58007 }
58008
58009 void  __attribute__((export_name("TS_RouteHop_set_maybe_announced_channel"))) TS_RouteHop_set_maybe_announced_channel(uint64_t this_ptr, jboolean val) {
58010         LDKRouteHop this_ptr_conv;
58011         this_ptr_conv.inner = untag_ptr(this_ptr);
58012         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58014         this_ptr_conv.is_owned = false;
58015         RouteHop_set_maybe_announced_channel(&this_ptr_conv, val);
58016 }
58017
58018 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) {
58019         LDKPublicKey pubkey_arg_ref;
58020         CHECK(pubkey_arg->arr_len == 33);
58021         memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33); FREE(pubkey_arg);
58022         LDKNodeFeatures node_features_arg_conv;
58023         node_features_arg_conv.inner = untag_ptr(node_features_arg);
58024         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
58025         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
58026         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
58027         LDKChannelFeatures channel_features_arg_conv;
58028         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
58029         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
58030         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
58031         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
58032         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);
58033         uint64_t ret_ref = 0;
58034         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58035         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58036         return ret_ref;
58037 }
58038
58039 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
58040         LDKRouteHop ret_var = RouteHop_clone(arg);
58041         uint64_t ret_ref = 0;
58042         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58043         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58044         return ret_ref;
58045 }
58046 int64_t  __attribute__((export_name("TS_RouteHop_clone_ptr"))) TS_RouteHop_clone_ptr(uint64_t arg) {
58047         LDKRouteHop arg_conv;
58048         arg_conv.inner = untag_ptr(arg);
58049         arg_conv.is_owned = ptr_is_owned(arg);
58050         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58051         arg_conv.is_owned = false;
58052         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
58053         return ret_conv;
58054 }
58055
58056 uint64_t  __attribute__((export_name("TS_RouteHop_clone"))) TS_RouteHop_clone(uint64_t orig) {
58057         LDKRouteHop orig_conv;
58058         orig_conv.inner = untag_ptr(orig);
58059         orig_conv.is_owned = ptr_is_owned(orig);
58060         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58061         orig_conv.is_owned = false;
58062         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
58063         uint64_t ret_ref = 0;
58064         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58065         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58066         return ret_ref;
58067 }
58068
58069 int64_t  __attribute__((export_name("TS_RouteHop_hash"))) TS_RouteHop_hash(uint64_t o) {
58070         LDKRouteHop o_conv;
58071         o_conv.inner = untag_ptr(o);
58072         o_conv.is_owned = ptr_is_owned(o);
58073         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58074         o_conv.is_owned = false;
58075         int64_t ret_conv = RouteHop_hash(&o_conv);
58076         return ret_conv;
58077 }
58078
58079 jboolean  __attribute__((export_name("TS_RouteHop_eq"))) TS_RouteHop_eq(uint64_t a, uint64_t b) {
58080         LDKRouteHop a_conv;
58081         a_conv.inner = untag_ptr(a);
58082         a_conv.is_owned = ptr_is_owned(a);
58083         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58084         a_conv.is_owned = false;
58085         LDKRouteHop b_conv;
58086         b_conv.inner = untag_ptr(b);
58087         b_conv.is_owned = ptr_is_owned(b);
58088         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58089         b_conv.is_owned = false;
58090         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
58091         return ret_conv;
58092 }
58093
58094 int8_tArray  __attribute__((export_name("TS_RouteHop_write"))) TS_RouteHop_write(uint64_t obj) {
58095         LDKRouteHop obj_conv;
58096         obj_conv.inner = untag_ptr(obj);
58097         obj_conv.is_owned = ptr_is_owned(obj);
58098         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58099         obj_conv.is_owned = false;
58100         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
58101         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58102         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58103         CVec_u8Z_free(ret_var);
58104         return ret_arr;
58105 }
58106
58107 uint64_t  __attribute__((export_name("TS_RouteHop_read"))) TS_RouteHop_read(int8_tArray ser) {
58108         LDKu8slice ser_ref;
58109         ser_ref.datalen = ser->arr_len;
58110         ser_ref.data = ser->elems;
58111         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
58112         *ret_conv = RouteHop_read(ser_ref);
58113         FREE(ser);
58114         return tag_ptr(ret_conv, true);
58115 }
58116
58117 void  __attribute__((export_name("TS_BlindedTail_free"))) TS_BlindedTail_free(uint64_t this_obj) {
58118         LDKBlindedTail this_obj_conv;
58119         this_obj_conv.inner = untag_ptr(this_obj);
58120         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58122         BlindedTail_free(this_obj_conv);
58123 }
58124
58125 uint64_tArray  __attribute__((export_name("TS_BlindedTail_get_hops"))) TS_BlindedTail_get_hops(uint64_t this_ptr) {
58126         LDKBlindedTail this_ptr_conv;
58127         this_ptr_conv.inner = untag_ptr(this_ptr);
58128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58130         this_ptr_conv.is_owned = false;
58131         LDKCVec_BlindedHopZ ret_var = BlindedTail_get_hops(&this_ptr_conv);
58132         uint64_tArray ret_arr = NULL;
58133         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
58134         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
58135         for (size_t m = 0; m < ret_var.datalen; m++) {
58136                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
58137                 uint64_t ret_conv_12_ref = 0;
58138                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
58139                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
58140                 ret_arr_ptr[m] = ret_conv_12_ref;
58141         }
58142         
58143         FREE(ret_var.data);
58144         return ret_arr;
58145 }
58146
58147 void  __attribute__((export_name("TS_BlindedTail_set_hops"))) TS_BlindedTail_set_hops(uint64_t this_ptr, uint64_tArray val) {
58148         LDKBlindedTail this_ptr_conv;
58149         this_ptr_conv.inner = untag_ptr(this_ptr);
58150         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58152         this_ptr_conv.is_owned = false;
58153         LDKCVec_BlindedHopZ val_constr;
58154         val_constr.datalen = val->arr_len;
58155         if (val_constr.datalen > 0)
58156                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
58157         else
58158                 val_constr.data = NULL;
58159         uint64_t* val_vals = val->elems;
58160         for (size_t m = 0; m < val_constr.datalen; m++) {
58161                 uint64_t val_conv_12 = val_vals[m];
58162                 LDKBlindedHop val_conv_12_conv;
58163                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
58164                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
58165                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
58166                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
58167                 val_constr.data[m] = val_conv_12_conv;
58168         }
58169         FREE(val);
58170         BlindedTail_set_hops(&this_ptr_conv, val_constr);
58171 }
58172
58173 int8_tArray  __attribute__((export_name("TS_BlindedTail_get_blinding_point"))) TS_BlindedTail_get_blinding_point(uint64_t this_ptr) {
58174         LDKBlindedTail this_ptr_conv;
58175         this_ptr_conv.inner = untag_ptr(this_ptr);
58176         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58178         this_ptr_conv.is_owned = false;
58179         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
58180         memcpy(ret_arr->elems, BlindedTail_get_blinding_point(&this_ptr_conv).compressed_form, 33);
58181         return ret_arr;
58182 }
58183
58184 void  __attribute__((export_name("TS_BlindedTail_set_blinding_point"))) TS_BlindedTail_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
58185         LDKBlindedTail this_ptr_conv;
58186         this_ptr_conv.inner = untag_ptr(this_ptr);
58187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58189         this_ptr_conv.is_owned = false;
58190         LDKPublicKey val_ref;
58191         CHECK(val->arr_len == 33);
58192         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
58193         BlindedTail_set_blinding_point(&this_ptr_conv, val_ref);
58194 }
58195
58196 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) {
58197         LDKBlindedTail this_ptr_conv;
58198         this_ptr_conv.inner = untag_ptr(this_ptr);
58199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58201         this_ptr_conv.is_owned = false;
58202         int32_t ret_conv = BlindedTail_get_excess_final_cltv_expiry_delta(&this_ptr_conv);
58203         return ret_conv;
58204 }
58205
58206 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) {
58207         LDKBlindedTail this_ptr_conv;
58208         this_ptr_conv.inner = untag_ptr(this_ptr);
58209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58211         this_ptr_conv.is_owned = false;
58212         BlindedTail_set_excess_final_cltv_expiry_delta(&this_ptr_conv, val);
58213 }
58214
58215 int64_t  __attribute__((export_name("TS_BlindedTail_get_final_value_msat"))) TS_BlindedTail_get_final_value_msat(uint64_t this_ptr) {
58216         LDKBlindedTail this_ptr_conv;
58217         this_ptr_conv.inner = untag_ptr(this_ptr);
58218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58220         this_ptr_conv.is_owned = false;
58221         int64_t ret_conv = BlindedTail_get_final_value_msat(&this_ptr_conv);
58222         return ret_conv;
58223 }
58224
58225 void  __attribute__((export_name("TS_BlindedTail_set_final_value_msat"))) TS_BlindedTail_set_final_value_msat(uint64_t this_ptr, int64_t val) {
58226         LDKBlindedTail this_ptr_conv;
58227         this_ptr_conv.inner = untag_ptr(this_ptr);
58228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58230         this_ptr_conv.is_owned = false;
58231         BlindedTail_set_final_value_msat(&this_ptr_conv, val);
58232 }
58233
58234 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) {
58235         LDKCVec_BlindedHopZ hops_arg_constr;
58236         hops_arg_constr.datalen = hops_arg->arr_len;
58237         if (hops_arg_constr.datalen > 0)
58238                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
58239         else
58240                 hops_arg_constr.data = NULL;
58241         uint64_t* hops_arg_vals = hops_arg->elems;
58242         for (size_t m = 0; m < hops_arg_constr.datalen; m++) {
58243                 uint64_t hops_arg_conv_12 = hops_arg_vals[m];
58244                 LDKBlindedHop hops_arg_conv_12_conv;
58245                 hops_arg_conv_12_conv.inner = untag_ptr(hops_arg_conv_12);
58246                 hops_arg_conv_12_conv.is_owned = ptr_is_owned(hops_arg_conv_12);
58247                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_12_conv);
58248                 hops_arg_conv_12_conv = BlindedHop_clone(&hops_arg_conv_12_conv);
58249                 hops_arg_constr.data[m] = hops_arg_conv_12_conv;
58250         }
58251         FREE(hops_arg);
58252         LDKPublicKey blinding_point_arg_ref;
58253         CHECK(blinding_point_arg->arr_len == 33);
58254         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
58255         LDKBlindedTail ret_var = BlindedTail_new(hops_arg_constr, blinding_point_arg_ref, excess_final_cltv_expiry_delta_arg, final_value_msat_arg);
58256         uint64_t ret_ref = 0;
58257         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58258         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58259         return ret_ref;
58260 }
58261
58262 static inline uint64_t BlindedTail_clone_ptr(LDKBlindedTail *NONNULL_PTR arg) {
58263         LDKBlindedTail ret_var = BlindedTail_clone(arg);
58264         uint64_t ret_ref = 0;
58265         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58266         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58267         return ret_ref;
58268 }
58269 int64_t  __attribute__((export_name("TS_BlindedTail_clone_ptr"))) TS_BlindedTail_clone_ptr(uint64_t arg) {
58270         LDKBlindedTail arg_conv;
58271         arg_conv.inner = untag_ptr(arg);
58272         arg_conv.is_owned = ptr_is_owned(arg);
58273         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58274         arg_conv.is_owned = false;
58275         int64_t ret_conv = BlindedTail_clone_ptr(&arg_conv);
58276         return ret_conv;
58277 }
58278
58279 uint64_t  __attribute__((export_name("TS_BlindedTail_clone"))) TS_BlindedTail_clone(uint64_t orig) {
58280         LDKBlindedTail orig_conv;
58281         orig_conv.inner = untag_ptr(orig);
58282         orig_conv.is_owned = ptr_is_owned(orig);
58283         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58284         orig_conv.is_owned = false;
58285         LDKBlindedTail ret_var = BlindedTail_clone(&orig_conv);
58286         uint64_t ret_ref = 0;
58287         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58288         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58289         return ret_ref;
58290 }
58291
58292 int64_t  __attribute__((export_name("TS_BlindedTail_hash"))) TS_BlindedTail_hash(uint64_t o) {
58293         LDKBlindedTail o_conv;
58294         o_conv.inner = untag_ptr(o);
58295         o_conv.is_owned = ptr_is_owned(o);
58296         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58297         o_conv.is_owned = false;
58298         int64_t ret_conv = BlindedTail_hash(&o_conv);
58299         return ret_conv;
58300 }
58301
58302 jboolean  __attribute__((export_name("TS_BlindedTail_eq"))) TS_BlindedTail_eq(uint64_t a, uint64_t b) {
58303         LDKBlindedTail a_conv;
58304         a_conv.inner = untag_ptr(a);
58305         a_conv.is_owned = ptr_is_owned(a);
58306         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58307         a_conv.is_owned = false;
58308         LDKBlindedTail b_conv;
58309         b_conv.inner = untag_ptr(b);
58310         b_conv.is_owned = ptr_is_owned(b);
58311         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58312         b_conv.is_owned = false;
58313         jboolean ret_conv = BlindedTail_eq(&a_conv, &b_conv);
58314         return ret_conv;
58315 }
58316
58317 int8_tArray  __attribute__((export_name("TS_BlindedTail_write"))) TS_BlindedTail_write(uint64_t obj) {
58318         LDKBlindedTail obj_conv;
58319         obj_conv.inner = untag_ptr(obj);
58320         obj_conv.is_owned = ptr_is_owned(obj);
58321         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58322         obj_conv.is_owned = false;
58323         LDKCVec_u8Z ret_var = BlindedTail_write(&obj_conv);
58324         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58325         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58326         CVec_u8Z_free(ret_var);
58327         return ret_arr;
58328 }
58329
58330 uint64_t  __attribute__((export_name("TS_BlindedTail_read"))) TS_BlindedTail_read(int8_tArray ser) {
58331         LDKu8slice ser_ref;
58332         ser_ref.datalen = ser->arr_len;
58333         ser_ref.data = ser->elems;
58334         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
58335         *ret_conv = BlindedTail_read(ser_ref);
58336         FREE(ser);
58337         return tag_ptr(ret_conv, true);
58338 }
58339
58340 void  __attribute__((export_name("TS_Path_free"))) TS_Path_free(uint64_t this_obj) {
58341         LDKPath this_obj_conv;
58342         this_obj_conv.inner = untag_ptr(this_obj);
58343         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58345         Path_free(this_obj_conv);
58346 }
58347
58348 uint64_tArray  __attribute__((export_name("TS_Path_get_hops"))) TS_Path_get_hops(uint64_t this_ptr) {
58349         LDKPath this_ptr_conv;
58350         this_ptr_conv.inner = untag_ptr(this_ptr);
58351         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58353         this_ptr_conv.is_owned = false;
58354         LDKCVec_RouteHopZ ret_var = Path_get_hops(&this_ptr_conv);
58355         uint64_tArray ret_arr = NULL;
58356         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
58357         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
58358         for (size_t k = 0; k < ret_var.datalen; k++) {
58359                 LDKRouteHop ret_conv_10_var = ret_var.data[k];
58360                 uint64_t ret_conv_10_ref = 0;
58361                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
58362                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
58363                 ret_arr_ptr[k] = ret_conv_10_ref;
58364         }
58365         
58366         FREE(ret_var.data);
58367         return ret_arr;
58368 }
58369
58370 void  __attribute__((export_name("TS_Path_set_hops"))) TS_Path_set_hops(uint64_t this_ptr, uint64_tArray val) {
58371         LDKPath this_ptr_conv;
58372         this_ptr_conv.inner = untag_ptr(this_ptr);
58373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58375         this_ptr_conv.is_owned = false;
58376         LDKCVec_RouteHopZ val_constr;
58377         val_constr.datalen = val->arr_len;
58378         if (val_constr.datalen > 0)
58379                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
58380         else
58381                 val_constr.data = NULL;
58382         uint64_t* val_vals = val->elems;
58383         for (size_t k = 0; k < val_constr.datalen; k++) {
58384                 uint64_t val_conv_10 = val_vals[k];
58385                 LDKRouteHop val_conv_10_conv;
58386                 val_conv_10_conv.inner = untag_ptr(val_conv_10);
58387                 val_conv_10_conv.is_owned = ptr_is_owned(val_conv_10);
58388                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_10_conv);
58389                 val_conv_10_conv = RouteHop_clone(&val_conv_10_conv);
58390                 val_constr.data[k] = val_conv_10_conv;
58391         }
58392         FREE(val);
58393         Path_set_hops(&this_ptr_conv, val_constr);
58394 }
58395
58396 uint64_t  __attribute__((export_name("TS_Path_get_blinded_tail"))) TS_Path_get_blinded_tail(uint64_t this_ptr) {
58397         LDKPath this_ptr_conv;
58398         this_ptr_conv.inner = untag_ptr(this_ptr);
58399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58401         this_ptr_conv.is_owned = false;
58402         LDKBlindedTail ret_var = Path_get_blinded_tail(&this_ptr_conv);
58403         uint64_t ret_ref = 0;
58404         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58405         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58406         return ret_ref;
58407 }
58408
58409 void  __attribute__((export_name("TS_Path_set_blinded_tail"))) TS_Path_set_blinded_tail(uint64_t this_ptr, uint64_t val) {
58410         LDKPath this_ptr_conv;
58411         this_ptr_conv.inner = untag_ptr(this_ptr);
58412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58414         this_ptr_conv.is_owned = false;
58415         LDKBlindedTail val_conv;
58416         val_conv.inner = untag_ptr(val);
58417         val_conv.is_owned = ptr_is_owned(val);
58418         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58419         val_conv = BlindedTail_clone(&val_conv);
58420         Path_set_blinded_tail(&this_ptr_conv, val_conv);
58421 }
58422
58423 uint64_t  __attribute__((export_name("TS_Path_new"))) TS_Path_new(uint64_tArray hops_arg, uint64_t blinded_tail_arg) {
58424         LDKCVec_RouteHopZ hops_arg_constr;
58425         hops_arg_constr.datalen = hops_arg->arr_len;
58426         if (hops_arg_constr.datalen > 0)
58427                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
58428         else
58429                 hops_arg_constr.data = NULL;
58430         uint64_t* hops_arg_vals = hops_arg->elems;
58431         for (size_t k = 0; k < hops_arg_constr.datalen; k++) {
58432                 uint64_t hops_arg_conv_10 = hops_arg_vals[k];
58433                 LDKRouteHop hops_arg_conv_10_conv;
58434                 hops_arg_conv_10_conv.inner = untag_ptr(hops_arg_conv_10);
58435                 hops_arg_conv_10_conv.is_owned = ptr_is_owned(hops_arg_conv_10);
58436                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_10_conv);
58437                 hops_arg_conv_10_conv = RouteHop_clone(&hops_arg_conv_10_conv);
58438                 hops_arg_constr.data[k] = hops_arg_conv_10_conv;
58439         }
58440         FREE(hops_arg);
58441         LDKBlindedTail blinded_tail_arg_conv;
58442         blinded_tail_arg_conv.inner = untag_ptr(blinded_tail_arg);
58443         blinded_tail_arg_conv.is_owned = ptr_is_owned(blinded_tail_arg);
58444         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_tail_arg_conv);
58445         blinded_tail_arg_conv = BlindedTail_clone(&blinded_tail_arg_conv);
58446         LDKPath ret_var = Path_new(hops_arg_constr, blinded_tail_arg_conv);
58447         uint64_t ret_ref = 0;
58448         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58449         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58450         return ret_ref;
58451 }
58452
58453 static inline uint64_t Path_clone_ptr(LDKPath *NONNULL_PTR arg) {
58454         LDKPath ret_var = Path_clone(arg);
58455         uint64_t ret_ref = 0;
58456         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58457         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58458         return ret_ref;
58459 }
58460 int64_t  __attribute__((export_name("TS_Path_clone_ptr"))) TS_Path_clone_ptr(uint64_t arg) {
58461         LDKPath arg_conv;
58462         arg_conv.inner = untag_ptr(arg);
58463         arg_conv.is_owned = ptr_is_owned(arg);
58464         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58465         arg_conv.is_owned = false;
58466         int64_t ret_conv = Path_clone_ptr(&arg_conv);
58467         return ret_conv;
58468 }
58469
58470 uint64_t  __attribute__((export_name("TS_Path_clone"))) TS_Path_clone(uint64_t orig) {
58471         LDKPath orig_conv;
58472         orig_conv.inner = untag_ptr(orig);
58473         orig_conv.is_owned = ptr_is_owned(orig);
58474         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58475         orig_conv.is_owned = false;
58476         LDKPath ret_var = Path_clone(&orig_conv);
58477         uint64_t ret_ref = 0;
58478         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58479         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58480         return ret_ref;
58481 }
58482
58483 int64_t  __attribute__((export_name("TS_Path_hash"))) TS_Path_hash(uint64_t o) {
58484         LDKPath o_conv;
58485         o_conv.inner = untag_ptr(o);
58486         o_conv.is_owned = ptr_is_owned(o);
58487         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58488         o_conv.is_owned = false;
58489         int64_t ret_conv = Path_hash(&o_conv);
58490         return ret_conv;
58491 }
58492
58493 jboolean  __attribute__((export_name("TS_Path_eq"))) TS_Path_eq(uint64_t a, uint64_t b) {
58494         LDKPath a_conv;
58495         a_conv.inner = untag_ptr(a);
58496         a_conv.is_owned = ptr_is_owned(a);
58497         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58498         a_conv.is_owned = false;
58499         LDKPath b_conv;
58500         b_conv.inner = untag_ptr(b);
58501         b_conv.is_owned = ptr_is_owned(b);
58502         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58503         b_conv.is_owned = false;
58504         jboolean ret_conv = Path_eq(&a_conv, &b_conv);
58505         return ret_conv;
58506 }
58507
58508 int64_t  __attribute__((export_name("TS_Path_fee_msat"))) TS_Path_fee_msat(uint64_t this_arg) {
58509         LDKPath this_arg_conv;
58510         this_arg_conv.inner = untag_ptr(this_arg);
58511         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58513         this_arg_conv.is_owned = false;
58514         int64_t ret_conv = Path_fee_msat(&this_arg_conv);
58515         return ret_conv;
58516 }
58517
58518 int64_t  __attribute__((export_name("TS_Path_final_value_msat"))) TS_Path_final_value_msat(uint64_t this_arg) {
58519         LDKPath this_arg_conv;
58520         this_arg_conv.inner = untag_ptr(this_arg);
58521         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58523         this_arg_conv.is_owned = false;
58524         int64_t ret_conv = Path_final_value_msat(&this_arg_conv);
58525         return ret_conv;
58526 }
58527
58528 uint64_t  __attribute__((export_name("TS_Path_final_cltv_expiry_delta"))) TS_Path_final_cltv_expiry_delta(uint64_t this_arg) {
58529         LDKPath this_arg_conv;
58530         this_arg_conv.inner = untag_ptr(this_arg);
58531         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58533         this_arg_conv.is_owned = false;
58534         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
58535         *ret_copy = Path_final_cltv_expiry_delta(&this_arg_conv);
58536         uint64_t ret_ref = tag_ptr(ret_copy, true);
58537         return ret_ref;
58538 }
58539
58540 void  __attribute__((export_name("TS_Route_free"))) TS_Route_free(uint64_t this_obj) {
58541         LDKRoute this_obj_conv;
58542         this_obj_conv.inner = untag_ptr(this_obj);
58543         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58545         Route_free(this_obj_conv);
58546 }
58547
58548 uint64_tArray  __attribute__((export_name("TS_Route_get_paths"))) TS_Route_get_paths(uint64_t this_ptr) {
58549         LDKRoute this_ptr_conv;
58550         this_ptr_conv.inner = untag_ptr(this_ptr);
58551         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58553         this_ptr_conv.is_owned = false;
58554         LDKCVec_PathZ ret_var = Route_get_paths(&this_ptr_conv);
58555         uint64_tArray ret_arr = NULL;
58556         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
58557         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
58558         for (size_t g = 0; g < ret_var.datalen; g++) {
58559                 LDKPath ret_conv_6_var = ret_var.data[g];
58560                 uint64_t ret_conv_6_ref = 0;
58561                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
58562                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
58563                 ret_arr_ptr[g] = ret_conv_6_ref;
58564         }
58565         
58566         FREE(ret_var.data);
58567         return ret_arr;
58568 }
58569
58570 void  __attribute__((export_name("TS_Route_set_paths"))) TS_Route_set_paths(uint64_t this_ptr, uint64_tArray val) {
58571         LDKRoute this_ptr_conv;
58572         this_ptr_conv.inner = untag_ptr(this_ptr);
58573         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58575         this_ptr_conv.is_owned = false;
58576         LDKCVec_PathZ val_constr;
58577         val_constr.datalen = val->arr_len;
58578         if (val_constr.datalen > 0)
58579                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
58580         else
58581                 val_constr.data = NULL;
58582         uint64_t* val_vals = val->elems;
58583         for (size_t g = 0; g < val_constr.datalen; g++) {
58584                 uint64_t val_conv_6 = val_vals[g];
58585                 LDKPath val_conv_6_conv;
58586                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
58587                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
58588                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
58589                 val_conv_6_conv = Path_clone(&val_conv_6_conv);
58590                 val_constr.data[g] = val_conv_6_conv;
58591         }
58592         FREE(val);
58593         Route_set_paths(&this_ptr_conv, val_constr);
58594 }
58595
58596 uint64_t  __attribute__((export_name("TS_Route_get_route_params"))) TS_Route_get_route_params(uint64_t this_ptr) {
58597         LDKRoute this_ptr_conv;
58598         this_ptr_conv.inner = untag_ptr(this_ptr);
58599         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58601         this_ptr_conv.is_owned = false;
58602         LDKRouteParameters ret_var = Route_get_route_params(&this_ptr_conv);
58603         uint64_t ret_ref = 0;
58604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58606         return ret_ref;
58607 }
58608
58609 void  __attribute__((export_name("TS_Route_set_route_params"))) TS_Route_set_route_params(uint64_t this_ptr, uint64_t val) {
58610         LDKRoute this_ptr_conv;
58611         this_ptr_conv.inner = untag_ptr(this_ptr);
58612         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58614         this_ptr_conv.is_owned = false;
58615         LDKRouteParameters val_conv;
58616         val_conv.inner = untag_ptr(val);
58617         val_conv.is_owned = ptr_is_owned(val);
58618         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58619         val_conv = RouteParameters_clone(&val_conv);
58620         Route_set_route_params(&this_ptr_conv, val_conv);
58621 }
58622
58623 uint64_t  __attribute__((export_name("TS_Route_new"))) TS_Route_new(uint64_tArray paths_arg, uint64_t route_params_arg) {
58624         LDKCVec_PathZ paths_arg_constr;
58625         paths_arg_constr.datalen = paths_arg->arr_len;
58626         if (paths_arg_constr.datalen > 0)
58627                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
58628         else
58629                 paths_arg_constr.data = NULL;
58630         uint64_t* paths_arg_vals = paths_arg->elems;
58631         for (size_t g = 0; g < paths_arg_constr.datalen; g++) {
58632                 uint64_t paths_arg_conv_6 = paths_arg_vals[g];
58633                 LDKPath paths_arg_conv_6_conv;
58634                 paths_arg_conv_6_conv.inner = untag_ptr(paths_arg_conv_6);
58635                 paths_arg_conv_6_conv.is_owned = ptr_is_owned(paths_arg_conv_6);
58636                 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_6_conv);
58637                 paths_arg_conv_6_conv = Path_clone(&paths_arg_conv_6_conv);
58638                 paths_arg_constr.data[g] = paths_arg_conv_6_conv;
58639         }
58640         FREE(paths_arg);
58641         LDKRouteParameters route_params_arg_conv;
58642         route_params_arg_conv.inner = untag_ptr(route_params_arg);
58643         route_params_arg_conv.is_owned = ptr_is_owned(route_params_arg);
58644         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_arg_conv);
58645         route_params_arg_conv = RouteParameters_clone(&route_params_arg_conv);
58646         LDKRoute ret_var = Route_new(paths_arg_constr, route_params_arg_conv);
58647         uint64_t ret_ref = 0;
58648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58650         return ret_ref;
58651 }
58652
58653 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
58654         LDKRoute ret_var = Route_clone(arg);
58655         uint64_t ret_ref = 0;
58656         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58657         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58658         return ret_ref;
58659 }
58660 int64_t  __attribute__((export_name("TS_Route_clone_ptr"))) TS_Route_clone_ptr(uint64_t arg) {
58661         LDKRoute arg_conv;
58662         arg_conv.inner = untag_ptr(arg);
58663         arg_conv.is_owned = ptr_is_owned(arg);
58664         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58665         arg_conv.is_owned = false;
58666         int64_t ret_conv = Route_clone_ptr(&arg_conv);
58667         return ret_conv;
58668 }
58669
58670 uint64_t  __attribute__((export_name("TS_Route_clone"))) TS_Route_clone(uint64_t orig) {
58671         LDKRoute orig_conv;
58672         orig_conv.inner = untag_ptr(orig);
58673         orig_conv.is_owned = ptr_is_owned(orig);
58674         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58675         orig_conv.is_owned = false;
58676         LDKRoute ret_var = Route_clone(&orig_conv);
58677         uint64_t ret_ref = 0;
58678         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58679         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58680         return ret_ref;
58681 }
58682
58683 int64_t  __attribute__((export_name("TS_Route_hash"))) TS_Route_hash(uint64_t o) {
58684         LDKRoute o_conv;
58685         o_conv.inner = untag_ptr(o);
58686         o_conv.is_owned = ptr_is_owned(o);
58687         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58688         o_conv.is_owned = false;
58689         int64_t ret_conv = Route_hash(&o_conv);
58690         return ret_conv;
58691 }
58692
58693 jboolean  __attribute__((export_name("TS_Route_eq"))) TS_Route_eq(uint64_t a, uint64_t b) {
58694         LDKRoute a_conv;
58695         a_conv.inner = untag_ptr(a);
58696         a_conv.is_owned = ptr_is_owned(a);
58697         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58698         a_conv.is_owned = false;
58699         LDKRoute b_conv;
58700         b_conv.inner = untag_ptr(b);
58701         b_conv.is_owned = ptr_is_owned(b);
58702         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58703         b_conv.is_owned = false;
58704         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
58705         return ret_conv;
58706 }
58707
58708 int64_t  __attribute__((export_name("TS_Route_get_total_fees"))) TS_Route_get_total_fees(uint64_t this_arg) {
58709         LDKRoute this_arg_conv;
58710         this_arg_conv.inner = untag_ptr(this_arg);
58711         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58713         this_arg_conv.is_owned = false;
58714         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
58715         return ret_conv;
58716 }
58717
58718 int64_t  __attribute__((export_name("TS_Route_get_total_amount"))) TS_Route_get_total_amount(uint64_t this_arg) {
58719         LDKRoute this_arg_conv;
58720         this_arg_conv.inner = untag_ptr(this_arg);
58721         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58723         this_arg_conv.is_owned = false;
58724         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
58725         return ret_conv;
58726 }
58727
58728 int8_tArray  __attribute__((export_name("TS_Route_write"))) TS_Route_write(uint64_t obj) {
58729         LDKRoute obj_conv;
58730         obj_conv.inner = untag_ptr(obj);
58731         obj_conv.is_owned = ptr_is_owned(obj);
58732         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58733         obj_conv.is_owned = false;
58734         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
58735         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58736         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58737         CVec_u8Z_free(ret_var);
58738         return ret_arr;
58739 }
58740
58741 uint64_t  __attribute__((export_name("TS_Route_read"))) TS_Route_read(int8_tArray ser) {
58742         LDKu8slice ser_ref;
58743         ser_ref.datalen = ser->arr_len;
58744         ser_ref.data = ser->elems;
58745         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
58746         *ret_conv = Route_read(ser_ref);
58747         FREE(ser);
58748         return tag_ptr(ret_conv, true);
58749 }
58750
58751 void  __attribute__((export_name("TS_RouteParameters_free"))) TS_RouteParameters_free(uint64_t this_obj) {
58752         LDKRouteParameters this_obj_conv;
58753         this_obj_conv.inner = untag_ptr(this_obj);
58754         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58756         RouteParameters_free(this_obj_conv);
58757 }
58758
58759 uint64_t  __attribute__((export_name("TS_RouteParameters_get_payment_params"))) TS_RouteParameters_get_payment_params(uint64_t this_ptr) {
58760         LDKRouteParameters this_ptr_conv;
58761         this_ptr_conv.inner = untag_ptr(this_ptr);
58762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58764         this_ptr_conv.is_owned = false;
58765         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
58766         uint64_t ret_ref = 0;
58767         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58768         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58769         return ret_ref;
58770 }
58771
58772 void  __attribute__((export_name("TS_RouteParameters_set_payment_params"))) TS_RouteParameters_set_payment_params(uint64_t this_ptr, uint64_t val) {
58773         LDKRouteParameters this_ptr_conv;
58774         this_ptr_conv.inner = untag_ptr(this_ptr);
58775         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58777         this_ptr_conv.is_owned = false;
58778         LDKPaymentParameters val_conv;
58779         val_conv.inner = untag_ptr(val);
58780         val_conv.is_owned = ptr_is_owned(val);
58781         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58782         val_conv = PaymentParameters_clone(&val_conv);
58783         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
58784 }
58785
58786 int64_t  __attribute__((export_name("TS_RouteParameters_get_final_value_msat"))) TS_RouteParameters_get_final_value_msat(uint64_t this_ptr) {
58787         LDKRouteParameters this_ptr_conv;
58788         this_ptr_conv.inner = untag_ptr(this_ptr);
58789         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58791         this_ptr_conv.is_owned = false;
58792         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
58793         return ret_conv;
58794 }
58795
58796 void  __attribute__((export_name("TS_RouteParameters_set_final_value_msat"))) TS_RouteParameters_set_final_value_msat(uint64_t this_ptr, int64_t val) {
58797         LDKRouteParameters this_ptr_conv;
58798         this_ptr_conv.inner = untag_ptr(this_ptr);
58799         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58801         this_ptr_conv.is_owned = false;
58802         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
58803 }
58804
58805 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) {
58806         LDKRouteParameters this_ptr_conv;
58807         this_ptr_conv.inner = untag_ptr(this_ptr);
58808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58810         this_ptr_conv.is_owned = false;
58811         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
58812         *ret_copy = RouteParameters_get_max_total_routing_fee_msat(&this_ptr_conv);
58813         uint64_t ret_ref = tag_ptr(ret_copy, true);
58814         return ret_ref;
58815 }
58816
58817 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) {
58818         LDKRouteParameters this_ptr_conv;
58819         this_ptr_conv.inner = untag_ptr(this_ptr);
58820         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58822         this_ptr_conv.is_owned = false;
58823         void* val_ptr = untag_ptr(val);
58824         CHECK_ACCESS(val_ptr);
58825         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
58826         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
58827         RouteParameters_set_max_total_routing_fee_msat(&this_ptr_conv, val_conv);
58828 }
58829
58830 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) {
58831         LDKPaymentParameters payment_params_arg_conv;
58832         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
58833         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
58834         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
58835         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
58836         void* max_total_routing_fee_msat_arg_ptr = untag_ptr(max_total_routing_fee_msat_arg);
58837         CHECK_ACCESS(max_total_routing_fee_msat_arg_ptr);
58838         LDKCOption_u64Z max_total_routing_fee_msat_arg_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_arg_ptr);
58839         max_total_routing_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat_arg));
58840         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, max_total_routing_fee_msat_arg_conv);
58841         uint64_t ret_ref = 0;
58842         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58843         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58844         return ret_ref;
58845 }
58846
58847 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
58848         LDKRouteParameters ret_var = RouteParameters_clone(arg);
58849         uint64_t ret_ref = 0;
58850         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58851         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58852         return ret_ref;
58853 }
58854 int64_t  __attribute__((export_name("TS_RouteParameters_clone_ptr"))) TS_RouteParameters_clone_ptr(uint64_t arg) {
58855         LDKRouteParameters arg_conv;
58856         arg_conv.inner = untag_ptr(arg);
58857         arg_conv.is_owned = ptr_is_owned(arg);
58858         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58859         arg_conv.is_owned = false;
58860         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
58861         return ret_conv;
58862 }
58863
58864 uint64_t  __attribute__((export_name("TS_RouteParameters_clone"))) TS_RouteParameters_clone(uint64_t orig) {
58865         LDKRouteParameters orig_conv;
58866         orig_conv.inner = untag_ptr(orig);
58867         orig_conv.is_owned = ptr_is_owned(orig);
58868         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58869         orig_conv.is_owned = false;
58870         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
58871         uint64_t ret_ref = 0;
58872         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58873         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58874         return ret_ref;
58875 }
58876
58877 int64_t  __attribute__((export_name("TS_RouteParameters_hash"))) TS_RouteParameters_hash(uint64_t o) {
58878         LDKRouteParameters o_conv;
58879         o_conv.inner = untag_ptr(o);
58880         o_conv.is_owned = ptr_is_owned(o);
58881         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58882         o_conv.is_owned = false;
58883         int64_t ret_conv = RouteParameters_hash(&o_conv);
58884         return ret_conv;
58885 }
58886
58887 jboolean  __attribute__((export_name("TS_RouteParameters_eq"))) TS_RouteParameters_eq(uint64_t a, uint64_t b) {
58888         LDKRouteParameters a_conv;
58889         a_conv.inner = untag_ptr(a);
58890         a_conv.is_owned = ptr_is_owned(a);
58891         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58892         a_conv.is_owned = false;
58893         LDKRouteParameters b_conv;
58894         b_conv.inner = untag_ptr(b);
58895         b_conv.is_owned = ptr_is_owned(b);
58896         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58897         b_conv.is_owned = false;
58898         jboolean ret_conv = RouteParameters_eq(&a_conv, &b_conv);
58899         return ret_conv;
58900 }
58901
58902 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) {
58903         LDKPaymentParameters payment_params_conv;
58904         payment_params_conv.inner = untag_ptr(payment_params);
58905         payment_params_conv.is_owned = ptr_is_owned(payment_params);
58906         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_conv);
58907         payment_params_conv = PaymentParameters_clone(&payment_params_conv);
58908         LDKRouteParameters ret_var = RouteParameters_from_payment_params_and_value(payment_params_conv, final_value_msat);
58909         uint64_t ret_ref = 0;
58910         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58911         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58912         return ret_ref;
58913 }
58914
58915 int8_tArray  __attribute__((export_name("TS_RouteParameters_write"))) TS_RouteParameters_write(uint64_t obj) {
58916         LDKRouteParameters obj_conv;
58917         obj_conv.inner = untag_ptr(obj);
58918         obj_conv.is_owned = ptr_is_owned(obj);
58919         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58920         obj_conv.is_owned = false;
58921         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
58922         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58923         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58924         CVec_u8Z_free(ret_var);
58925         return ret_arr;
58926 }
58927
58928 uint64_t  __attribute__((export_name("TS_RouteParameters_read"))) TS_RouteParameters_read(int8_tArray ser) {
58929         LDKu8slice ser_ref;
58930         ser_ref.datalen = ser->arr_len;
58931         ser_ref.data = ser->elems;
58932         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
58933         *ret_conv = RouteParameters_read(ser_ref);
58934         FREE(ser);
58935         return tag_ptr(ret_conv, true);
58936 }
58937
58938 void  __attribute__((export_name("TS_PaymentParameters_free"))) TS_PaymentParameters_free(uint64_t this_obj) {
58939         LDKPaymentParameters this_obj_conv;
58940         this_obj_conv.inner = untag_ptr(this_obj);
58941         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58943         PaymentParameters_free(this_obj_conv);
58944 }
58945
58946 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_payee"))) TS_PaymentParameters_get_payee(uint64_t this_ptr) {
58947         LDKPaymentParameters this_ptr_conv;
58948         this_ptr_conv.inner = untag_ptr(this_ptr);
58949         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58951         this_ptr_conv.is_owned = false;
58952         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
58953         *ret_copy = PaymentParameters_get_payee(&this_ptr_conv);
58954         uint64_t ret_ref = tag_ptr(ret_copy, true);
58955         return ret_ref;
58956 }
58957
58958 void  __attribute__((export_name("TS_PaymentParameters_set_payee"))) TS_PaymentParameters_set_payee(uint64_t this_ptr, uint64_t val) {
58959         LDKPaymentParameters this_ptr_conv;
58960         this_ptr_conv.inner = untag_ptr(this_ptr);
58961         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58963         this_ptr_conv.is_owned = false;
58964         void* val_ptr = untag_ptr(val);
58965         CHECK_ACCESS(val_ptr);
58966         LDKPayee val_conv = *(LDKPayee*)(val_ptr);
58967         val_conv = Payee_clone((LDKPayee*)untag_ptr(val));
58968         PaymentParameters_set_payee(&this_ptr_conv, val_conv);
58969 }
58970
58971 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_expiry_time"))) TS_PaymentParameters_get_expiry_time(uint64_t this_ptr) {
58972         LDKPaymentParameters this_ptr_conv;
58973         this_ptr_conv.inner = untag_ptr(this_ptr);
58974         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58976         this_ptr_conv.is_owned = false;
58977         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
58978         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
58979         uint64_t ret_ref = tag_ptr(ret_copy, true);
58980         return ret_ref;
58981 }
58982
58983 void  __attribute__((export_name("TS_PaymentParameters_set_expiry_time"))) TS_PaymentParameters_set_expiry_time(uint64_t this_ptr, uint64_t val) {
58984         LDKPaymentParameters this_ptr_conv;
58985         this_ptr_conv.inner = untag_ptr(this_ptr);
58986         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58988         this_ptr_conv.is_owned = false;
58989         void* val_ptr = untag_ptr(val);
58990         CHECK_ACCESS(val_ptr);
58991         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
58992         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
58993         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
58994 }
58995
58996 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) {
58997         LDKPaymentParameters this_ptr_conv;
58998         this_ptr_conv.inner = untag_ptr(this_ptr);
58999         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59001         this_ptr_conv.is_owned = false;
59002         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
59003         return ret_conv;
59004 }
59005
59006 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) {
59007         LDKPaymentParameters this_ptr_conv;
59008         this_ptr_conv.inner = untag_ptr(this_ptr);
59009         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59011         this_ptr_conv.is_owned = false;
59012         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
59013 }
59014
59015 int8_t  __attribute__((export_name("TS_PaymentParameters_get_max_path_count"))) TS_PaymentParameters_get_max_path_count(uint64_t this_ptr) {
59016         LDKPaymentParameters this_ptr_conv;
59017         this_ptr_conv.inner = untag_ptr(this_ptr);
59018         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59020         this_ptr_conv.is_owned = false;
59021         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
59022         return ret_conv;
59023 }
59024
59025 void  __attribute__((export_name("TS_PaymentParameters_set_max_path_count"))) TS_PaymentParameters_set_max_path_count(uint64_t this_ptr, int8_t val) {
59026         LDKPaymentParameters this_ptr_conv;
59027         this_ptr_conv.inner = untag_ptr(this_ptr);
59028         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59030         this_ptr_conv.is_owned = false;
59031         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
59032 }
59033
59034 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) {
59035         LDKPaymentParameters this_ptr_conv;
59036         this_ptr_conv.inner = untag_ptr(this_ptr);
59037         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59039         this_ptr_conv.is_owned = false;
59040         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
59041         return ret_conv;
59042 }
59043
59044 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) {
59045         LDKPaymentParameters this_ptr_conv;
59046         this_ptr_conv.inner = untag_ptr(this_ptr);
59047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59049         this_ptr_conv.is_owned = false;
59050         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
59051 }
59052
59053 int64_tArray  __attribute__((export_name("TS_PaymentParameters_get_previously_failed_channels"))) TS_PaymentParameters_get_previously_failed_channels(uint64_t this_ptr) {
59054         LDKPaymentParameters this_ptr_conv;
59055         this_ptr_conv.inner = untag_ptr(this_ptr);
59056         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59058         this_ptr_conv.is_owned = false;
59059         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
59060         int64_tArray ret_arr = NULL;
59061         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
59062         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
59063         for (size_t i = 0; i < ret_var.datalen; i++) {
59064                 int64_t ret_conv_8_conv = ret_var.data[i];
59065                 ret_arr_ptr[i] = ret_conv_8_conv;
59066         }
59067         
59068         FREE(ret_var.data);
59069         return ret_arr;
59070 }
59071
59072 void  __attribute__((export_name("TS_PaymentParameters_set_previously_failed_channels"))) TS_PaymentParameters_set_previously_failed_channels(uint64_t this_ptr, int64_tArray val) {
59073         LDKPaymentParameters this_ptr_conv;
59074         this_ptr_conv.inner = untag_ptr(this_ptr);
59075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59077         this_ptr_conv.is_owned = false;
59078         LDKCVec_u64Z val_constr;
59079         val_constr.datalen = val->arr_len;
59080         if (val_constr.datalen > 0)
59081                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
59082         else
59083                 val_constr.data = NULL;
59084         int64_t* val_vals = val->elems;
59085         for (size_t i = 0; i < val_constr.datalen; i++) {
59086                 int64_t val_conv_8 = val_vals[i];
59087                 val_constr.data[i] = val_conv_8;
59088         }
59089         FREE(val);
59090         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
59091 }
59092
59093 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) {
59094         void* payee_arg_ptr = untag_ptr(payee_arg);
59095         CHECK_ACCESS(payee_arg_ptr);
59096         LDKPayee payee_arg_conv = *(LDKPayee*)(payee_arg_ptr);
59097         payee_arg_conv = Payee_clone((LDKPayee*)untag_ptr(payee_arg));
59098         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
59099         CHECK_ACCESS(expiry_time_arg_ptr);
59100         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
59101         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
59102         LDKCVec_u64Z previously_failed_channels_arg_constr;
59103         previously_failed_channels_arg_constr.datalen = previously_failed_channels_arg->arr_len;
59104         if (previously_failed_channels_arg_constr.datalen > 0)
59105                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
59106         else
59107                 previously_failed_channels_arg_constr.data = NULL;
59108         int64_t* previously_failed_channels_arg_vals = previously_failed_channels_arg->elems;
59109         for (size_t i = 0; i < previously_failed_channels_arg_constr.datalen; i++) {
59110                 int64_t previously_failed_channels_arg_conv_8 = previously_failed_channels_arg_vals[i];
59111                 previously_failed_channels_arg_constr.data[i] = previously_failed_channels_arg_conv_8;
59112         }
59113         FREE(previously_failed_channels_arg);
59114         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);
59115         uint64_t ret_ref = 0;
59116         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59117         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59118         return ret_ref;
59119 }
59120
59121 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
59122         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
59123         uint64_t ret_ref = 0;
59124         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59125         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59126         return ret_ref;
59127 }
59128 int64_t  __attribute__((export_name("TS_PaymentParameters_clone_ptr"))) TS_PaymentParameters_clone_ptr(uint64_t arg) {
59129         LDKPaymentParameters arg_conv;
59130         arg_conv.inner = untag_ptr(arg);
59131         arg_conv.is_owned = ptr_is_owned(arg);
59132         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59133         arg_conv.is_owned = false;
59134         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
59135         return ret_conv;
59136 }
59137
59138 uint64_t  __attribute__((export_name("TS_PaymentParameters_clone"))) TS_PaymentParameters_clone(uint64_t orig) {
59139         LDKPaymentParameters orig_conv;
59140         orig_conv.inner = untag_ptr(orig);
59141         orig_conv.is_owned = ptr_is_owned(orig);
59142         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59143         orig_conv.is_owned = false;
59144         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
59145         uint64_t ret_ref = 0;
59146         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59147         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59148         return ret_ref;
59149 }
59150
59151 int64_t  __attribute__((export_name("TS_PaymentParameters_hash"))) TS_PaymentParameters_hash(uint64_t o) {
59152         LDKPaymentParameters o_conv;
59153         o_conv.inner = untag_ptr(o);
59154         o_conv.is_owned = ptr_is_owned(o);
59155         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59156         o_conv.is_owned = false;
59157         int64_t ret_conv = PaymentParameters_hash(&o_conv);
59158         return ret_conv;
59159 }
59160
59161 jboolean  __attribute__((export_name("TS_PaymentParameters_eq"))) TS_PaymentParameters_eq(uint64_t a, uint64_t b) {
59162         LDKPaymentParameters a_conv;
59163         a_conv.inner = untag_ptr(a);
59164         a_conv.is_owned = ptr_is_owned(a);
59165         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59166         a_conv.is_owned = false;
59167         LDKPaymentParameters b_conv;
59168         b_conv.inner = untag_ptr(b);
59169         b_conv.is_owned = ptr_is_owned(b);
59170         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59171         b_conv.is_owned = false;
59172         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
59173         return ret_conv;
59174 }
59175
59176 int8_tArray  __attribute__((export_name("TS_PaymentParameters_write"))) TS_PaymentParameters_write(uint64_t obj) {
59177         LDKPaymentParameters obj_conv;
59178         obj_conv.inner = untag_ptr(obj);
59179         obj_conv.is_owned = ptr_is_owned(obj);
59180         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59181         obj_conv.is_owned = false;
59182         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
59183         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59184         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59185         CVec_u8Z_free(ret_var);
59186         return ret_arr;
59187 }
59188
59189 uint64_t  __attribute__((export_name("TS_PaymentParameters_read"))) TS_PaymentParameters_read(int8_tArray ser, int32_t arg) {
59190         LDKu8slice ser_ref;
59191         ser_ref.datalen = ser->arr_len;
59192         ser_ref.data = ser->elems;
59193         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
59194         *ret_conv = PaymentParameters_read(ser_ref, arg);
59195         FREE(ser);
59196         return tag_ptr(ret_conv, true);
59197 }
59198
59199 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) {
59200         LDKPublicKey payee_pubkey_ref;
59201         CHECK(payee_pubkey->arr_len == 33);
59202         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
59203         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref, final_cltv_expiry_delta);
59204         uint64_t ret_ref = 0;
59205         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59206         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59207         return ret_ref;
59208 }
59209
59210 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) {
59211         LDKPublicKey payee_pubkey_ref;
59212         CHECK(payee_pubkey->arr_len == 33);
59213         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
59214         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref, final_cltv_expiry_delta, allow_mpp);
59215         uint64_t ret_ref = 0;
59216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59218         return ret_ref;
59219 }
59220
59221 uint64_t  __attribute__((export_name("TS_PaymentParameters_from_bolt12_invoice"))) TS_PaymentParameters_from_bolt12_invoice(uint64_t invoice) {
59222         LDKBolt12Invoice invoice_conv;
59223         invoice_conv.inner = untag_ptr(invoice);
59224         invoice_conv.is_owned = ptr_is_owned(invoice);
59225         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
59226         invoice_conv.is_owned = false;
59227         LDKPaymentParameters ret_var = PaymentParameters_from_bolt12_invoice(&invoice_conv);
59228         uint64_t ret_ref = 0;
59229         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59230         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59231         return ret_ref;
59232 }
59233
59234 uint64_t  __attribute__((export_name("TS_PaymentParameters_blinded"))) TS_PaymentParameters_blinded(uint64_tArray blinded_route_hints) {
59235         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ blinded_route_hints_constr;
59236         blinded_route_hints_constr.datalen = blinded_route_hints->arr_len;
59237         if (blinded_route_hints_constr.datalen > 0)
59238                 blinded_route_hints_constr.data = MALLOC(blinded_route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
59239         else
59240                 blinded_route_hints_constr.data = NULL;
59241         uint64_t* blinded_route_hints_vals = blinded_route_hints->elems;
59242         for (size_t l = 0; l < blinded_route_hints_constr.datalen; l++) {
59243                 uint64_t blinded_route_hints_conv_37 = blinded_route_hints_vals[l];
59244                 void* blinded_route_hints_conv_37_ptr = untag_ptr(blinded_route_hints_conv_37);
59245                 CHECK_ACCESS(blinded_route_hints_conv_37_ptr);
59246                 LDKC2Tuple_BlindedPayInfoBlindedPathZ blinded_route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(blinded_route_hints_conv_37_ptr);
59247                 blinded_route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(blinded_route_hints_conv_37));
59248                 blinded_route_hints_constr.data[l] = blinded_route_hints_conv_37_conv;
59249         }
59250         FREE(blinded_route_hints);
59251         LDKPaymentParameters ret_var = PaymentParameters_blinded(blinded_route_hints_constr);
59252         uint64_t ret_ref = 0;
59253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59255         return ret_ref;
59256 }
59257
59258 void  __attribute__((export_name("TS_Payee_free"))) TS_Payee_free(uint64_t this_ptr) {
59259         if (!ptr_is_owned(this_ptr)) return;
59260         void* this_ptr_ptr = untag_ptr(this_ptr);
59261         CHECK_ACCESS(this_ptr_ptr);
59262         LDKPayee this_ptr_conv = *(LDKPayee*)(this_ptr_ptr);
59263         FREE(untag_ptr(this_ptr));
59264         Payee_free(this_ptr_conv);
59265 }
59266
59267 static inline uint64_t Payee_clone_ptr(LDKPayee *NONNULL_PTR arg) {
59268         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
59269         *ret_copy = Payee_clone(arg);
59270         uint64_t ret_ref = tag_ptr(ret_copy, true);
59271         return ret_ref;
59272 }
59273 int64_t  __attribute__((export_name("TS_Payee_clone_ptr"))) TS_Payee_clone_ptr(uint64_t arg) {
59274         LDKPayee* arg_conv = (LDKPayee*)untag_ptr(arg);
59275         int64_t ret_conv = Payee_clone_ptr(arg_conv);
59276         return ret_conv;
59277 }
59278
59279 uint64_t  __attribute__((export_name("TS_Payee_clone"))) TS_Payee_clone(uint64_t orig) {
59280         LDKPayee* orig_conv = (LDKPayee*)untag_ptr(orig);
59281         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
59282         *ret_copy = Payee_clone(orig_conv);
59283         uint64_t ret_ref = tag_ptr(ret_copy, true);
59284         return ret_ref;
59285 }
59286
59287 uint64_t  __attribute__((export_name("TS_Payee_blinded"))) TS_Payee_blinded(uint64_tArray route_hints, uint64_t features) {
59288         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_constr;
59289         route_hints_constr.datalen = route_hints->arr_len;
59290         if (route_hints_constr.datalen > 0)
59291                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
59292         else
59293                 route_hints_constr.data = NULL;
59294         uint64_t* route_hints_vals = route_hints->elems;
59295         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
59296                 uint64_t route_hints_conv_37 = route_hints_vals[l];
59297                 void* route_hints_conv_37_ptr = untag_ptr(route_hints_conv_37);
59298                 CHECK_ACCESS(route_hints_conv_37_ptr);
59299                 LDKC2Tuple_BlindedPayInfoBlindedPathZ route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(route_hints_conv_37_ptr);
59300                 route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(route_hints_conv_37));
59301                 route_hints_constr.data[l] = route_hints_conv_37_conv;
59302         }
59303         FREE(route_hints);
59304         LDKBolt12InvoiceFeatures features_conv;
59305         features_conv.inner = untag_ptr(features);
59306         features_conv.is_owned = ptr_is_owned(features);
59307         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
59308         features_conv = Bolt12InvoiceFeatures_clone(&features_conv);
59309         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
59310         *ret_copy = Payee_blinded(route_hints_constr, features_conv);
59311         uint64_t ret_ref = tag_ptr(ret_copy, true);
59312         return ret_ref;
59313 }
59314
59315 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) {
59316         LDKPublicKey node_id_ref;
59317         CHECK(node_id->arr_len == 33);
59318         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
59319         LDKCVec_RouteHintZ route_hints_constr;
59320         route_hints_constr.datalen = route_hints->arr_len;
59321         if (route_hints_constr.datalen > 0)
59322                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
59323         else
59324                 route_hints_constr.data = NULL;
59325         uint64_t* route_hints_vals = route_hints->elems;
59326         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
59327                 uint64_t route_hints_conv_11 = route_hints_vals[l];
59328                 LDKRouteHint route_hints_conv_11_conv;
59329                 route_hints_conv_11_conv.inner = untag_ptr(route_hints_conv_11);
59330                 route_hints_conv_11_conv.is_owned = ptr_is_owned(route_hints_conv_11);
59331                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_conv);
59332                 route_hints_conv_11_conv = RouteHint_clone(&route_hints_conv_11_conv);
59333                 route_hints_constr.data[l] = route_hints_conv_11_conv;
59334         }
59335         FREE(route_hints);
59336         LDKBolt11InvoiceFeatures features_conv;
59337         features_conv.inner = untag_ptr(features);
59338         features_conv.is_owned = ptr_is_owned(features);
59339         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
59340         features_conv = Bolt11InvoiceFeatures_clone(&features_conv);
59341         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
59342         *ret_copy = Payee_clear(node_id_ref, route_hints_constr, features_conv, final_cltv_expiry_delta);
59343         uint64_t ret_ref = tag_ptr(ret_copy, true);
59344         return ret_ref;
59345 }
59346
59347 int64_t  __attribute__((export_name("TS_Payee_hash"))) TS_Payee_hash(uint64_t o) {
59348         LDKPayee* o_conv = (LDKPayee*)untag_ptr(o);
59349         int64_t ret_conv = Payee_hash(o_conv);
59350         return ret_conv;
59351 }
59352
59353 jboolean  __attribute__((export_name("TS_Payee_eq"))) TS_Payee_eq(uint64_t a, uint64_t b) {
59354         LDKPayee* a_conv = (LDKPayee*)untag_ptr(a);
59355         LDKPayee* b_conv = (LDKPayee*)untag_ptr(b);
59356         jboolean ret_conv = Payee_eq(a_conv, b_conv);
59357         return ret_conv;
59358 }
59359
59360 void  __attribute__((export_name("TS_RouteHint_free"))) TS_RouteHint_free(uint64_t this_obj) {
59361         LDKRouteHint this_obj_conv;
59362         this_obj_conv.inner = untag_ptr(this_obj);
59363         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59365         RouteHint_free(this_obj_conv);
59366 }
59367
59368 uint64_tArray  __attribute__((export_name("TS_RouteHint_get_a"))) TS_RouteHint_get_a(uint64_t this_ptr) {
59369         LDKRouteHint this_ptr_conv;
59370         this_ptr_conv.inner = untag_ptr(this_ptr);
59371         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59373         this_ptr_conv.is_owned = false;
59374         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
59375         uint64_tArray ret_arr = NULL;
59376         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
59377         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
59378         for (size_t o = 0; o < ret_var.datalen; o++) {
59379                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
59380                 uint64_t ret_conv_14_ref = 0;
59381                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
59382                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
59383                 ret_arr_ptr[o] = ret_conv_14_ref;
59384         }
59385         
59386         FREE(ret_var.data);
59387         return ret_arr;
59388 }
59389
59390 void  __attribute__((export_name("TS_RouteHint_set_a"))) TS_RouteHint_set_a(uint64_t this_ptr, uint64_tArray val) {
59391         LDKRouteHint this_ptr_conv;
59392         this_ptr_conv.inner = untag_ptr(this_ptr);
59393         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59395         this_ptr_conv.is_owned = false;
59396         LDKCVec_RouteHintHopZ val_constr;
59397         val_constr.datalen = val->arr_len;
59398         if (val_constr.datalen > 0)
59399                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
59400         else
59401                 val_constr.data = NULL;
59402         uint64_t* val_vals = val->elems;
59403         for (size_t o = 0; o < val_constr.datalen; o++) {
59404                 uint64_t val_conv_14 = val_vals[o];
59405                 LDKRouteHintHop val_conv_14_conv;
59406                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
59407                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
59408                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
59409                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
59410                 val_constr.data[o] = val_conv_14_conv;
59411         }
59412         FREE(val);
59413         RouteHint_set_a(&this_ptr_conv, val_constr);
59414 }
59415
59416 uint64_t  __attribute__((export_name("TS_RouteHint_new"))) TS_RouteHint_new(uint64_tArray a_arg) {
59417         LDKCVec_RouteHintHopZ a_arg_constr;
59418         a_arg_constr.datalen = a_arg->arr_len;
59419         if (a_arg_constr.datalen > 0)
59420                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
59421         else
59422                 a_arg_constr.data = NULL;
59423         uint64_t* a_arg_vals = a_arg->elems;
59424         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
59425                 uint64_t a_arg_conv_14 = a_arg_vals[o];
59426                 LDKRouteHintHop a_arg_conv_14_conv;
59427                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
59428                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
59429                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
59430                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
59431                 a_arg_constr.data[o] = a_arg_conv_14_conv;
59432         }
59433         FREE(a_arg);
59434         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
59435         uint64_t ret_ref = 0;
59436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59438         return ret_ref;
59439 }
59440
59441 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
59442         LDKRouteHint ret_var = RouteHint_clone(arg);
59443         uint64_t ret_ref = 0;
59444         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59445         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59446         return ret_ref;
59447 }
59448 int64_t  __attribute__((export_name("TS_RouteHint_clone_ptr"))) TS_RouteHint_clone_ptr(uint64_t arg) {
59449         LDKRouteHint arg_conv;
59450         arg_conv.inner = untag_ptr(arg);
59451         arg_conv.is_owned = ptr_is_owned(arg);
59452         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59453         arg_conv.is_owned = false;
59454         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
59455         return ret_conv;
59456 }
59457
59458 uint64_t  __attribute__((export_name("TS_RouteHint_clone"))) TS_RouteHint_clone(uint64_t orig) {
59459         LDKRouteHint orig_conv;
59460         orig_conv.inner = untag_ptr(orig);
59461         orig_conv.is_owned = ptr_is_owned(orig);
59462         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59463         orig_conv.is_owned = false;
59464         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
59465         uint64_t ret_ref = 0;
59466         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59467         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59468         return ret_ref;
59469 }
59470
59471 int64_t  __attribute__((export_name("TS_RouteHint_hash"))) TS_RouteHint_hash(uint64_t o) {
59472         LDKRouteHint o_conv;
59473         o_conv.inner = untag_ptr(o);
59474         o_conv.is_owned = ptr_is_owned(o);
59475         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59476         o_conv.is_owned = false;
59477         int64_t ret_conv = RouteHint_hash(&o_conv);
59478         return ret_conv;
59479 }
59480
59481 jboolean  __attribute__((export_name("TS_RouteHint_eq"))) TS_RouteHint_eq(uint64_t a, uint64_t b) {
59482         LDKRouteHint a_conv;
59483         a_conv.inner = untag_ptr(a);
59484         a_conv.is_owned = ptr_is_owned(a);
59485         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59486         a_conv.is_owned = false;
59487         LDKRouteHint b_conv;
59488         b_conv.inner = untag_ptr(b);
59489         b_conv.is_owned = ptr_is_owned(b);
59490         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59491         b_conv.is_owned = false;
59492         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
59493         return ret_conv;
59494 }
59495
59496 int8_tArray  __attribute__((export_name("TS_RouteHint_write"))) TS_RouteHint_write(uint64_t obj) {
59497         LDKRouteHint obj_conv;
59498         obj_conv.inner = untag_ptr(obj);
59499         obj_conv.is_owned = ptr_is_owned(obj);
59500         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59501         obj_conv.is_owned = false;
59502         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
59503         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59504         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59505         CVec_u8Z_free(ret_var);
59506         return ret_arr;
59507 }
59508
59509 uint64_t  __attribute__((export_name("TS_RouteHint_read"))) TS_RouteHint_read(int8_tArray ser) {
59510         LDKu8slice ser_ref;
59511         ser_ref.datalen = ser->arr_len;
59512         ser_ref.data = ser->elems;
59513         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
59514         *ret_conv = RouteHint_read(ser_ref);
59515         FREE(ser);
59516         return tag_ptr(ret_conv, true);
59517 }
59518
59519 void  __attribute__((export_name("TS_RouteHintHop_free"))) TS_RouteHintHop_free(uint64_t this_obj) {
59520         LDKRouteHintHop this_obj_conv;
59521         this_obj_conv.inner = untag_ptr(this_obj);
59522         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59524         RouteHintHop_free(this_obj_conv);
59525 }
59526
59527 int8_tArray  __attribute__((export_name("TS_RouteHintHop_get_src_node_id"))) TS_RouteHintHop_get_src_node_id(uint64_t this_ptr) {
59528         LDKRouteHintHop this_ptr_conv;
59529         this_ptr_conv.inner = untag_ptr(this_ptr);
59530         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59532         this_ptr_conv.is_owned = false;
59533         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
59534         memcpy(ret_arr->elems, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
59535         return ret_arr;
59536 }
59537
59538 void  __attribute__((export_name("TS_RouteHintHop_set_src_node_id"))) TS_RouteHintHop_set_src_node_id(uint64_t this_ptr, int8_tArray val) {
59539         LDKRouteHintHop this_ptr_conv;
59540         this_ptr_conv.inner = untag_ptr(this_ptr);
59541         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59543         this_ptr_conv.is_owned = false;
59544         LDKPublicKey val_ref;
59545         CHECK(val->arr_len == 33);
59546         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
59547         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
59548 }
59549
59550 int64_t  __attribute__((export_name("TS_RouteHintHop_get_short_channel_id"))) TS_RouteHintHop_get_short_channel_id(uint64_t this_ptr) {
59551         LDKRouteHintHop this_ptr_conv;
59552         this_ptr_conv.inner = untag_ptr(this_ptr);
59553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59555         this_ptr_conv.is_owned = false;
59556         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
59557         return ret_conv;
59558 }
59559
59560 void  __attribute__((export_name("TS_RouteHintHop_set_short_channel_id"))) TS_RouteHintHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
59561         LDKRouteHintHop this_ptr_conv;
59562         this_ptr_conv.inner = untag_ptr(this_ptr);
59563         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59565         this_ptr_conv.is_owned = false;
59566         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
59567 }
59568
59569 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_fees"))) TS_RouteHintHop_get_fees(uint64_t this_ptr) {
59570         LDKRouteHintHop this_ptr_conv;
59571         this_ptr_conv.inner = untag_ptr(this_ptr);
59572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59574         this_ptr_conv.is_owned = false;
59575         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
59576         uint64_t ret_ref = 0;
59577         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59578         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59579         return ret_ref;
59580 }
59581
59582 void  __attribute__((export_name("TS_RouteHintHop_set_fees"))) TS_RouteHintHop_set_fees(uint64_t this_ptr, uint64_t val) {
59583         LDKRouteHintHop this_ptr_conv;
59584         this_ptr_conv.inner = untag_ptr(this_ptr);
59585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59587         this_ptr_conv.is_owned = false;
59588         LDKRoutingFees val_conv;
59589         val_conv.inner = untag_ptr(val);
59590         val_conv.is_owned = ptr_is_owned(val);
59591         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59592         val_conv = RoutingFees_clone(&val_conv);
59593         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
59594 }
59595
59596 int16_t  __attribute__((export_name("TS_RouteHintHop_get_cltv_expiry_delta"))) TS_RouteHintHop_get_cltv_expiry_delta(uint64_t this_ptr) {
59597         LDKRouteHintHop this_ptr_conv;
59598         this_ptr_conv.inner = untag_ptr(this_ptr);
59599         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59601         this_ptr_conv.is_owned = false;
59602         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
59603         return ret_conv;
59604 }
59605
59606 void  __attribute__((export_name("TS_RouteHintHop_set_cltv_expiry_delta"))) TS_RouteHintHop_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
59607         LDKRouteHintHop this_ptr_conv;
59608         this_ptr_conv.inner = untag_ptr(this_ptr);
59609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59611         this_ptr_conv.is_owned = false;
59612         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
59613 }
59614
59615 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_minimum_msat"))) TS_RouteHintHop_get_htlc_minimum_msat(uint64_t this_ptr) {
59616         LDKRouteHintHop this_ptr_conv;
59617         this_ptr_conv.inner = untag_ptr(this_ptr);
59618         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59620         this_ptr_conv.is_owned = false;
59621         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
59622         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
59623         uint64_t ret_ref = tag_ptr(ret_copy, true);
59624         return ret_ref;
59625 }
59626
59627 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_minimum_msat"))) TS_RouteHintHop_set_htlc_minimum_msat(uint64_t this_ptr, uint64_t val) {
59628         LDKRouteHintHop this_ptr_conv;
59629         this_ptr_conv.inner = untag_ptr(this_ptr);
59630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59632         this_ptr_conv.is_owned = false;
59633         void* val_ptr = untag_ptr(val);
59634         CHECK_ACCESS(val_ptr);
59635         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
59636         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
59637         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
59638 }
59639
59640 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_maximum_msat"))) TS_RouteHintHop_get_htlc_maximum_msat(uint64_t this_ptr) {
59641         LDKRouteHintHop this_ptr_conv;
59642         this_ptr_conv.inner = untag_ptr(this_ptr);
59643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59645         this_ptr_conv.is_owned = false;
59646         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
59647         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
59648         uint64_t ret_ref = tag_ptr(ret_copy, true);
59649         return ret_ref;
59650 }
59651
59652 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_maximum_msat"))) TS_RouteHintHop_set_htlc_maximum_msat(uint64_t this_ptr, uint64_t val) {
59653         LDKRouteHintHop this_ptr_conv;
59654         this_ptr_conv.inner = untag_ptr(this_ptr);
59655         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59657         this_ptr_conv.is_owned = false;
59658         void* val_ptr = untag_ptr(val);
59659         CHECK_ACCESS(val_ptr);
59660         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
59661         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
59662         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
59663 }
59664
59665 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) {
59666         LDKPublicKey src_node_id_arg_ref;
59667         CHECK(src_node_id_arg->arr_len == 33);
59668         memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg->elems, 33); FREE(src_node_id_arg);
59669         LDKRoutingFees fees_arg_conv;
59670         fees_arg_conv.inner = untag_ptr(fees_arg);
59671         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
59672         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
59673         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
59674         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
59675         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
59676         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
59677         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
59678         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
59679         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
59680         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
59681         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
59682         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);
59683         uint64_t ret_ref = 0;
59684         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59685         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59686         return ret_ref;
59687 }
59688
59689 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
59690         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
59691         uint64_t ret_ref = 0;
59692         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59693         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59694         return ret_ref;
59695 }
59696 int64_t  __attribute__((export_name("TS_RouteHintHop_clone_ptr"))) TS_RouteHintHop_clone_ptr(uint64_t arg) {
59697         LDKRouteHintHop arg_conv;
59698         arg_conv.inner = untag_ptr(arg);
59699         arg_conv.is_owned = ptr_is_owned(arg);
59700         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59701         arg_conv.is_owned = false;
59702         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
59703         return ret_conv;
59704 }
59705
59706 uint64_t  __attribute__((export_name("TS_RouteHintHop_clone"))) TS_RouteHintHop_clone(uint64_t orig) {
59707         LDKRouteHintHop orig_conv;
59708         orig_conv.inner = untag_ptr(orig);
59709         orig_conv.is_owned = ptr_is_owned(orig);
59710         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59711         orig_conv.is_owned = false;
59712         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
59713         uint64_t ret_ref = 0;
59714         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59715         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59716         return ret_ref;
59717 }
59718
59719 int64_t  __attribute__((export_name("TS_RouteHintHop_hash"))) TS_RouteHintHop_hash(uint64_t o) {
59720         LDKRouteHintHop o_conv;
59721         o_conv.inner = untag_ptr(o);
59722         o_conv.is_owned = ptr_is_owned(o);
59723         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59724         o_conv.is_owned = false;
59725         int64_t ret_conv = RouteHintHop_hash(&o_conv);
59726         return ret_conv;
59727 }
59728
59729 jboolean  __attribute__((export_name("TS_RouteHintHop_eq"))) TS_RouteHintHop_eq(uint64_t a, uint64_t b) {
59730         LDKRouteHintHop a_conv;
59731         a_conv.inner = untag_ptr(a);
59732         a_conv.is_owned = ptr_is_owned(a);
59733         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59734         a_conv.is_owned = false;
59735         LDKRouteHintHop b_conv;
59736         b_conv.inner = untag_ptr(b);
59737         b_conv.is_owned = ptr_is_owned(b);
59738         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59739         b_conv.is_owned = false;
59740         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
59741         return ret_conv;
59742 }
59743
59744 int8_tArray  __attribute__((export_name("TS_RouteHintHop_write"))) TS_RouteHintHop_write(uint64_t obj) {
59745         LDKRouteHintHop obj_conv;
59746         obj_conv.inner = untag_ptr(obj);
59747         obj_conv.is_owned = ptr_is_owned(obj);
59748         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59749         obj_conv.is_owned = false;
59750         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
59751         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59752         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59753         CVec_u8Z_free(ret_var);
59754         return ret_arr;
59755 }
59756
59757 uint64_t  __attribute__((export_name("TS_RouteHintHop_read"))) TS_RouteHintHop_read(int8_tArray ser) {
59758         LDKu8slice ser_ref;
59759         ser_ref.datalen = ser->arr_len;
59760         ser_ref.data = ser->elems;
59761         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
59762         *ret_conv = RouteHintHop_read(ser_ref);
59763         FREE(ser);
59764         return tag_ptr(ret_conv, true);
59765 }
59766
59767 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) {
59768         LDKPublicKey our_node_pubkey_ref;
59769         CHECK(our_node_pubkey->arr_len == 33);
59770         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
59771         LDKRouteParameters route_params_conv;
59772         route_params_conv.inner = untag_ptr(route_params);
59773         route_params_conv.is_owned = ptr_is_owned(route_params);
59774         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
59775         route_params_conv.is_owned = false;
59776         LDKNetworkGraph network_graph_conv;
59777         network_graph_conv.inner = untag_ptr(network_graph);
59778         network_graph_conv.is_owned = ptr_is_owned(network_graph);
59779         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
59780         network_graph_conv.is_owned = false;
59781         LDKCVec_ChannelDetailsZ first_hops_constr;
59782         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
59783         if (first_hops != 0) {
59784                 first_hops_constr.datalen = first_hops->arr_len;
59785                 if (first_hops_constr.datalen > 0)
59786                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
59787                 else
59788                         first_hops_constr.data = NULL;
59789                 uint64_t* first_hops_vals = first_hops->elems;
59790                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
59791                         uint64_t first_hops_conv_16 = first_hops_vals[q];
59792                         LDKChannelDetails first_hops_conv_16_conv;
59793                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
59794                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
59795                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
59796                         first_hops_conv_16_conv.is_owned = false;
59797                         first_hops_constr.data[q] = first_hops_conv_16_conv;
59798                 }
59799                 FREE(first_hops);
59800                 first_hops_ptr = &first_hops_constr;
59801         }
59802         void* logger_ptr = untag_ptr(logger);
59803         CHECK_ACCESS(logger_ptr);
59804         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
59805         if (logger_conv.free == LDKLogger_JCalls_free) {
59806                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
59807                 LDKLogger_JCalls_cloned(&logger_conv);
59808         }
59809         void* scorer_ptr = untag_ptr(scorer);
59810         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
59811         LDKScoreLookUp* scorer_conv = (LDKScoreLookUp*)scorer_ptr;
59812         LDKProbabilisticScoringFeeParameters score_params_conv;
59813         score_params_conv.inner = untag_ptr(score_params);
59814         score_params_conv.is_owned = ptr_is_owned(score_params);
59815         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
59816         score_params_conv.is_owned = false;
59817         uint8_t random_seed_bytes_arr[32];
59818         CHECK(random_seed_bytes->arr_len == 32);
59819         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
59820         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
59821         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
59822         *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);
59823         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
59824         return tag_ptr(ret_conv, true);
59825 }
59826
59827 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) {
59828         LDKPublicKey our_node_pubkey_ref;
59829         CHECK(our_node_pubkey->arr_len == 33);
59830         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
59831         LDKCVec_PublicKeyZ hops_constr;
59832         hops_constr.datalen = hops->arr_len;
59833         if (hops_constr.datalen > 0)
59834                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
59835         else
59836                 hops_constr.data = NULL;
59837         int8_tArray* hops_vals = (void*) hops->elems;
59838         for (size_t m = 0; m < hops_constr.datalen; m++) {
59839                 int8_tArray hops_conv_12 = hops_vals[m];
59840                 LDKPublicKey hops_conv_12_ref;
59841                 CHECK(hops_conv_12->arr_len == 33);
59842                 memcpy(hops_conv_12_ref.compressed_form, hops_conv_12->elems, 33); FREE(hops_conv_12);
59843                 hops_constr.data[m] = hops_conv_12_ref;
59844         }
59845         FREE(hops);
59846         LDKRouteParameters route_params_conv;
59847         route_params_conv.inner = untag_ptr(route_params);
59848         route_params_conv.is_owned = ptr_is_owned(route_params);
59849         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
59850         route_params_conv.is_owned = false;
59851         LDKNetworkGraph network_graph_conv;
59852         network_graph_conv.inner = untag_ptr(network_graph);
59853         network_graph_conv.is_owned = ptr_is_owned(network_graph);
59854         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
59855         network_graph_conv.is_owned = false;
59856         void* logger_ptr = untag_ptr(logger);
59857         CHECK_ACCESS(logger_ptr);
59858         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
59859         if (logger_conv.free == LDKLogger_JCalls_free) {
59860                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
59861                 LDKLogger_JCalls_cloned(&logger_conv);
59862         }
59863         uint8_t random_seed_bytes_arr[32];
59864         CHECK(random_seed_bytes->arr_len == 32);
59865         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
59866         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
59867         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
59868         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
59869         return tag_ptr(ret_conv, true);
59870 }
59871
59872 void  __attribute__((export_name("TS_ScoreLookUp_free"))) TS_ScoreLookUp_free(uint64_t this_ptr) {
59873         if (!ptr_is_owned(this_ptr)) return;
59874         void* this_ptr_ptr = untag_ptr(this_ptr);
59875         CHECK_ACCESS(this_ptr_ptr);
59876         LDKScoreLookUp this_ptr_conv = *(LDKScoreLookUp*)(this_ptr_ptr);
59877         FREE(untag_ptr(this_ptr));
59878         ScoreLookUp_free(this_ptr_conv);
59879 }
59880
59881 void  __attribute__((export_name("TS_ScoreUpdate_free"))) TS_ScoreUpdate_free(uint64_t this_ptr) {
59882         if (!ptr_is_owned(this_ptr)) return;
59883         void* this_ptr_ptr = untag_ptr(this_ptr);
59884         CHECK_ACCESS(this_ptr_ptr);
59885         LDKScoreUpdate this_ptr_conv = *(LDKScoreUpdate*)(this_ptr_ptr);
59886         FREE(untag_ptr(this_ptr));
59887         ScoreUpdate_free(this_ptr_conv);
59888 }
59889
59890 void  __attribute__((export_name("TS_Score_free"))) TS_Score_free(uint64_t this_ptr) {
59891         if (!ptr_is_owned(this_ptr)) return;
59892         void* this_ptr_ptr = untag_ptr(this_ptr);
59893         CHECK_ACCESS(this_ptr_ptr);
59894         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
59895         FREE(untag_ptr(this_ptr));
59896         Score_free(this_ptr_conv);
59897 }
59898
59899 void  __attribute__((export_name("TS_LockableScore_free"))) TS_LockableScore_free(uint64_t this_ptr) {
59900         if (!ptr_is_owned(this_ptr)) return;
59901         void* this_ptr_ptr = untag_ptr(this_ptr);
59902         CHECK_ACCESS(this_ptr_ptr);
59903         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
59904         FREE(untag_ptr(this_ptr));
59905         LockableScore_free(this_ptr_conv);
59906 }
59907
59908 void  __attribute__((export_name("TS_WriteableScore_free"))) TS_WriteableScore_free(uint64_t this_ptr) {
59909         if (!ptr_is_owned(this_ptr)) return;
59910         void* this_ptr_ptr = untag_ptr(this_ptr);
59911         CHECK_ACCESS(this_ptr_ptr);
59912         LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
59913         FREE(untag_ptr(this_ptr));
59914         WriteableScore_free(this_ptr_conv);
59915 }
59916
59917 void  __attribute__((export_name("TS_MultiThreadedLockableScore_free"))) TS_MultiThreadedLockableScore_free(uint64_t this_obj) {
59918         LDKMultiThreadedLockableScore this_obj_conv;
59919         this_obj_conv.inner = untag_ptr(this_obj);
59920         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59922         MultiThreadedLockableScore_free(this_obj_conv);
59923 }
59924
59925 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_LockableScore"))) TS_MultiThreadedLockableScore_as_LockableScore(uint64_t this_arg) {
59926         LDKMultiThreadedLockableScore this_arg_conv;
59927         this_arg_conv.inner = untag_ptr(this_arg);
59928         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59930         this_arg_conv.is_owned = false;
59931         LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
59932         *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
59933         return tag_ptr(ret_ret, true);
59934 }
59935
59936 int8_tArray  __attribute__((export_name("TS_MultiThreadedLockableScore_write"))) TS_MultiThreadedLockableScore_write(uint64_t obj) {
59937         LDKMultiThreadedLockableScore obj_conv;
59938         obj_conv.inner = untag_ptr(obj);
59939         obj_conv.is_owned = ptr_is_owned(obj);
59940         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59941         obj_conv.is_owned = false;
59942         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
59943         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59944         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59945         CVec_u8Z_free(ret_var);
59946         return ret_arr;
59947 }
59948
59949 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_WriteableScore"))) TS_MultiThreadedLockableScore_as_WriteableScore(uint64_t this_arg) {
59950         LDKMultiThreadedLockableScore this_arg_conv;
59951         this_arg_conv.inner = untag_ptr(this_arg);
59952         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59954         this_arg_conv.is_owned = false;
59955         LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
59956         *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
59957         return tag_ptr(ret_ret, true);
59958 }
59959
59960 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_new"))) TS_MultiThreadedLockableScore_new(uint64_t score) {
59961         void* score_ptr = untag_ptr(score);
59962         CHECK_ACCESS(score_ptr);
59963         LDKScore score_conv = *(LDKScore*)(score_ptr);
59964         if (score_conv.free == LDKScore_JCalls_free) {
59965                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
59966                 LDKScore_JCalls_cloned(&score_conv);
59967         }
59968         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
59969         uint64_t ret_ref = 0;
59970         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59971         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59972         return ret_ref;
59973 }
59974
59975 void  __attribute__((export_name("TS_MultiThreadedScoreLockRead_free"))) TS_MultiThreadedScoreLockRead_free(uint64_t this_obj) {
59976         LDKMultiThreadedScoreLockRead this_obj_conv;
59977         this_obj_conv.inner = untag_ptr(this_obj);
59978         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59980         MultiThreadedScoreLockRead_free(this_obj_conv);
59981 }
59982
59983 void  __attribute__((export_name("TS_MultiThreadedScoreLockWrite_free"))) TS_MultiThreadedScoreLockWrite_free(uint64_t this_obj) {
59984         LDKMultiThreadedScoreLockWrite this_obj_conv;
59985         this_obj_conv.inner = untag_ptr(this_obj);
59986         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59988         MultiThreadedScoreLockWrite_free(this_obj_conv);
59989 }
59990
59991 uint64_t  __attribute__((export_name("TS_MultiThreadedScoreLockRead_as_ScoreLookUp"))) TS_MultiThreadedScoreLockRead_as_ScoreLookUp(uint64_t this_arg) {
59992         LDKMultiThreadedScoreLockRead this_arg_conv;
59993         this_arg_conv.inner = untag_ptr(this_arg);
59994         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59996         this_arg_conv.is_owned = false;
59997         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
59998         *ret_ret = MultiThreadedScoreLockRead_as_ScoreLookUp(&this_arg_conv);
59999         return tag_ptr(ret_ret, true);
60000 }
60001
60002 int8_tArray  __attribute__((export_name("TS_MultiThreadedScoreLockWrite_write"))) TS_MultiThreadedScoreLockWrite_write(uint64_t obj) {
60003         LDKMultiThreadedScoreLockWrite obj_conv;
60004         obj_conv.inner = untag_ptr(obj);
60005         obj_conv.is_owned = ptr_is_owned(obj);
60006         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60007         obj_conv.is_owned = false;
60008         LDKCVec_u8Z ret_var = MultiThreadedScoreLockWrite_write(&obj_conv);
60009         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60010         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60011         CVec_u8Z_free(ret_var);
60012         return ret_arr;
60013 }
60014
60015 uint64_t  __attribute__((export_name("TS_MultiThreadedScoreLockWrite_as_ScoreUpdate"))) TS_MultiThreadedScoreLockWrite_as_ScoreUpdate(uint64_t this_arg) {
60016         LDKMultiThreadedScoreLockWrite this_arg_conv;
60017         this_arg_conv.inner = untag_ptr(this_arg);
60018         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60020         this_arg_conv.is_owned = false;
60021         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
60022         *ret_ret = MultiThreadedScoreLockWrite_as_ScoreUpdate(&this_arg_conv);
60023         return tag_ptr(ret_ret, true);
60024 }
60025
60026 void  __attribute__((export_name("TS_ChannelUsage_free"))) TS_ChannelUsage_free(uint64_t this_obj) {
60027         LDKChannelUsage this_obj_conv;
60028         this_obj_conv.inner = untag_ptr(this_obj);
60029         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60031         ChannelUsage_free(this_obj_conv);
60032 }
60033
60034 int64_t  __attribute__((export_name("TS_ChannelUsage_get_amount_msat"))) TS_ChannelUsage_get_amount_msat(uint64_t this_ptr) {
60035         LDKChannelUsage this_ptr_conv;
60036         this_ptr_conv.inner = untag_ptr(this_ptr);
60037         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60039         this_ptr_conv.is_owned = false;
60040         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
60041         return ret_conv;
60042 }
60043
60044 void  __attribute__((export_name("TS_ChannelUsage_set_amount_msat"))) TS_ChannelUsage_set_amount_msat(uint64_t this_ptr, int64_t val) {
60045         LDKChannelUsage this_ptr_conv;
60046         this_ptr_conv.inner = untag_ptr(this_ptr);
60047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60049         this_ptr_conv.is_owned = false;
60050         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
60051 }
60052
60053 int64_t  __attribute__((export_name("TS_ChannelUsage_get_inflight_htlc_msat"))) TS_ChannelUsage_get_inflight_htlc_msat(uint64_t this_ptr) {
60054         LDKChannelUsage this_ptr_conv;
60055         this_ptr_conv.inner = untag_ptr(this_ptr);
60056         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60058         this_ptr_conv.is_owned = false;
60059         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
60060         return ret_conv;
60061 }
60062
60063 void  __attribute__((export_name("TS_ChannelUsage_set_inflight_htlc_msat"))) TS_ChannelUsage_set_inflight_htlc_msat(uint64_t this_ptr, int64_t val) {
60064         LDKChannelUsage this_ptr_conv;
60065         this_ptr_conv.inner = untag_ptr(this_ptr);
60066         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60068         this_ptr_conv.is_owned = false;
60069         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
60070 }
60071
60072 uint64_t  __attribute__((export_name("TS_ChannelUsage_get_effective_capacity"))) TS_ChannelUsage_get_effective_capacity(uint64_t this_ptr) {
60073         LDKChannelUsage this_ptr_conv;
60074         this_ptr_conv.inner = untag_ptr(this_ptr);
60075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60077         this_ptr_conv.is_owned = false;
60078         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
60079         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
60080         uint64_t ret_ref = tag_ptr(ret_copy, true);
60081         return ret_ref;
60082 }
60083
60084 void  __attribute__((export_name("TS_ChannelUsage_set_effective_capacity"))) TS_ChannelUsage_set_effective_capacity(uint64_t this_ptr, uint64_t val) {
60085         LDKChannelUsage this_ptr_conv;
60086         this_ptr_conv.inner = untag_ptr(this_ptr);
60087         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60089         this_ptr_conv.is_owned = false;
60090         void* val_ptr = untag_ptr(val);
60091         CHECK_ACCESS(val_ptr);
60092         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
60093         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
60094         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
60095 }
60096
60097 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) {
60098         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
60099         CHECK_ACCESS(effective_capacity_arg_ptr);
60100         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
60101         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
60102         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
60103         uint64_t ret_ref = 0;
60104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60106         return ret_ref;
60107 }
60108
60109 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
60110         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
60111         uint64_t ret_ref = 0;
60112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60114         return ret_ref;
60115 }
60116 int64_t  __attribute__((export_name("TS_ChannelUsage_clone_ptr"))) TS_ChannelUsage_clone_ptr(uint64_t arg) {
60117         LDKChannelUsage arg_conv;
60118         arg_conv.inner = untag_ptr(arg);
60119         arg_conv.is_owned = ptr_is_owned(arg);
60120         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60121         arg_conv.is_owned = false;
60122         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
60123         return ret_conv;
60124 }
60125
60126 uint64_t  __attribute__((export_name("TS_ChannelUsage_clone"))) TS_ChannelUsage_clone(uint64_t orig) {
60127         LDKChannelUsage orig_conv;
60128         orig_conv.inner = untag_ptr(orig);
60129         orig_conv.is_owned = ptr_is_owned(orig);
60130         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60131         orig_conv.is_owned = false;
60132         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
60133         uint64_t ret_ref = 0;
60134         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60135         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60136         return ret_ref;
60137 }
60138
60139 void  __attribute__((export_name("TS_FixedPenaltyScorer_free"))) TS_FixedPenaltyScorer_free(uint64_t this_obj) {
60140         LDKFixedPenaltyScorer this_obj_conv;
60141         this_obj_conv.inner = untag_ptr(this_obj);
60142         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60144         FixedPenaltyScorer_free(this_obj_conv);
60145 }
60146
60147 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
60148         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
60149         uint64_t ret_ref = 0;
60150         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60151         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60152         return ret_ref;
60153 }
60154 int64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone_ptr"))) TS_FixedPenaltyScorer_clone_ptr(uint64_t arg) {
60155         LDKFixedPenaltyScorer arg_conv;
60156         arg_conv.inner = untag_ptr(arg);
60157         arg_conv.is_owned = ptr_is_owned(arg);
60158         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60159         arg_conv.is_owned = false;
60160         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
60161         return ret_conv;
60162 }
60163
60164 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone"))) TS_FixedPenaltyScorer_clone(uint64_t orig) {
60165         LDKFixedPenaltyScorer orig_conv;
60166         orig_conv.inner = untag_ptr(orig);
60167         orig_conv.is_owned = ptr_is_owned(orig);
60168         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60169         orig_conv.is_owned = false;
60170         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
60171         uint64_t ret_ref = 0;
60172         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60173         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60174         return ret_ref;
60175 }
60176
60177 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_with_penalty"))) TS_FixedPenaltyScorer_with_penalty(int64_t penalty_msat) {
60178         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
60179         uint64_t ret_ref = 0;
60180         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60181         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60182         return ret_ref;
60183 }
60184
60185 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_as_ScoreLookUp"))) TS_FixedPenaltyScorer_as_ScoreLookUp(uint64_t this_arg) {
60186         LDKFixedPenaltyScorer this_arg_conv;
60187         this_arg_conv.inner = untag_ptr(this_arg);
60188         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60190         this_arg_conv.is_owned = false;
60191         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
60192         *ret_ret = FixedPenaltyScorer_as_ScoreLookUp(&this_arg_conv);
60193         return tag_ptr(ret_ret, true);
60194 }
60195
60196 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_as_ScoreUpdate"))) TS_FixedPenaltyScorer_as_ScoreUpdate(uint64_t this_arg) {
60197         LDKFixedPenaltyScorer this_arg_conv;
60198         this_arg_conv.inner = untag_ptr(this_arg);
60199         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60201         this_arg_conv.is_owned = false;
60202         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
60203         *ret_ret = FixedPenaltyScorer_as_ScoreUpdate(&this_arg_conv);
60204         return tag_ptr(ret_ret, true);
60205 }
60206
60207 int8_tArray  __attribute__((export_name("TS_FixedPenaltyScorer_write"))) TS_FixedPenaltyScorer_write(uint64_t obj) {
60208         LDKFixedPenaltyScorer obj_conv;
60209         obj_conv.inner = untag_ptr(obj);
60210         obj_conv.is_owned = ptr_is_owned(obj);
60211         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60212         obj_conv.is_owned = false;
60213         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
60214         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60215         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60216         CVec_u8Z_free(ret_var);
60217         return ret_arr;
60218 }
60219
60220 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_read"))) TS_FixedPenaltyScorer_read(int8_tArray ser, int64_t arg) {
60221         LDKu8slice ser_ref;
60222         ser_ref.datalen = ser->arr_len;
60223         ser_ref.data = ser->elems;
60224         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
60225         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
60226         FREE(ser);
60227         return tag_ptr(ret_conv, true);
60228 }
60229
60230 void  __attribute__((export_name("TS_ProbabilisticScorer_free"))) TS_ProbabilisticScorer_free(uint64_t this_obj) {
60231         LDKProbabilisticScorer this_obj_conv;
60232         this_obj_conv.inner = untag_ptr(this_obj);
60233         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60235         ProbabilisticScorer_free(this_obj_conv);
60236 }
60237
60238 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_free"))) TS_ProbabilisticScoringFeeParameters_free(uint64_t this_obj) {
60239         LDKProbabilisticScoringFeeParameters this_obj_conv;
60240         this_obj_conv.inner = untag_ptr(this_obj);
60241         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60243         ProbabilisticScoringFeeParameters_free(this_obj_conv);
60244 }
60245
60246 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_base_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_get_base_penalty_msat(uint64_t this_ptr) {
60247         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60248         this_ptr_conv.inner = untag_ptr(this_ptr);
60249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60251         this_ptr_conv.is_owned = false;
60252         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_msat(&this_ptr_conv);
60253         return ret_conv;
60254 }
60255
60256 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_set_base_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_set_base_penalty_msat(uint64_t this_ptr, int64_t val) {
60257         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60258         this_ptr_conv.inner = untag_ptr(this_ptr);
60259         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60261         this_ptr_conv.is_owned = false;
60262         ProbabilisticScoringFeeParameters_set_base_penalty_msat(&this_ptr_conv, val);
60263 }
60264
60265 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) {
60266         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60267         this_ptr_conv.inner = untag_ptr(this_ptr);
60268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60270         this_ptr_conv.is_owned = false;
60271         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
60272         return ret_conv;
60273 }
60274
60275 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) {
60276         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60277         this_ptr_conv.inner = untag_ptr(this_ptr);
60278         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60280         this_ptr_conv.is_owned = false;
60281         ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
60282 }
60283
60284 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(uint64_t this_ptr) {
60285         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60286         this_ptr_conv.inner = untag_ptr(this_ptr);
60287         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60289         this_ptr_conv.is_owned = false;
60290         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
60291         return ret_conv;
60292 }
60293
60294 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) {
60295         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60296         this_ptr_conv.inner = untag_ptr(this_ptr);
60297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60299         this_ptr_conv.is_owned = false;
60300         ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
60301 }
60302
60303 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) {
60304         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60305         this_ptr_conv.inner = untag_ptr(this_ptr);
60306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60308         this_ptr_conv.is_owned = false;
60309         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
60310         return ret_conv;
60311 }
60312
60313 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) {
60314         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60315         this_ptr_conv.inner = untag_ptr(this_ptr);
60316         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60318         this_ptr_conv.is_owned = false;
60319         ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
60320 }
60321
60322 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) {
60323         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60324         this_ptr_conv.inner = untag_ptr(this_ptr);
60325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60327         this_ptr_conv.is_owned = false;
60328         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv);
60329         return ret_conv;
60330 }
60331
60332 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) {
60333         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60334         this_ptr_conv.inner = untag_ptr(this_ptr);
60335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60337         this_ptr_conv.is_owned = false;
60338         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
60339 }
60340
60341 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) {
60342         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60343         this_ptr_conv.inner = untag_ptr(this_ptr);
60344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60346         this_ptr_conv.is_owned = false;
60347         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
60348         return ret_conv;
60349 }
60350
60351 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) {
60352         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60353         this_ptr_conv.inner = untag_ptr(this_ptr);
60354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60356         this_ptr_conv.is_owned = false;
60357         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
60358 }
60359
60360 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(uint64_t this_ptr) {
60361         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60362         this_ptr_conv.inner = untag_ptr(this_ptr);
60363         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60365         this_ptr_conv.is_owned = false;
60366         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
60367         return ret_conv;
60368 }
60369
60370 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) {
60371         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60372         this_ptr_conv.inner = untag_ptr(this_ptr);
60373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60375         this_ptr_conv.is_owned = false;
60376         ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
60377 }
60378
60379 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(uint64_t this_ptr) {
60380         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60381         this_ptr_conv.inner = untag_ptr(this_ptr);
60382         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60384         this_ptr_conv.is_owned = false;
60385         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
60386         return ret_conv;
60387 }
60388
60389 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) {
60390         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60391         this_ptr_conv.inner = untag_ptr(this_ptr);
60392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60394         this_ptr_conv.is_owned = false;
60395         ProbabilisticScoringFeeParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
60396 }
60397
60398 jboolean  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_linear_success_probability"))) TS_ProbabilisticScoringFeeParameters_get_linear_success_probability(uint64_t this_ptr) {
60399         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60400         this_ptr_conv.inner = untag_ptr(this_ptr);
60401         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60403         this_ptr_conv.is_owned = false;
60404         jboolean ret_conv = ProbabilisticScoringFeeParameters_get_linear_success_probability(&this_ptr_conv);
60405         return ret_conv;
60406 }
60407
60408 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_set_linear_success_probability"))) TS_ProbabilisticScoringFeeParameters_set_linear_success_probability(uint64_t this_ptr, jboolean val) {
60409         LDKProbabilisticScoringFeeParameters this_ptr_conv;
60410         this_ptr_conv.inner = untag_ptr(this_ptr);
60411         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60413         this_ptr_conv.is_owned = false;
60414         ProbabilisticScoringFeeParameters_set_linear_success_probability(&this_ptr_conv, val);
60415 }
60416
60417 static inline uint64_t ProbabilisticScoringFeeParameters_clone_ptr(LDKProbabilisticScoringFeeParameters *NONNULL_PTR arg) {
60418         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(arg);
60419         uint64_t ret_ref = 0;
60420         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60421         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60422         return ret_ref;
60423 }
60424 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_clone_ptr"))) TS_ProbabilisticScoringFeeParameters_clone_ptr(uint64_t arg) {
60425         LDKProbabilisticScoringFeeParameters arg_conv;
60426         arg_conv.inner = untag_ptr(arg);
60427         arg_conv.is_owned = ptr_is_owned(arg);
60428         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60429         arg_conv.is_owned = false;
60430         int64_t ret_conv = ProbabilisticScoringFeeParameters_clone_ptr(&arg_conv);
60431         return ret_conv;
60432 }
60433
60434 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_clone"))) TS_ProbabilisticScoringFeeParameters_clone(uint64_t orig) {
60435         LDKProbabilisticScoringFeeParameters orig_conv;
60436         orig_conv.inner = untag_ptr(orig);
60437         orig_conv.is_owned = ptr_is_owned(orig);
60438         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60439         orig_conv.is_owned = false;
60440         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(&orig_conv);
60441         uint64_t ret_ref = 0;
60442         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60443         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60444         return ret_ref;
60445 }
60446
60447 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_default"))) TS_ProbabilisticScoringFeeParameters_default() {
60448         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_default();
60449         uint64_t ret_ref = 0;
60450         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60451         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60452         return ret_ref;
60453 }
60454
60455 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_add_banned"))) TS_ProbabilisticScoringFeeParameters_add_banned(uint64_t this_arg, uint64_t node_id) {
60456         LDKProbabilisticScoringFeeParameters this_arg_conv;
60457         this_arg_conv.inner = untag_ptr(this_arg);
60458         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60460         this_arg_conv.is_owned = false;
60461         LDKNodeId node_id_conv;
60462         node_id_conv.inner = untag_ptr(node_id);
60463         node_id_conv.is_owned = ptr_is_owned(node_id);
60464         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
60465         node_id_conv.is_owned = false;
60466         ProbabilisticScoringFeeParameters_add_banned(&this_arg_conv, &node_id_conv);
60467 }
60468
60469 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_add_banned_from_list"))) TS_ProbabilisticScoringFeeParameters_add_banned_from_list(uint64_t this_arg, uint64_tArray node_ids) {
60470         LDKProbabilisticScoringFeeParameters this_arg_conv;
60471         this_arg_conv.inner = untag_ptr(this_arg);
60472         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60474         this_arg_conv.is_owned = false;
60475         LDKCVec_NodeIdZ node_ids_constr;
60476         node_ids_constr.datalen = node_ids->arr_len;
60477         if (node_ids_constr.datalen > 0)
60478                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
60479         else
60480                 node_ids_constr.data = NULL;
60481         uint64_t* node_ids_vals = node_ids->elems;
60482         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
60483                 uint64_t node_ids_conv_8 = node_ids_vals[i];
60484                 LDKNodeId node_ids_conv_8_conv;
60485                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
60486                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
60487                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
60488                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
60489                 node_ids_constr.data[i] = node_ids_conv_8_conv;
60490         }
60491         FREE(node_ids);
60492         ProbabilisticScoringFeeParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
60493 }
60494
60495 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_remove_banned"))) TS_ProbabilisticScoringFeeParameters_remove_banned(uint64_t this_arg, uint64_t node_id) {
60496         LDKProbabilisticScoringFeeParameters this_arg_conv;
60497         this_arg_conv.inner = untag_ptr(this_arg);
60498         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60500         this_arg_conv.is_owned = false;
60501         LDKNodeId node_id_conv;
60502         node_id_conv.inner = untag_ptr(node_id);
60503         node_id_conv.is_owned = ptr_is_owned(node_id);
60504         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
60505         node_id_conv.is_owned = false;
60506         ProbabilisticScoringFeeParameters_remove_banned(&this_arg_conv, &node_id_conv);
60507 }
60508
60509 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) {
60510         LDKProbabilisticScoringFeeParameters this_arg_conv;
60511         this_arg_conv.inner = untag_ptr(this_arg);
60512         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60514         this_arg_conv.is_owned = false;
60515         LDKNodeId node_id_conv;
60516         node_id_conv.inner = untag_ptr(node_id);
60517         node_id_conv.is_owned = ptr_is_owned(node_id);
60518         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
60519         node_id_conv.is_owned = false;
60520         ProbabilisticScoringFeeParameters_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
60521 }
60522
60523 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_remove_manual_penalty"))) TS_ProbabilisticScoringFeeParameters_remove_manual_penalty(uint64_t this_arg, uint64_t node_id) {
60524         LDKProbabilisticScoringFeeParameters this_arg_conv;
60525         this_arg_conv.inner = untag_ptr(this_arg);
60526         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60528         this_arg_conv.is_owned = false;
60529         LDKNodeId node_id_conv;
60530         node_id_conv.inner = untag_ptr(node_id);
60531         node_id_conv.is_owned = ptr_is_owned(node_id);
60532         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
60533         node_id_conv.is_owned = false;
60534         ProbabilisticScoringFeeParameters_remove_manual_penalty(&this_arg_conv, &node_id_conv);
60535 }
60536
60537 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_clear_manual_penalties"))) TS_ProbabilisticScoringFeeParameters_clear_manual_penalties(uint64_t this_arg) {
60538         LDKProbabilisticScoringFeeParameters this_arg_conv;
60539         this_arg_conv.inner = untag_ptr(this_arg);
60540         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60542         this_arg_conv.is_owned = false;
60543         ProbabilisticScoringFeeParameters_clear_manual_penalties(&this_arg_conv);
60544 }
60545
60546 void  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_free"))) TS_ProbabilisticScoringDecayParameters_free(uint64_t this_obj) {
60547         LDKProbabilisticScoringDecayParameters this_obj_conv;
60548         this_obj_conv.inner = untag_ptr(this_obj);
60549         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60551         ProbabilisticScoringDecayParameters_free(this_obj_conv);
60552 }
60553
60554 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) {
60555         LDKProbabilisticScoringDecayParameters this_ptr_conv;
60556         this_ptr_conv.inner = untag_ptr(this_ptr);
60557         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60559         this_ptr_conv.is_owned = false;
60560         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(&this_ptr_conv);
60561         return ret_conv;
60562 }
60563
60564 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) {
60565         LDKProbabilisticScoringDecayParameters this_ptr_conv;
60566         this_ptr_conv.inner = untag_ptr(this_ptr);
60567         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60569         this_ptr_conv.is_owned = false;
60570         ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(&this_ptr_conv, val);
60571 }
60572
60573 int64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life"))) TS_ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(uint64_t this_ptr) {
60574         LDKProbabilisticScoringDecayParameters this_ptr_conv;
60575         this_ptr_conv.inner = untag_ptr(this_ptr);
60576         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60578         this_ptr_conv.is_owned = false;
60579         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(&this_ptr_conv);
60580         return ret_conv;
60581 }
60582
60583 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) {
60584         LDKProbabilisticScoringDecayParameters this_ptr_conv;
60585         this_ptr_conv.inner = untag_ptr(this_ptr);
60586         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60588         this_ptr_conv.is_owned = false;
60589         ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
60590 }
60591
60592 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) {
60593         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_new(historical_no_updates_half_life_arg, liquidity_offset_half_life_arg);
60594         uint64_t ret_ref = 0;
60595         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60596         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60597         return ret_ref;
60598 }
60599
60600 static inline uint64_t ProbabilisticScoringDecayParameters_clone_ptr(LDKProbabilisticScoringDecayParameters *NONNULL_PTR arg) {
60601         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(arg);
60602         uint64_t ret_ref = 0;
60603         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60604         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60605         return ret_ref;
60606 }
60607 int64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_clone_ptr"))) TS_ProbabilisticScoringDecayParameters_clone_ptr(uint64_t arg) {
60608         LDKProbabilisticScoringDecayParameters arg_conv;
60609         arg_conv.inner = untag_ptr(arg);
60610         arg_conv.is_owned = ptr_is_owned(arg);
60611         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60612         arg_conv.is_owned = false;
60613         int64_t ret_conv = ProbabilisticScoringDecayParameters_clone_ptr(&arg_conv);
60614         return ret_conv;
60615 }
60616
60617 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_clone"))) TS_ProbabilisticScoringDecayParameters_clone(uint64_t orig) {
60618         LDKProbabilisticScoringDecayParameters orig_conv;
60619         orig_conv.inner = untag_ptr(orig);
60620         orig_conv.is_owned = ptr_is_owned(orig);
60621         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60622         orig_conv.is_owned = false;
60623         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(&orig_conv);
60624         uint64_t ret_ref = 0;
60625         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60626         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60627         return ret_ref;
60628 }
60629
60630 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_default"))) TS_ProbabilisticScoringDecayParameters_default() {
60631         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_default();
60632         uint64_t ret_ref = 0;
60633         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60634         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60635         return ret_ref;
60636 }
60637
60638 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_new"))) TS_ProbabilisticScorer_new(uint64_t decay_params, uint64_t network_graph, uint64_t logger) {
60639         LDKProbabilisticScoringDecayParameters decay_params_conv;
60640         decay_params_conv.inner = untag_ptr(decay_params);
60641         decay_params_conv.is_owned = ptr_is_owned(decay_params);
60642         CHECK_INNER_FIELD_ACCESS_OR_NULL(decay_params_conv);
60643         decay_params_conv = ProbabilisticScoringDecayParameters_clone(&decay_params_conv);
60644         LDKNetworkGraph network_graph_conv;
60645         network_graph_conv.inner = untag_ptr(network_graph);
60646         network_graph_conv.is_owned = ptr_is_owned(network_graph);
60647         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
60648         network_graph_conv.is_owned = false;
60649         void* logger_ptr = untag_ptr(logger);
60650         CHECK_ACCESS(logger_ptr);
60651         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
60652         if (logger_conv.free == LDKLogger_JCalls_free) {
60653                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
60654                 LDKLogger_JCalls_cloned(&logger_conv);
60655         }
60656         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(decay_params_conv, &network_graph_conv, logger_conv);
60657         uint64_t ret_ref = 0;
60658         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60659         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60660         return ret_ref;
60661 }
60662
60663 void  __attribute__((export_name("TS_ProbabilisticScorer_debug_log_liquidity_stats"))) TS_ProbabilisticScorer_debug_log_liquidity_stats(uint64_t this_arg) {
60664         LDKProbabilisticScorer this_arg_conv;
60665         this_arg_conv.inner = untag_ptr(this_arg);
60666         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60668         this_arg_conv.is_owned = false;
60669         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
60670 }
60671
60672 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) {
60673         LDKProbabilisticScorer this_arg_conv;
60674         this_arg_conv.inner = untag_ptr(this_arg);
60675         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60677         this_arg_conv.is_owned = false;
60678         LDKNodeId target_conv;
60679         target_conv.inner = untag_ptr(target);
60680         target_conv.is_owned = ptr_is_owned(target);
60681         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
60682         target_conv.is_owned = false;
60683         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
60684         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
60685         uint64_t ret_ref = tag_ptr(ret_copy, true);
60686         return ret_ref;
60687 }
60688
60689 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) {
60690         LDKProbabilisticScorer this_arg_conv;
60691         this_arg_conv.inner = untag_ptr(this_arg);
60692         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60694         this_arg_conv.is_owned = false;
60695         LDKNodeId target_conv;
60696         target_conv.inner = untag_ptr(target);
60697         target_conv.is_owned = ptr_is_owned(target);
60698         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
60699         target_conv.is_owned = false;
60700         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
60701         *ret_copy = ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(&this_arg_conv, scid, &target_conv);
60702         uint64_t ret_ref = tag_ptr(ret_copy, true);
60703         return ret_ref;
60704 }
60705
60706 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) {
60707         LDKProbabilisticScorer this_arg_conv;
60708         this_arg_conv.inner = untag_ptr(this_arg);
60709         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60711         this_arg_conv.is_owned = false;
60712         LDKNodeId target_conv;
60713         target_conv.inner = untag_ptr(target);
60714         target_conv.is_owned = ptr_is_owned(target);
60715         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
60716         target_conv.is_owned = false;
60717         LDKProbabilisticScoringFeeParameters params_conv;
60718         params_conv.inner = untag_ptr(params);
60719         params_conv.is_owned = ptr_is_owned(params);
60720         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
60721         params_conv.is_owned = false;
60722         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
60723         *ret_copy = ProbabilisticScorer_historical_estimated_payment_success_probability(&this_arg_conv, scid, &target_conv, amount_msat, &params_conv);
60724         uint64_t ret_ref = tag_ptr(ret_copy, true);
60725         return ret_ref;
60726 }
60727
60728 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_ScoreLookUp"))) TS_ProbabilisticScorer_as_ScoreLookUp(uint64_t this_arg) {
60729         LDKProbabilisticScorer this_arg_conv;
60730         this_arg_conv.inner = untag_ptr(this_arg);
60731         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60733         this_arg_conv.is_owned = false;
60734         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
60735         *ret_ret = ProbabilisticScorer_as_ScoreLookUp(&this_arg_conv);
60736         return tag_ptr(ret_ret, true);
60737 }
60738
60739 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_ScoreUpdate"))) TS_ProbabilisticScorer_as_ScoreUpdate(uint64_t this_arg) {
60740         LDKProbabilisticScorer this_arg_conv;
60741         this_arg_conv.inner = untag_ptr(this_arg);
60742         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60744         this_arg_conv.is_owned = false;
60745         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
60746         *ret_ret = ProbabilisticScorer_as_ScoreUpdate(&this_arg_conv);
60747         return tag_ptr(ret_ret, true);
60748 }
60749
60750 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_Score"))) TS_ProbabilisticScorer_as_Score(uint64_t this_arg) {
60751         LDKProbabilisticScorer this_arg_conv;
60752         this_arg_conv.inner = untag_ptr(this_arg);
60753         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60755         this_arg_conv.is_owned = false;
60756         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
60757         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
60758         return tag_ptr(ret_ret, true);
60759 }
60760
60761 int8_tArray  __attribute__((export_name("TS_ProbabilisticScorer_write"))) TS_ProbabilisticScorer_write(uint64_t obj) {
60762         LDKProbabilisticScorer obj_conv;
60763         obj_conv.inner = untag_ptr(obj);
60764         obj_conv.is_owned = ptr_is_owned(obj);
60765         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60766         obj_conv.is_owned = false;
60767         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
60768         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60769         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60770         CVec_u8Z_free(ret_var);
60771         return ret_arr;
60772 }
60773
60774 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) {
60775         LDKu8slice ser_ref;
60776         ser_ref.datalen = ser->arr_len;
60777         ser_ref.data = ser->elems;
60778         LDKProbabilisticScoringDecayParameters arg_a_conv;
60779         arg_a_conv.inner = untag_ptr(arg_a);
60780         arg_a_conv.is_owned = ptr_is_owned(arg_a);
60781         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
60782         arg_a_conv = ProbabilisticScoringDecayParameters_clone(&arg_a_conv);
60783         LDKNetworkGraph arg_b_conv;
60784         arg_b_conv.inner = untag_ptr(arg_b);
60785         arg_b_conv.is_owned = ptr_is_owned(arg_b);
60786         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
60787         arg_b_conv.is_owned = false;
60788         void* arg_c_ptr = untag_ptr(arg_c);
60789         CHECK_ACCESS(arg_c_ptr);
60790         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
60791         if (arg_c_conv.free == LDKLogger_JCalls_free) {
60792                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
60793                 LDKLogger_JCalls_cloned(&arg_c_conv);
60794         }
60795         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
60796         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
60797         FREE(ser);
60798         return tag_ptr(ret_conv, true);
60799 }
60800
60801 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_free"))) TS_DelayedPaymentOutputDescriptor_free(uint64_t this_obj) {
60802         LDKDelayedPaymentOutputDescriptor this_obj_conv;
60803         this_obj_conv.inner = untag_ptr(this_obj);
60804         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60806         DelayedPaymentOutputDescriptor_free(this_obj_conv);
60807 }
60808
60809 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_outpoint"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
60810         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
60811         this_ptr_conv.inner = untag_ptr(this_ptr);
60812         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60814         this_ptr_conv.is_owned = false;
60815         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
60816         uint64_t ret_ref = 0;
60817         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60818         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60819         return ret_ref;
60820 }
60821
60822 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_outpoint"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
60823         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
60824         this_ptr_conv.inner = untag_ptr(this_ptr);
60825         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60827         this_ptr_conv.is_owned = false;
60828         LDKOutPoint val_conv;
60829         val_conv.inner = untag_ptr(val);
60830         val_conv.is_owned = ptr_is_owned(val);
60831         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
60832         val_conv = OutPoint_clone(&val_conv);
60833         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
60834 }
60835
60836 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint64_t this_ptr) {
60837         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
60838         this_ptr_conv.inner = untag_ptr(this_ptr);
60839         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60841         this_ptr_conv.is_owned = false;
60842         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
60843         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
60844         return ret_arr;
60845 }
60846
60847 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
60848         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
60849         this_ptr_conv.inner = untag_ptr(this_ptr);
60850         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60852         this_ptr_conv.is_owned = false;
60853         LDKPublicKey val_ref;
60854         CHECK(val->arr_len == 33);
60855         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
60856         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
60857 }
60858
60859 int16_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint64_t this_ptr) {
60860         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
60861         this_ptr_conv.inner = untag_ptr(this_ptr);
60862         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60864         this_ptr_conv.is_owned = false;
60865         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
60866         return ret_conv;
60867 }
60868
60869 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint64_t this_ptr, int16_t val) {
60870         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
60871         this_ptr_conv.inner = untag_ptr(this_ptr);
60872         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60874         this_ptr_conv.is_owned = false;
60875         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
60876 }
60877
60878 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_output"))) TS_DelayedPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
60879         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
60880         this_ptr_conv.inner = untag_ptr(this_ptr);
60881         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60883         this_ptr_conv.is_owned = false;
60884         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
60885         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
60886         return tag_ptr(ret_ref, true);
60887 }
60888
60889 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_output"))) TS_DelayedPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
60890         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
60891         this_ptr_conv.inner = untag_ptr(this_ptr);
60892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60894         this_ptr_conv.is_owned = false;
60895         void* val_ptr = untag_ptr(val);
60896         CHECK_ACCESS(val_ptr);
60897         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
60898         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
60899         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
60900 }
60901
60902 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint64_t this_ptr) {
60903         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
60904         this_ptr_conv.inner = untag_ptr(this_ptr);
60905         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60907         this_ptr_conv.is_owned = false;
60908         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
60909         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
60910         return ret_arr;
60911 }
60912
60913 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint64_t this_ptr, int8_tArray val) {
60914         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
60915         this_ptr_conv.inner = untag_ptr(this_ptr);
60916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60918         this_ptr_conv.is_owned = false;
60919         LDKPublicKey val_ref;
60920         CHECK(val->arr_len == 33);
60921         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
60922         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
60923 }
60924
60925 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
60926         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
60927         this_ptr_conv.inner = untag_ptr(this_ptr);
60928         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60930         this_ptr_conv.is_owned = false;
60931         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
60932         memcpy(ret_arr->elems, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
60933         return ret_arr;
60934 }
60935
60936 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
60937         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
60938         this_ptr_conv.inner = untag_ptr(this_ptr);
60939         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60941         this_ptr_conv.is_owned = false;
60942         LDKThirtyTwoBytes val_ref;
60943         CHECK(val->arr_len == 32);
60944         memcpy(val_ref.data, val->elems, 32); FREE(val);
60945         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
60946 }
60947
60948 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
60949         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
60950         this_ptr_conv.inner = untag_ptr(this_ptr);
60951         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60953         this_ptr_conv.is_owned = false;
60954         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
60955         return ret_conv;
60956 }
60957
60958 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
60959         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
60960         this_ptr_conv.inner = untag_ptr(this_ptr);
60961         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60963         this_ptr_conv.is_owned = false;
60964         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
60965 }
60966
60967 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) {
60968         LDKOutPoint outpoint_arg_conv;
60969         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
60970         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
60971         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
60972         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
60973         LDKPublicKey per_commitment_point_arg_ref;
60974         CHECK(per_commitment_point_arg->arr_len == 33);
60975         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
60976         void* output_arg_ptr = untag_ptr(output_arg);
60977         CHECK_ACCESS(output_arg_ptr);
60978         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
60979         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
60980         LDKPublicKey revocation_pubkey_arg_ref;
60981         CHECK(revocation_pubkey_arg->arr_len == 33);
60982         memcpy(revocation_pubkey_arg_ref.compressed_form, revocation_pubkey_arg->elems, 33); FREE(revocation_pubkey_arg);
60983         LDKThirtyTwoBytes channel_keys_id_arg_ref;
60984         CHECK(channel_keys_id_arg->arr_len == 32);
60985         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
60986         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);
60987         uint64_t ret_ref = 0;
60988         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60989         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60990         return ret_ref;
60991 }
60992
60993 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
60994         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
60995         uint64_t ret_ref = 0;
60996         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60997         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60998         return ret_ref;
60999 }
61000 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone_ptr"))) TS_DelayedPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
61001         LDKDelayedPaymentOutputDescriptor arg_conv;
61002         arg_conv.inner = untag_ptr(arg);
61003         arg_conv.is_owned = ptr_is_owned(arg);
61004         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61005         arg_conv.is_owned = false;
61006         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
61007         return ret_conv;
61008 }
61009
61010 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone"))) TS_DelayedPaymentOutputDescriptor_clone(uint64_t orig) {
61011         LDKDelayedPaymentOutputDescriptor orig_conv;
61012         orig_conv.inner = untag_ptr(orig);
61013         orig_conv.is_owned = ptr_is_owned(orig);
61014         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61015         orig_conv.is_owned = false;
61016         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
61017         uint64_t ret_ref = 0;
61018         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61019         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61020         return ret_ref;
61021 }
61022
61023 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_hash"))) TS_DelayedPaymentOutputDescriptor_hash(uint64_t o) {
61024         LDKDelayedPaymentOutputDescriptor o_conv;
61025         o_conv.inner = untag_ptr(o);
61026         o_conv.is_owned = ptr_is_owned(o);
61027         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61028         o_conv.is_owned = false;
61029         int64_t ret_conv = DelayedPaymentOutputDescriptor_hash(&o_conv);
61030         return ret_conv;
61031 }
61032
61033 jboolean  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_eq"))) TS_DelayedPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
61034         LDKDelayedPaymentOutputDescriptor a_conv;
61035         a_conv.inner = untag_ptr(a);
61036         a_conv.is_owned = ptr_is_owned(a);
61037         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
61038         a_conv.is_owned = false;
61039         LDKDelayedPaymentOutputDescriptor b_conv;
61040         b_conv.inner = untag_ptr(b);
61041         b_conv.is_owned = ptr_is_owned(b);
61042         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
61043         b_conv.is_owned = false;
61044         jboolean ret_conv = DelayedPaymentOutputDescriptor_eq(&a_conv, &b_conv);
61045         return ret_conv;
61046 }
61047
61048 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_write"))) TS_DelayedPaymentOutputDescriptor_write(uint64_t obj) {
61049         LDKDelayedPaymentOutputDescriptor obj_conv;
61050         obj_conv.inner = untag_ptr(obj);
61051         obj_conv.is_owned = ptr_is_owned(obj);
61052         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61053         obj_conv.is_owned = false;
61054         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
61055         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61056         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61057         CVec_u8Z_free(ret_var);
61058         return ret_arr;
61059 }
61060
61061 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_read"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
61062         LDKu8slice ser_ref;
61063         ser_ref.datalen = ser->arr_len;
61064         ser_ref.data = ser->elems;
61065         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
61066         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
61067         FREE(ser);
61068         return tag_ptr(ret_conv, true);
61069 }
61070
61071 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_free"))) TS_StaticPaymentOutputDescriptor_free(uint64_t this_obj) {
61072         LDKStaticPaymentOutputDescriptor this_obj_conv;
61073         this_obj_conv.inner = untag_ptr(this_obj);
61074         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61076         StaticPaymentOutputDescriptor_free(this_obj_conv);
61077 }
61078
61079 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_outpoint"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
61080         LDKStaticPaymentOutputDescriptor this_ptr_conv;
61081         this_ptr_conv.inner = untag_ptr(this_ptr);
61082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61084         this_ptr_conv.is_owned = false;
61085         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
61086         uint64_t ret_ref = 0;
61087         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61088         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61089         return ret_ref;
61090 }
61091
61092 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_outpoint"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
61093         LDKStaticPaymentOutputDescriptor this_ptr_conv;
61094         this_ptr_conv.inner = untag_ptr(this_ptr);
61095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61097         this_ptr_conv.is_owned = false;
61098         LDKOutPoint val_conv;
61099         val_conv.inner = untag_ptr(val);
61100         val_conv.is_owned = ptr_is_owned(val);
61101         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
61102         val_conv = OutPoint_clone(&val_conv);
61103         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
61104 }
61105
61106 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_output"))) TS_StaticPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
61107         LDKStaticPaymentOutputDescriptor this_ptr_conv;
61108         this_ptr_conv.inner = untag_ptr(this_ptr);
61109         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61111         this_ptr_conv.is_owned = false;
61112         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
61113         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
61114         return tag_ptr(ret_ref, true);
61115 }
61116
61117 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_output"))) TS_StaticPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
61118         LDKStaticPaymentOutputDescriptor this_ptr_conv;
61119         this_ptr_conv.inner = untag_ptr(this_ptr);
61120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61122         this_ptr_conv.is_owned = false;
61123         void* val_ptr = untag_ptr(val);
61124         CHECK_ACCESS(val_ptr);
61125         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
61126         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
61127         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
61128 }
61129
61130 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
61131         LDKStaticPaymentOutputDescriptor this_ptr_conv;
61132         this_ptr_conv.inner = untag_ptr(this_ptr);
61133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61135         this_ptr_conv.is_owned = false;
61136         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
61137         memcpy(ret_arr->elems, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
61138         return ret_arr;
61139 }
61140
61141 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
61142         LDKStaticPaymentOutputDescriptor this_ptr_conv;
61143         this_ptr_conv.inner = untag_ptr(this_ptr);
61144         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61146         this_ptr_conv.is_owned = false;
61147         LDKThirtyTwoBytes val_ref;
61148         CHECK(val->arr_len == 32);
61149         memcpy(val_ref.data, val->elems, 32); FREE(val);
61150         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
61151 }
61152
61153 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
61154         LDKStaticPaymentOutputDescriptor this_ptr_conv;
61155         this_ptr_conv.inner = untag_ptr(this_ptr);
61156         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61158         this_ptr_conv.is_owned = false;
61159         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
61160         return ret_conv;
61161 }
61162
61163 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
61164         LDKStaticPaymentOutputDescriptor this_ptr_conv;
61165         this_ptr_conv.inner = untag_ptr(this_ptr);
61166         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61168         this_ptr_conv.is_owned = false;
61169         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
61170 }
61171
61172 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_transaction_parameters"))) TS_StaticPaymentOutputDescriptor_get_channel_transaction_parameters(uint64_t this_ptr) {
61173         LDKStaticPaymentOutputDescriptor this_ptr_conv;
61174         this_ptr_conv.inner = untag_ptr(this_ptr);
61175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61177         this_ptr_conv.is_owned = false;
61178         LDKChannelTransactionParameters ret_var = StaticPaymentOutputDescriptor_get_channel_transaction_parameters(&this_ptr_conv);
61179         uint64_t ret_ref = 0;
61180         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61181         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61182         return ret_ref;
61183 }
61184
61185 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_transaction_parameters"))) TS_StaticPaymentOutputDescriptor_set_channel_transaction_parameters(uint64_t this_ptr, uint64_t val) {
61186         LDKStaticPaymentOutputDescriptor this_ptr_conv;
61187         this_ptr_conv.inner = untag_ptr(this_ptr);
61188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61190         this_ptr_conv.is_owned = false;
61191         LDKChannelTransactionParameters val_conv;
61192         val_conv.inner = untag_ptr(val);
61193         val_conv.is_owned = ptr_is_owned(val);
61194         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
61195         val_conv = ChannelTransactionParameters_clone(&val_conv);
61196         StaticPaymentOutputDescriptor_set_channel_transaction_parameters(&this_ptr_conv, val_conv);
61197 }
61198
61199 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) {
61200         LDKOutPoint outpoint_arg_conv;
61201         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
61202         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
61203         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
61204         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
61205         void* output_arg_ptr = untag_ptr(output_arg);
61206         CHECK_ACCESS(output_arg_ptr);
61207         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
61208         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
61209         LDKThirtyTwoBytes channel_keys_id_arg_ref;
61210         CHECK(channel_keys_id_arg->arr_len == 32);
61211         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
61212         LDKChannelTransactionParameters channel_transaction_parameters_arg_conv;
61213         channel_transaction_parameters_arg_conv.inner = untag_ptr(channel_transaction_parameters_arg);
61214         channel_transaction_parameters_arg_conv.is_owned = ptr_is_owned(channel_transaction_parameters_arg);
61215         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_transaction_parameters_arg_conv);
61216         channel_transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&channel_transaction_parameters_arg_conv);
61217         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);
61218         uint64_t ret_ref = 0;
61219         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61220         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61221         return ret_ref;
61222 }
61223
61224 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
61225         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
61226         uint64_t ret_ref = 0;
61227         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61228         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61229         return ret_ref;
61230 }
61231 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone_ptr"))) TS_StaticPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
61232         LDKStaticPaymentOutputDescriptor arg_conv;
61233         arg_conv.inner = untag_ptr(arg);
61234         arg_conv.is_owned = ptr_is_owned(arg);
61235         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61236         arg_conv.is_owned = false;
61237         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
61238         return ret_conv;
61239 }
61240
61241 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone"))) TS_StaticPaymentOutputDescriptor_clone(uint64_t orig) {
61242         LDKStaticPaymentOutputDescriptor orig_conv;
61243         orig_conv.inner = untag_ptr(orig);
61244         orig_conv.is_owned = ptr_is_owned(orig);
61245         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61246         orig_conv.is_owned = false;
61247         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
61248         uint64_t ret_ref = 0;
61249         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61250         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61251         return ret_ref;
61252 }
61253
61254 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_hash"))) TS_StaticPaymentOutputDescriptor_hash(uint64_t o) {
61255         LDKStaticPaymentOutputDescriptor o_conv;
61256         o_conv.inner = untag_ptr(o);
61257         o_conv.is_owned = ptr_is_owned(o);
61258         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61259         o_conv.is_owned = false;
61260         int64_t ret_conv = StaticPaymentOutputDescriptor_hash(&o_conv);
61261         return ret_conv;
61262 }
61263
61264 jboolean  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_eq"))) TS_StaticPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
61265         LDKStaticPaymentOutputDescriptor a_conv;
61266         a_conv.inner = untag_ptr(a);
61267         a_conv.is_owned = ptr_is_owned(a);
61268         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
61269         a_conv.is_owned = false;
61270         LDKStaticPaymentOutputDescriptor b_conv;
61271         b_conv.inner = untag_ptr(b);
61272         b_conv.is_owned = ptr_is_owned(b);
61273         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
61274         b_conv.is_owned = false;
61275         jboolean ret_conv = StaticPaymentOutputDescriptor_eq(&a_conv, &b_conv);
61276         return ret_conv;
61277 }
61278
61279 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_witness_script"))) TS_StaticPaymentOutputDescriptor_witness_script(uint64_t this_arg) {
61280         LDKStaticPaymentOutputDescriptor this_arg_conv;
61281         this_arg_conv.inner = untag_ptr(this_arg);
61282         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61284         this_arg_conv.is_owned = false;
61285         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
61286         *ret_copy = StaticPaymentOutputDescriptor_witness_script(&this_arg_conv);
61287         uint64_t ret_ref = tag_ptr(ret_copy, true);
61288         return ret_ref;
61289 }
61290
61291 uint32_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_max_witness_length"))) TS_StaticPaymentOutputDescriptor_max_witness_length(uint64_t this_arg) {
61292         LDKStaticPaymentOutputDescriptor this_arg_conv;
61293         this_arg_conv.inner = untag_ptr(this_arg);
61294         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61296         this_arg_conv.is_owned = false;
61297         uint32_t ret_conv = StaticPaymentOutputDescriptor_max_witness_length(&this_arg_conv);
61298         return ret_conv;
61299 }
61300
61301 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_write"))) TS_StaticPaymentOutputDescriptor_write(uint64_t obj) {
61302         LDKStaticPaymentOutputDescriptor obj_conv;
61303         obj_conv.inner = untag_ptr(obj);
61304         obj_conv.is_owned = ptr_is_owned(obj);
61305         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61306         obj_conv.is_owned = false;
61307         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
61308         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61309         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61310         CVec_u8Z_free(ret_var);
61311         return ret_arr;
61312 }
61313
61314 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_read"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
61315         LDKu8slice ser_ref;
61316         ser_ref.datalen = ser->arr_len;
61317         ser_ref.data = ser->elems;
61318         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
61319         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
61320         FREE(ser);
61321         return tag_ptr(ret_conv, true);
61322 }
61323
61324 void  __attribute__((export_name("TS_SpendableOutputDescriptor_free"))) TS_SpendableOutputDescriptor_free(uint64_t this_ptr) {
61325         if (!ptr_is_owned(this_ptr)) return;
61326         void* this_ptr_ptr = untag_ptr(this_ptr);
61327         CHECK_ACCESS(this_ptr_ptr);
61328         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
61329         FREE(untag_ptr(this_ptr));
61330         SpendableOutputDescriptor_free(this_ptr_conv);
61331 }
61332
61333 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
61334         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
61335         *ret_copy = SpendableOutputDescriptor_clone(arg);
61336         uint64_t ret_ref = tag_ptr(ret_copy, true);
61337         return ret_ref;
61338 }
61339 int64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone_ptr"))) TS_SpendableOutputDescriptor_clone_ptr(uint64_t arg) {
61340         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
61341         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
61342         return ret_conv;
61343 }
61344
61345 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone"))) TS_SpendableOutputDescriptor_clone(uint64_t orig) {
61346         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
61347         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
61348         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
61349         uint64_t ret_ref = tag_ptr(ret_copy, true);
61350         return ret_ref;
61351 }
61352
61353 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_output"))) TS_SpendableOutputDescriptor_static_output(uint64_t outpoint, uint64_t output) {
61354         LDKOutPoint outpoint_conv;
61355         outpoint_conv.inner = untag_ptr(outpoint);
61356         outpoint_conv.is_owned = ptr_is_owned(outpoint);
61357         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
61358         outpoint_conv = OutPoint_clone(&outpoint_conv);
61359         void* output_ptr = untag_ptr(output);
61360         CHECK_ACCESS(output_ptr);
61361         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
61362         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
61363         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
61364         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
61365         uint64_t ret_ref = tag_ptr(ret_copy, true);
61366         return ret_ref;
61367 }
61368
61369 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_delayed_payment_output"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint64_t a) {
61370         LDKDelayedPaymentOutputDescriptor a_conv;
61371         a_conv.inner = untag_ptr(a);
61372         a_conv.is_owned = ptr_is_owned(a);
61373         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
61374         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
61375         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
61376         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
61377         uint64_t ret_ref = tag_ptr(ret_copy, true);
61378         return ret_ref;
61379 }
61380
61381 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_payment_output"))) TS_SpendableOutputDescriptor_static_payment_output(uint64_t a) {
61382         LDKStaticPaymentOutputDescriptor a_conv;
61383         a_conv.inner = untag_ptr(a);
61384         a_conv.is_owned = ptr_is_owned(a);
61385         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
61386         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
61387         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
61388         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
61389         uint64_t ret_ref = tag_ptr(ret_copy, true);
61390         return ret_ref;
61391 }
61392
61393 int64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_hash"))) TS_SpendableOutputDescriptor_hash(uint64_t o) {
61394         LDKSpendableOutputDescriptor* o_conv = (LDKSpendableOutputDescriptor*)untag_ptr(o);
61395         int64_t ret_conv = SpendableOutputDescriptor_hash(o_conv);
61396         return ret_conv;
61397 }
61398
61399 jboolean  __attribute__((export_name("TS_SpendableOutputDescriptor_eq"))) TS_SpendableOutputDescriptor_eq(uint64_t a, uint64_t b) {
61400         LDKSpendableOutputDescriptor* a_conv = (LDKSpendableOutputDescriptor*)untag_ptr(a);
61401         LDKSpendableOutputDescriptor* b_conv = (LDKSpendableOutputDescriptor*)untag_ptr(b);
61402         jboolean ret_conv = SpendableOutputDescriptor_eq(a_conv, b_conv);
61403         return ret_conv;
61404 }
61405
61406 int8_tArray  __attribute__((export_name("TS_SpendableOutputDescriptor_write"))) TS_SpendableOutputDescriptor_write(uint64_t obj) {
61407         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
61408         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
61409         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61410         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61411         CVec_u8Z_free(ret_var);
61412         return ret_arr;
61413 }
61414
61415 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_read"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
61416         LDKu8slice ser_ref;
61417         ser_ref.datalen = ser->arr_len;
61418         ser_ref.data = ser->elems;
61419         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
61420         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
61421         FREE(ser);
61422         return tag_ptr(ret_conv, true);
61423 }
61424
61425 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) {
61426         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
61427         descriptors_constr.datalen = descriptors->arr_len;
61428         if (descriptors_constr.datalen > 0)
61429                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
61430         else
61431                 descriptors_constr.data = NULL;
61432         uint64_t* descriptors_vals = descriptors->elems;
61433         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
61434                 uint64_t descriptors_conv_27 = descriptors_vals[b];
61435                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
61436                 CHECK_ACCESS(descriptors_conv_27_ptr);
61437                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
61438                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
61439                 descriptors_constr.data[b] = descriptors_conv_27_conv;
61440         }
61441         FREE(descriptors);
61442         LDKCVec_TxOutZ outputs_constr;
61443         outputs_constr.datalen = outputs->arr_len;
61444         if (outputs_constr.datalen > 0)
61445                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
61446         else
61447                 outputs_constr.data = NULL;
61448         uint64_t* outputs_vals = outputs->elems;
61449         for (size_t h = 0; h < outputs_constr.datalen; h++) {
61450                 uint64_t outputs_conv_7 = outputs_vals[h];
61451                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
61452                 CHECK_ACCESS(outputs_conv_7_ptr);
61453                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
61454                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
61455                 outputs_constr.data[h] = outputs_conv_7_conv;
61456         }
61457         FREE(outputs);
61458         LDKCVec_u8Z change_destination_script_ref;
61459         change_destination_script_ref.datalen = change_destination_script->arr_len;
61460         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
61461         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
61462         void* locktime_ptr = untag_ptr(locktime);
61463         CHECK_ACCESS(locktime_ptr);
61464         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
61465         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
61466         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ), "LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ");
61467         *ret_conv = SpendableOutputDescriptor_create_spendable_outputs_psbt(descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
61468         return tag_ptr(ret_conv, true);
61469 }
61470
61471 void  __attribute__((export_name("TS_ChannelSigner_free"))) TS_ChannelSigner_free(uint64_t this_ptr) {
61472         if (!ptr_is_owned(this_ptr)) return;
61473         void* this_ptr_ptr = untag_ptr(this_ptr);
61474         CHECK_ACCESS(this_ptr_ptr);
61475         LDKChannelSigner this_ptr_conv = *(LDKChannelSigner*)(this_ptr_ptr);
61476         FREE(untag_ptr(this_ptr));
61477         ChannelSigner_free(this_ptr_conv);
61478 }
61479
61480 void  __attribute__((export_name("TS_EcdsaChannelSigner_free"))) TS_EcdsaChannelSigner_free(uint64_t this_ptr) {
61481         if (!ptr_is_owned(this_ptr)) return;
61482         void* this_ptr_ptr = untag_ptr(this_ptr);
61483         CHECK_ACCESS(this_ptr_ptr);
61484         LDKEcdsaChannelSigner this_ptr_conv = *(LDKEcdsaChannelSigner*)(this_ptr_ptr);
61485         FREE(untag_ptr(this_ptr));
61486         EcdsaChannelSigner_free(this_ptr_conv);
61487 }
61488
61489 static inline uint64_t WriteableEcdsaChannelSigner_clone_ptr(LDKWriteableEcdsaChannelSigner *NONNULL_PTR arg) {
61490         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
61491         *ret_ret = WriteableEcdsaChannelSigner_clone(arg);
61492         return tag_ptr(ret_ret, true);
61493 }
61494 int64_t  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_clone_ptr"))) TS_WriteableEcdsaChannelSigner_clone_ptr(uint64_t arg) {
61495         void* arg_ptr = untag_ptr(arg);
61496         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
61497         LDKWriteableEcdsaChannelSigner* arg_conv = (LDKWriteableEcdsaChannelSigner*)arg_ptr;
61498         int64_t ret_conv = WriteableEcdsaChannelSigner_clone_ptr(arg_conv);
61499         return ret_conv;
61500 }
61501
61502 uint64_t  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_clone"))) TS_WriteableEcdsaChannelSigner_clone(uint64_t orig) {
61503         void* orig_ptr = untag_ptr(orig);
61504         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
61505         LDKWriteableEcdsaChannelSigner* orig_conv = (LDKWriteableEcdsaChannelSigner*)orig_ptr;
61506         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
61507         *ret_ret = WriteableEcdsaChannelSigner_clone(orig_conv);
61508         return tag_ptr(ret_ret, true);
61509 }
61510
61511 void  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_free"))) TS_WriteableEcdsaChannelSigner_free(uint64_t this_ptr) {
61512         if (!ptr_is_owned(this_ptr)) return;
61513         void* this_ptr_ptr = untag_ptr(this_ptr);
61514         CHECK_ACCESS(this_ptr_ptr);
61515         LDKWriteableEcdsaChannelSigner this_ptr_conv = *(LDKWriteableEcdsaChannelSigner*)(this_ptr_ptr);
61516         FREE(untag_ptr(this_ptr));
61517         WriteableEcdsaChannelSigner_free(this_ptr_conv);
61518 }
61519
61520 uint32_t  __attribute__((export_name("TS_Recipient_clone"))) TS_Recipient_clone(uint64_t orig) {
61521         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
61522         uint32_t ret_conv = LDKRecipient_to_js(Recipient_clone(orig_conv));
61523         return ret_conv;
61524 }
61525
61526 uint32_t  __attribute__((export_name("TS_Recipient_node"))) TS_Recipient_node() {
61527         uint32_t ret_conv = LDKRecipient_to_js(Recipient_node());
61528         return ret_conv;
61529 }
61530
61531 uint32_t  __attribute__((export_name("TS_Recipient_phantom_node"))) TS_Recipient_phantom_node() {
61532         uint32_t ret_conv = LDKRecipient_to_js(Recipient_phantom_node());
61533         return ret_conv;
61534 }
61535
61536 void  __attribute__((export_name("TS_EntropySource_free"))) TS_EntropySource_free(uint64_t this_ptr) {
61537         if (!ptr_is_owned(this_ptr)) return;
61538         void* this_ptr_ptr = untag_ptr(this_ptr);
61539         CHECK_ACCESS(this_ptr_ptr);
61540         LDKEntropySource this_ptr_conv = *(LDKEntropySource*)(this_ptr_ptr);
61541         FREE(untag_ptr(this_ptr));
61542         EntropySource_free(this_ptr_conv);
61543 }
61544
61545 void  __attribute__((export_name("TS_NodeSigner_free"))) TS_NodeSigner_free(uint64_t this_ptr) {
61546         if (!ptr_is_owned(this_ptr)) return;
61547         void* this_ptr_ptr = untag_ptr(this_ptr);
61548         CHECK_ACCESS(this_ptr_ptr);
61549         LDKNodeSigner this_ptr_conv = *(LDKNodeSigner*)(this_ptr_ptr);
61550         FREE(untag_ptr(this_ptr));
61551         NodeSigner_free(this_ptr_conv);
61552 }
61553
61554 void  __attribute__((export_name("TS_SignerProvider_free"))) TS_SignerProvider_free(uint64_t this_ptr) {
61555         if (!ptr_is_owned(this_ptr)) return;
61556         void* this_ptr_ptr = untag_ptr(this_ptr);
61557         CHECK_ACCESS(this_ptr_ptr);
61558         LDKSignerProvider this_ptr_conv = *(LDKSignerProvider*)(this_ptr_ptr);
61559         FREE(untag_ptr(this_ptr));
61560         SignerProvider_free(this_ptr_conv);
61561 }
61562
61563 void  __attribute__((export_name("TS_InMemorySigner_free"))) TS_InMemorySigner_free(uint64_t this_obj) {
61564         LDKInMemorySigner this_obj_conv;
61565         this_obj_conv.inner = untag_ptr(this_obj);
61566         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61568         InMemorySigner_free(this_obj_conv);
61569 }
61570
61571 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_funding_key"))) TS_InMemorySigner_get_funding_key(uint64_t this_ptr) {
61572         LDKInMemorySigner this_ptr_conv;
61573         this_ptr_conv.inner = untag_ptr(this_ptr);
61574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61576         this_ptr_conv.is_owned = false;
61577         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
61578         memcpy(ret_arr->elems, *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
61579         return ret_arr;
61580 }
61581
61582 void  __attribute__((export_name("TS_InMemorySigner_set_funding_key"))) TS_InMemorySigner_set_funding_key(uint64_t this_ptr, int8_tArray val) {
61583         LDKInMemorySigner this_ptr_conv;
61584         this_ptr_conv.inner = untag_ptr(this_ptr);
61585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61587         this_ptr_conv.is_owned = false;
61588         LDKSecretKey val_ref;
61589         CHECK(val->arr_len == 32);
61590         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
61591         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
61592 }
61593
61594 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_revocation_base_key"))) TS_InMemorySigner_get_revocation_base_key(uint64_t this_ptr) {
61595         LDKInMemorySigner this_ptr_conv;
61596         this_ptr_conv.inner = untag_ptr(this_ptr);
61597         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61599         this_ptr_conv.is_owned = false;
61600         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
61601         memcpy(ret_arr->elems, *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
61602         return ret_arr;
61603 }
61604
61605 void  __attribute__((export_name("TS_InMemorySigner_set_revocation_base_key"))) TS_InMemorySigner_set_revocation_base_key(uint64_t this_ptr, int8_tArray val) {
61606         LDKInMemorySigner this_ptr_conv;
61607         this_ptr_conv.inner = untag_ptr(this_ptr);
61608         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61610         this_ptr_conv.is_owned = false;
61611         LDKSecretKey val_ref;
61612         CHECK(val->arr_len == 32);
61613         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
61614         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
61615 }
61616
61617 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_payment_key"))) TS_InMemorySigner_get_payment_key(uint64_t this_ptr) {
61618         LDKInMemorySigner this_ptr_conv;
61619         this_ptr_conv.inner = untag_ptr(this_ptr);
61620         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61622         this_ptr_conv.is_owned = false;
61623         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
61624         memcpy(ret_arr->elems, *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
61625         return ret_arr;
61626 }
61627
61628 void  __attribute__((export_name("TS_InMemorySigner_set_payment_key"))) TS_InMemorySigner_set_payment_key(uint64_t this_ptr, int8_tArray val) {
61629         LDKInMemorySigner this_ptr_conv;
61630         this_ptr_conv.inner = untag_ptr(this_ptr);
61631         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61633         this_ptr_conv.is_owned = false;
61634         LDKSecretKey val_ref;
61635         CHECK(val->arr_len == 32);
61636         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
61637         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
61638 }
61639
61640 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_delayed_payment_base_key"))) TS_InMemorySigner_get_delayed_payment_base_key(uint64_t this_ptr) {
61641         LDKInMemorySigner this_ptr_conv;
61642         this_ptr_conv.inner = untag_ptr(this_ptr);
61643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61645         this_ptr_conv.is_owned = false;
61646         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
61647         memcpy(ret_arr->elems, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
61648         return ret_arr;
61649 }
61650
61651 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) {
61652         LDKInMemorySigner this_ptr_conv;
61653         this_ptr_conv.inner = untag_ptr(this_ptr);
61654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61656         this_ptr_conv.is_owned = false;
61657         LDKSecretKey val_ref;
61658         CHECK(val->arr_len == 32);
61659         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
61660         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
61661 }
61662
61663 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_htlc_base_key"))) TS_InMemorySigner_get_htlc_base_key(uint64_t this_ptr) {
61664         LDKInMemorySigner this_ptr_conv;
61665         this_ptr_conv.inner = untag_ptr(this_ptr);
61666         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61668         this_ptr_conv.is_owned = false;
61669         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
61670         memcpy(ret_arr->elems, *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
61671         return ret_arr;
61672 }
61673
61674 void  __attribute__((export_name("TS_InMemorySigner_set_htlc_base_key"))) TS_InMemorySigner_set_htlc_base_key(uint64_t this_ptr, int8_tArray val) {
61675         LDKInMemorySigner this_ptr_conv;
61676         this_ptr_conv.inner = untag_ptr(this_ptr);
61677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61679         this_ptr_conv.is_owned = false;
61680         LDKSecretKey val_ref;
61681         CHECK(val->arr_len == 32);
61682         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
61683         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
61684 }
61685
61686 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_commitment_seed"))) TS_InMemorySigner_get_commitment_seed(uint64_t this_ptr) {
61687         LDKInMemorySigner this_ptr_conv;
61688         this_ptr_conv.inner = untag_ptr(this_ptr);
61689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61691         this_ptr_conv.is_owned = false;
61692         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
61693         memcpy(ret_arr->elems, *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
61694         return ret_arr;
61695 }
61696
61697 void  __attribute__((export_name("TS_InMemorySigner_set_commitment_seed"))) TS_InMemorySigner_set_commitment_seed(uint64_t this_ptr, int8_tArray val) {
61698         LDKInMemorySigner this_ptr_conv;
61699         this_ptr_conv.inner = untag_ptr(this_ptr);
61700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61702         this_ptr_conv.is_owned = false;
61703         LDKThirtyTwoBytes val_ref;
61704         CHECK(val->arr_len == 32);
61705         memcpy(val_ref.data, val->elems, 32); FREE(val);
61706         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
61707 }
61708
61709 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
61710         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
61711         uint64_t ret_ref = 0;
61712         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61713         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61714         return ret_ref;
61715 }
61716 int64_t  __attribute__((export_name("TS_InMemorySigner_clone_ptr"))) TS_InMemorySigner_clone_ptr(uint64_t arg) {
61717         LDKInMemorySigner arg_conv;
61718         arg_conv.inner = untag_ptr(arg);
61719         arg_conv.is_owned = ptr_is_owned(arg);
61720         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61721         arg_conv.is_owned = false;
61722         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
61723         return ret_conv;
61724 }
61725
61726 uint64_t  __attribute__((export_name("TS_InMemorySigner_clone"))) TS_InMemorySigner_clone(uint64_t orig) {
61727         LDKInMemorySigner orig_conv;
61728         orig_conv.inner = untag_ptr(orig);
61729         orig_conv.is_owned = ptr_is_owned(orig);
61730         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61731         orig_conv.is_owned = false;
61732         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
61733         uint64_t ret_ref = 0;
61734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61736         return ret_ref;
61737 }
61738
61739 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) {
61740         LDKSecretKey funding_key_ref;
61741         CHECK(funding_key->arr_len == 32);
61742         memcpy(funding_key_ref.bytes, funding_key->elems, 32); FREE(funding_key);
61743         LDKSecretKey revocation_base_key_ref;
61744         CHECK(revocation_base_key->arr_len == 32);
61745         memcpy(revocation_base_key_ref.bytes, revocation_base_key->elems, 32); FREE(revocation_base_key);
61746         LDKSecretKey payment_key_ref;
61747         CHECK(payment_key->arr_len == 32);
61748         memcpy(payment_key_ref.bytes, payment_key->elems, 32); FREE(payment_key);
61749         LDKSecretKey delayed_payment_base_key_ref;
61750         CHECK(delayed_payment_base_key->arr_len == 32);
61751         memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key->elems, 32); FREE(delayed_payment_base_key);
61752         LDKSecretKey htlc_base_key_ref;
61753         CHECK(htlc_base_key->arr_len == 32);
61754         memcpy(htlc_base_key_ref.bytes, htlc_base_key->elems, 32); FREE(htlc_base_key);
61755         LDKThirtyTwoBytes commitment_seed_ref;
61756         CHECK(commitment_seed->arr_len == 32);
61757         memcpy(commitment_seed_ref.data, commitment_seed->elems, 32); FREE(commitment_seed);
61758         LDKThirtyTwoBytes channel_keys_id_ref;
61759         CHECK(channel_keys_id->arr_len == 32);
61760         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
61761         LDKThirtyTwoBytes rand_bytes_unique_start_ref;
61762         CHECK(rand_bytes_unique_start->arr_len == 32);
61763         memcpy(rand_bytes_unique_start_ref.data, rand_bytes_unique_start->elems, 32); FREE(rand_bytes_unique_start);
61764         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);
61765         uint64_t ret_ref = 0;
61766         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61767         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61768         return ret_ref;
61769 }
61770
61771 uint64_t  __attribute__((export_name("TS_InMemorySigner_counterparty_pubkeys"))) TS_InMemorySigner_counterparty_pubkeys(uint64_t this_arg) {
61772         LDKInMemorySigner this_arg_conv;
61773         this_arg_conv.inner = untag_ptr(this_arg);
61774         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61776         this_arg_conv.is_owned = false;
61777         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
61778         uint64_t ret_ref = 0;
61779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61781         return ret_ref;
61782 }
61783
61784 uint64_t  __attribute__((export_name("TS_InMemorySigner_counterparty_selected_contest_delay"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint64_t this_arg) {
61785         LDKInMemorySigner this_arg_conv;
61786         this_arg_conv.inner = untag_ptr(this_arg);
61787         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61789         this_arg_conv.is_owned = false;
61790         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
61791         *ret_copy = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
61792         uint64_t ret_ref = tag_ptr(ret_copy, true);
61793         return ret_ref;
61794 }
61795
61796 uint64_t  __attribute__((export_name("TS_InMemorySigner_holder_selected_contest_delay"))) TS_InMemorySigner_holder_selected_contest_delay(uint64_t this_arg) {
61797         LDKInMemorySigner this_arg_conv;
61798         this_arg_conv.inner = untag_ptr(this_arg);
61799         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61801         this_arg_conv.is_owned = false;
61802         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
61803         *ret_copy = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
61804         uint64_t ret_ref = tag_ptr(ret_copy, true);
61805         return ret_ref;
61806 }
61807
61808 uint64_t  __attribute__((export_name("TS_InMemorySigner_is_outbound"))) TS_InMemorySigner_is_outbound(uint64_t this_arg) {
61809         LDKInMemorySigner this_arg_conv;
61810         this_arg_conv.inner = untag_ptr(this_arg);
61811         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61813         this_arg_conv.is_owned = false;
61814         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
61815         *ret_copy = InMemorySigner_is_outbound(&this_arg_conv);
61816         uint64_t ret_ref = tag_ptr(ret_copy, true);
61817         return ret_ref;
61818 }
61819
61820 uint64_t  __attribute__((export_name("TS_InMemorySigner_funding_outpoint"))) TS_InMemorySigner_funding_outpoint(uint64_t this_arg) {
61821         LDKInMemorySigner this_arg_conv;
61822         this_arg_conv.inner = untag_ptr(this_arg);
61823         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61825         this_arg_conv.is_owned = false;
61826         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
61827         uint64_t ret_ref = 0;
61828         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61829         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61830         return ret_ref;
61831 }
61832
61833 uint64_t  __attribute__((export_name("TS_InMemorySigner_get_channel_parameters"))) TS_InMemorySigner_get_channel_parameters(uint64_t this_arg) {
61834         LDKInMemorySigner this_arg_conv;
61835         this_arg_conv.inner = untag_ptr(this_arg);
61836         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61838         this_arg_conv.is_owned = false;
61839         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
61840         uint64_t ret_ref = 0;
61841         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61842         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61843         return ret_ref;
61844 }
61845
61846 uint64_t  __attribute__((export_name("TS_InMemorySigner_channel_type_features"))) TS_InMemorySigner_channel_type_features(uint64_t this_arg) {
61847         LDKInMemorySigner this_arg_conv;
61848         this_arg_conv.inner = untag_ptr(this_arg);
61849         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61851         this_arg_conv.is_owned = false;
61852         LDKChannelTypeFeatures ret_var = InMemorySigner_channel_type_features(&this_arg_conv);
61853         uint64_t ret_ref = 0;
61854         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61855         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61856         return ret_ref;
61857 }
61858
61859 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) {
61860         LDKInMemorySigner this_arg_conv;
61861         this_arg_conv.inner = untag_ptr(this_arg);
61862         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61864         this_arg_conv.is_owned = false;
61865         LDKTransaction spend_tx_ref;
61866         spend_tx_ref.datalen = spend_tx->arr_len;
61867         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
61868         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
61869         spend_tx_ref.data_is_owned = true;
61870         LDKStaticPaymentOutputDescriptor descriptor_conv;
61871         descriptor_conv.inner = untag_ptr(descriptor);
61872         descriptor_conv.is_owned = ptr_is_owned(descriptor);
61873         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
61874         descriptor_conv.is_owned = false;
61875         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
61876         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
61877         return tag_ptr(ret_conv, true);
61878 }
61879
61880 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) {
61881         LDKInMemorySigner this_arg_conv;
61882         this_arg_conv.inner = untag_ptr(this_arg);
61883         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61885         this_arg_conv.is_owned = false;
61886         LDKTransaction spend_tx_ref;
61887         spend_tx_ref.datalen = spend_tx->arr_len;
61888         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
61889         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
61890         spend_tx_ref.data_is_owned = true;
61891         LDKDelayedPaymentOutputDescriptor descriptor_conv;
61892         descriptor_conv.inner = untag_ptr(descriptor);
61893         descriptor_conv.is_owned = ptr_is_owned(descriptor);
61894         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
61895         descriptor_conv.is_owned = false;
61896         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
61897         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
61898         return tag_ptr(ret_conv, true);
61899 }
61900
61901 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_EntropySource"))) TS_InMemorySigner_as_EntropySource(uint64_t this_arg) {
61902         LDKInMemorySigner this_arg_conv;
61903         this_arg_conv.inner = untag_ptr(this_arg);
61904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61906         this_arg_conv.is_owned = false;
61907         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
61908         *ret_ret = InMemorySigner_as_EntropySource(&this_arg_conv);
61909         return tag_ptr(ret_ret, true);
61910 }
61911
61912 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_ChannelSigner"))) TS_InMemorySigner_as_ChannelSigner(uint64_t this_arg) {
61913         LDKInMemorySigner this_arg_conv;
61914         this_arg_conv.inner = untag_ptr(this_arg);
61915         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61917         this_arg_conv.is_owned = false;
61918         LDKChannelSigner* ret_ret = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
61919         *ret_ret = InMemorySigner_as_ChannelSigner(&this_arg_conv);
61920         return tag_ptr(ret_ret, true);
61921 }
61922
61923 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_EcdsaChannelSigner"))) TS_InMemorySigner_as_EcdsaChannelSigner(uint64_t this_arg) {
61924         LDKInMemorySigner this_arg_conv;
61925         this_arg_conv.inner = untag_ptr(this_arg);
61926         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61928         this_arg_conv.is_owned = false;
61929         LDKEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
61930         *ret_ret = InMemorySigner_as_EcdsaChannelSigner(&this_arg_conv);
61931         return tag_ptr(ret_ret, true);
61932 }
61933
61934 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_WriteableEcdsaChannelSigner"))) TS_InMemorySigner_as_WriteableEcdsaChannelSigner(uint64_t this_arg) {
61935         LDKInMemorySigner this_arg_conv;
61936         this_arg_conv.inner = untag_ptr(this_arg);
61937         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61939         this_arg_conv.is_owned = false;
61940         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
61941         *ret_ret = InMemorySigner_as_WriteableEcdsaChannelSigner(&this_arg_conv);
61942         return tag_ptr(ret_ret, true);
61943 }
61944
61945 int8_tArray  __attribute__((export_name("TS_InMemorySigner_write"))) TS_InMemorySigner_write(uint64_t obj) {
61946         LDKInMemorySigner obj_conv;
61947         obj_conv.inner = untag_ptr(obj);
61948         obj_conv.is_owned = ptr_is_owned(obj);
61949         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61950         obj_conv.is_owned = false;
61951         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
61952         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61953         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61954         CVec_u8Z_free(ret_var);
61955         return ret_arr;
61956 }
61957
61958 uint64_t  __attribute__((export_name("TS_InMemorySigner_read"))) TS_InMemorySigner_read(int8_tArray ser, uint64_t arg) {
61959         LDKu8slice ser_ref;
61960         ser_ref.datalen = ser->arr_len;
61961         ser_ref.data = ser->elems;
61962         void* arg_ptr = untag_ptr(arg);
61963         CHECK_ACCESS(arg_ptr);
61964         LDKEntropySource arg_conv = *(LDKEntropySource*)(arg_ptr);
61965         if (arg_conv.free == LDKEntropySource_JCalls_free) {
61966                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61967                 LDKEntropySource_JCalls_cloned(&arg_conv);
61968         }
61969         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
61970         *ret_conv = InMemorySigner_read(ser_ref, arg_conv);
61971         FREE(ser);
61972         return tag_ptr(ret_conv, true);
61973 }
61974
61975 void  __attribute__((export_name("TS_KeysManager_free"))) TS_KeysManager_free(uint64_t this_obj) {
61976         LDKKeysManager this_obj_conv;
61977         this_obj_conv.inner = untag_ptr(this_obj);
61978         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61980         KeysManager_free(this_obj_conv);
61981 }
61982
61983 uint64_t  __attribute__((export_name("TS_KeysManager_new"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
61984         uint8_t seed_arr[32];
61985         CHECK(seed->arr_len == 32);
61986         memcpy(seed_arr, seed->elems, 32); FREE(seed);
61987         uint8_t (*seed_ref)[32] = &seed_arr;
61988         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
61989         uint64_t ret_ref = 0;
61990         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61991         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61992         return ret_ref;
61993 }
61994
61995 int8_tArray  __attribute__((export_name("TS_KeysManager_get_node_secret_key"))) TS_KeysManager_get_node_secret_key(uint64_t this_arg) {
61996         LDKKeysManager this_arg_conv;
61997         this_arg_conv.inner = untag_ptr(this_arg);
61998         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62000         this_arg_conv.is_owned = false;
62001         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
62002         memcpy(ret_arr->elems, KeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
62003         return ret_arr;
62004 }
62005
62006 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) {
62007         LDKKeysManager this_arg_conv;
62008         this_arg_conv.inner = untag_ptr(this_arg);
62009         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62011         this_arg_conv.is_owned = false;
62012         uint8_t params_arr[32];
62013         CHECK(params->arr_len == 32);
62014         memcpy(params_arr, params->elems, 32); FREE(params);
62015         uint8_t (*params_ref)[32] = &params_arr;
62016         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
62017         uint64_t ret_ref = 0;
62018         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62019         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62020         return ret_ref;
62021 }
62022
62023 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) {
62024         LDKKeysManager this_arg_conv;
62025         this_arg_conv.inner = untag_ptr(this_arg);
62026         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62028         this_arg_conv.is_owned = false;
62029         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
62030         descriptors_constr.datalen = descriptors->arr_len;
62031         if (descriptors_constr.datalen > 0)
62032                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
62033         else
62034                 descriptors_constr.data = NULL;
62035         uint64_t* descriptors_vals = descriptors->elems;
62036         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
62037                 uint64_t descriptors_conv_27 = descriptors_vals[b];
62038                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
62039                 CHECK_ACCESS(descriptors_conv_27_ptr);
62040                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
62041                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
62042                 descriptors_constr.data[b] = descriptors_conv_27_conv;
62043         }
62044         FREE(descriptors);
62045         LDKCVec_u8Z psbt_ref;
62046         psbt_ref.datalen = psbt->arr_len;
62047         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
62048         memcpy(psbt_ref.data, psbt->elems, psbt_ref.datalen); FREE(psbt);
62049         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
62050         *ret_conv = KeysManager_sign_spendable_outputs_psbt(&this_arg_conv, descriptors_constr, psbt_ref);
62051         return tag_ptr(ret_conv, true);
62052 }
62053
62054 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) {
62055         LDKKeysManager this_arg_conv;
62056         this_arg_conv.inner = untag_ptr(this_arg);
62057         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62059         this_arg_conv.is_owned = false;
62060         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
62061         descriptors_constr.datalen = descriptors->arr_len;
62062         if (descriptors_constr.datalen > 0)
62063                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
62064         else
62065                 descriptors_constr.data = NULL;
62066         uint64_t* descriptors_vals = descriptors->elems;
62067         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
62068                 uint64_t descriptors_conv_27 = descriptors_vals[b];
62069                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
62070                 CHECK_ACCESS(descriptors_conv_27_ptr);
62071                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
62072                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
62073                 descriptors_constr.data[b] = descriptors_conv_27_conv;
62074         }
62075         FREE(descriptors);
62076         LDKCVec_TxOutZ outputs_constr;
62077         outputs_constr.datalen = outputs->arr_len;
62078         if (outputs_constr.datalen > 0)
62079                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
62080         else
62081                 outputs_constr.data = NULL;
62082         uint64_t* outputs_vals = outputs->elems;
62083         for (size_t h = 0; h < outputs_constr.datalen; h++) {
62084                 uint64_t outputs_conv_7 = outputs_vals[h];
62085                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
62086                 CHECK_ACCESS(outputs_conv_7_ptr);
62087                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
62088                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
62089                 outputs_constr.data[h] = outputs_conv_7_conv;
62090         }
62091         FREE(outputs);
62092         LDKCVec_u8Z change_destination_script_ref;
62093         change_destination_script_ref.datalen = change_destination_script->arr_len;
62094         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
62095         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
62096         void* locktime_ptr = untag_ptr(locktime);
62097         CHECK_ACCESS(locktime_ptr);
62098         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
62099         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
62100         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
62101         *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
62102         return tag_ptr(ret_conv, true);
62103 }
62104
62105 uint64_t  __attribute__((export_name("TS_KeysManager_as_EntropySource"))) TS_KeysManager_as_EntropySource(uint64_t this_arg) {
62106         LDKKeysManager this_arg_conv;
62107         this_arg_conv.inner = untag_ptr(this_arg);
62108         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62110         this_arg_conv.is_owned = false;
62111         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
62112         *ret_ret = KeysManager_as_EntropySource(&this_arg_conv);
62113         return tag_ptr(ret_ret, true);
62114 }
62115
62116 uint64_t  __attribute__((export_name("TS_KeysManager_as_NodeSigner"))) TS_KeysManager_as_NodeSigner(uint64_t this_arg) {
62117         LDKKeysManager this_arg_conv;
62118         this_arg_conv.inner = untag_ptr(this_arg);
62119         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62121         this_arg_conv.is_owned = false;
62122         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
62123         *ret_ret = KeysManager_as_NodeSigner(&this_arg_conv);
62124         return tag_ptr(ret_ret, true);
62125 }
62126
62127 uint64_t  __attribute__((export_name("TS_KeysManager_as_SignerProvider"))) TS_KeysManager_as_SignerProvider(uint64_t this_arg) {
62128         LDKKeysManager this_arg_conv;
62129         this_arg_conv.inner = untag_ptr(this_arg);
62130         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62132         this_arg_conv.is_owned = false;
62133         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
62134         *ret_ret = KeysManager_as_SignerProvider(&this_arg_conv);
62135         return tag_ptr(ret_ret, true);
62136 }
62137
62138 void  __attribute__((export_name("TS_PhantomKeysManager_free"))) TS_PhantomKeysManager_free(uint64_t this_obj) {
62139         LDKPhantomKeysManager this_obj_conv;
62140         this_obj_conv.inner = untag_ptr(this_obj);
62141         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62143         PhantomKeysManager_free(this_obj_conv);
62144 }
62145
62146 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_EntropySource"))) TS_PhantomKeysManager_as_EntropySource(uint64_t this_arg) {
62147         LDKPhantomKeysManager this_arg_conv;
62148         this_arg_conv.inner = untag_ptr(this_arg);
62149         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62151         this_arg_conv.is_owned = false;
62152         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
62153         *ret_ret = PhantomKeysManager_as_EntropySource(&this_arg_conv);
62154         return tag_ptr(ret_ret, true);
62155 }
62156
62157 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_NodeSigner"))) TS_PhantomKeysManager_as_NodeSigner(uint64_t this_arg) {
62158         LDKPhantomKeysManager this_arg_conv;
62159         this_arg_conv.inner = untag_ptr(this_arg);
62160         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62162         this_arg_conv.is_owned = false;
62163         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
62164         *ret_ret = PhantomKeysManager_as_NodeSigner(&this_arg_conv);
62165         return tag_ptr(ret_ret, true);
62166 }
62167
62168 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_SignerProvider"))) TS_PhantomKeysManager_as_SignerProvider(uint64_t this_arg) {
62169         LDKPhantomKeysManager this_arg_conv;
62170         this_arg_conv.inner = untag_ptr(this_arg);
62171         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62173         this_arg_conv.is_owned = false;
62174         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
62175         *ret_ret = PhantomKeysManager_as_SignerProvider(&this_arg_conv);
62176         return tag_ptr(ret_ret, true);
62177 }
62178
62179 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) {
62180         uint8_t seed_arr[32];
62181         CHECK(seed->arr_len == 32);
62182         memcpy(seed_arr, seed->elems, 32); FREE(seed);
62183         uint8_t (*seed_ref)[32] = &seed_arr;
62184         uint8_t cross_node_seed_arr[32];
62185         CHECK(cross_node_seed->arr_len == 32);
62186         memcpy(cross_node_seed_arr, cross_node_seed->elems, 32); FREE(cross_node_seed);
62187         uint8_t (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
62188         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
62189         uint64_t ret_ref = 0;
62190         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62191         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62192         return ret_ref;
62193 }
62194
62195 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) {
62196         LDKPhantomKeysManager this_arg_conv;
62197         this_arg_conv.inner = untag_ptr(this_arg);
62198         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62200         this_arg_conv.is_owned = false;
62201         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
62202         descriptors_constr.datalen = descriptors->arr_len;
62203         if (descriptors_constr.datalen > 0)
62204                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
62205         else
62206                 descriptors_constr.data = NULL;
62207         uint64_t* descriptors_vals = descriptors->elems;
62208         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
62209                 uint64_t descriptors_conv_27 = descriptors_vals[b];
62210                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
62211                 CHECK_ACCESS(descriptors_conv_27_ptr);
62212                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
62213                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
62214                 descriptors_constr.data[b] = descriptors_conv_27_conv;
62215         }
62216         FREE(descriptors);
62217         LDKCVec_TxOutZ outputs_constr;
62218         outputs_constr.datalen = outputs->arr_len;
62219         if (outputs_constr.datalen > 0)
62220                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
62221         else
62222                 outputs_constr.data = NULL;
62223         uint64_t* outputs_vals = outputs->elems;
62224         for (size_t h = 0; h < outputs_constr.datalen; h++) {
62225                 uint64_t outputs_conv_7 = outputs_vals[h];
62226                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
62227                 CHECK_ACCESS(outputs_conv_7_ptr);
62228                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
62229                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
62230                 outputs_constr.data[h] = outputs_conv_7_conv;
62231         }
62232         FREE(outputs);
62233         LDKCVec_u8Z change_destination_script_ref;
62234         change_destination_script_ref.datalen = change_destination_script->arr_len;
62235         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
62236         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
62237         void* locktime_ptr = untag_ptr(locktime);
62238         CHECK_ACCESS(locktime_ptr);
62239         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
62240         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
62241         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
62242         *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
62243         return tag_ptr(ret_conv, true);
62244 }
62245
62246 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) {
62247         LDKPhantomKeysManager this_arg_conv;
62248         this_arg_conv.inner = untag_ptr(this_arg);
62249         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62251         this_arg_conv.is_owned = false;
62252         uint8_t params_arr[32];
62253         CHECK(params->arr_len == 32);
62254         memcpy(params_arr, params->elems, 32); FREE(params);
62255         uint8_t (*params_ref)[32] = &params_arr;
62256         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
62257         uint64_t ret_ref = 0;
62258         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62259         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62260         return ret_ref;
62261 }
62262
62263 int8_tArray  __attribute__((export_name("TS_PhantomKeysManager_get_node_secret_key"))) TS_PhantomKeysManager_get_node_secret_key(uint64_t this_arg) {
62264         LDKPhantomKeysManager this_arg_conv;
62265         this_arg_conv.inner = untag_ptr(this_arg);
62266         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62268         this_arg_conv.is_owned = false;
62269         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
62270         memcpy(ret_arr->elems, PhantomKeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
62271         return ret_arr;
62272 }
62273
62274 int8_tArray  __attribute__((export_name("TS_PhantomKeysManager_get_phantom_node_secret_key"))) TS_PhantomKeysManager_get_phantom_node_secret_key(uint64_t this_arg) {
62275         LDKPhantomKeysManager this_arg_conv;
62276         this_arg_conv.inner = untag_ptr(this_arg);
62277         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62279         this_arg_conv.is_owned = false;
62280         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
62281         memcpy(ret_arr->elems, PhantomKeysManager_get_phantom_node_secret_key(&this_arg_conv).bytes, 32);
62282         return ret_arr;
62283 }
62284
62285 void  __attribute__((export_name("TS_OnionMessenger_free"))) TS_OnionMessenger_free(uint64_t this_obj) {
62286         LDKOnionMessenger this_obj_conv;
62287         this_obj_conv.inner = untag_ptr(this_obj);
62288         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62290         OnionMessenger_free(this_obj_conv);
62291 }
62292
62293 void  __attribute__((export_name("TS_MessageRouter_free"))) TS_MessageRouter_free(uint64_t this_ptr) {
62294         if (!ptr_is_owned(this_ptr)) return;
62295         void* this_ptr_ptr = untag_ptr(this_ptr);
62296         CHECK_ACCESS(this_ptr_ptr);
62297         LDKMessageRouter this_ptr_conv = *(LDKMessageRouter*)(this_ptr_ptr);
62298         FREE(untag_ptr(this_ptr));
62299         MessageRouter_free(this_ptr_conv);
62300 }
62301
62302 void  __attribute__((export_name("TS_DefaultMessageRouter_free"))) TS_DefaultMessageRouter_free(uint64_t this_obj) {
62303         LDKDefaultMessageRouter this_obj_conv;
62304         this_obj_conv.inner = untag_ptr(this_obj);
62305         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62307         DefaultMessageRouter_free(this_obj_conv);
62308 }
62309
62310 uint64_t  __attribute__((export_name("TS_DefaultMessageRouter_new"))) TS_DefaultMessageRouter_new() {
62311         LDKDefaultMessageRouter ret_var = DefaultMessageRouter_new();
62312         uint64_t ret_ref = 0;
62313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62314         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62315         return ret_ref;
62316 }
62317
62318 uint64_t  __attribute__((export_name("TS_DefaultMessageRouter_as_MessageRouter"))) TS_DefaultMessageRouter_as_MessageRouter(uint64_t this_arg) {
62319         LDKDefaultMessageRouter this_arg_conv;
62320         this_arg_conv.inner = untag_ptr(this_arg);
62321         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62323         this_arg_conv.is_owned = false;
62324         LDKMessageRouter* ret_ret = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
62325         *ret_ret = DefaultMessageRouter_as_MessageRouter(&this_arg_conv);
62326         return tag_ptr(ret_ret, true);
62327 }
62328
62329 void  __attribute__((export_name("TS_OnionMessagePath_free"))) TS_OnionMessagePath_free(uint64_t this_obj) {
62330         LDKOnionMessagePath this_obj_conv;
62331         this_obj_conv.inner = untag_ptr(this_obj);
62332         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62334         OnionMessagePath_free(this_obj_conv);
62335 }
62336
62337 ptrArray  __attribute__((export_name("TS_OnionMessagePath_get_intermediate_nodes"))) TS_OnionMessagePath_get_intermediate_nodes(uint64_t this_ptr) {
62338         LDKOnionMessagePath this_ptr_conv;
62339         this_ptr_conv.inner = untag_ptr(this_ptr);
62340         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62342         this_ptr_conv.is_owned = false;
62343         LDKCVec_PublicKeyZ ret_var = OnionMessagePath_get_intermediate_nodes(&this_ptr_conv);
62344         ptrArray ret_arr = NULL;
62345         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
62346         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
62347         for (size_t m = 0; m < ret_var.datalen; m++) {
62348                 int8_tArray ret_conv_12_arr = init_int8_tArray(33, __LINE__);
62349                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compressed_form, 33);
62350                 ret_arr_ptr[m] = ret_conv_12_arr;
62351         }
62352         
62353         FREE(ret_var.data);
62354         return ret_arr;
62355 }
62356
62357 void  __attribute__((export_name("TS_OnionMessagePath_set_intermediate_nodes"))) TS_OnionMessagePath_set_intermediate_nodes(uint64_t this_ptr, ptrArray val) {
62358         LDKOnionMessagePath this_ptr_conv;
62359         this_ptr_conv.inner = untag_ptr(this_ptr);
62360         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62362         this_ptr_conv.is_owned = false;
62363         LDKCVec_PublicKeyZ val_constr;
62364         val_constr.datalen = val->arr_len;
62365         if (val_constr.datalen > 0)
62366                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
62367         else
62368                 val_constr.data = NULL;
62369         int8_tArray* val_vals = (void*) val->elems;
62370         for (size_t m = 0; m < val_constr.datalen; m++) {
62371                 int8_tArray val_conv_12 = val_vals[m];
62372                 LDKPublicKey val_conv_12_ref;
62373                 CHECK(val_conv_12->arr_len == 33);
62374                 memcpy(val_conv_12_ref.compressed_form, val_conv_12->elems, 33); FREE(val_conv_12);
62375                 val_constr.data[m] = val_conv_12_ref;
62376         }
62377         FREE(val);
62378         OnionMessagePath_set_intermediate_nodes(&this_ptr_conv, val_constr);
62379 }
62380
62381 uint64_t  __attribute__((export_name("TS_OnionMessagePath_get_destination"))) TS_OnionMessagePath_get_destination(uint64_t this_ptr) {
62382         LDKOnionMessagePath this_ptr_conv;
62383         this_ptr_conv.inner = untag_ptr(this_ptr);
62384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62386         this_ptr_conv.is_owned = false;
62387         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
62388         *ret_copy = OnionMessagePath_get_destination(&this_ptr_conv);
62389         uint64_t ret_ref = tag_ptr(ret_copy, true);
62390         return ret_ref;
62391 }
62392
62393 void  __attribute__((export_name("TS_OnionMessagePath_set_destination"))) TS_OnionMessagePath_set_destination(uint64_t this_ptr, uint64_t val) {
62394         LDKOnionMessagePath this_ptr_conv;
62395         this_ptr_conv.inner = untag_ptr(this_ptr);
62396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62398         this_ptr_conv.is_owned = false;
62399         void* val_ptr = untag_ptr(val);
62400         CHECK_ACCESS(val_ptr);
62401         LDKDestination val_conv = *(LDKDestination*)(val_ptr);
62402         val_conv = Destination_clone((LDKDestination*)untag_ptr(val));
62403         OnionMessagePath_set_destination(&this_ptr_conv, val_conv);
62404 }
62405
62406 uint64_t  __attribute__((export_name("TS_OnionMessagePath_new"))) TS_OnionMessagePath_new(ptrArray intermediate_nodes_arg, uint64_t destination_arg) {
62407         LDKCVec_PublicKeyZ intermediate_nodes_arg_constr;
62408         intermediate_nodes_arg_constr.datalen = intermediate_nodes_arg->arr_len;
62409         if (intermediate_nodes_arg_constr.datalen > 0)
62410                 intermediate_nodes_arg_constr.data = MALLOC(intermediate_nodes_arg_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
62411         else
62412                 intermediate_nodes_arg_constr.data = NULL;
62413         int8_tArray* intermediate_nodes_arg_vals = (void*) intermediate_nodes_arg->elems;
62414         for (size_t m = 0; m < intermediate_nodes_arg_constr.datalen; m++) {
62415                 int8_tArray intermediate_nodes_arg_conv_12 = intermediate_nodes_arg_vals[m];
62416                 LDKPublicKey intermediate_nodes_arg_conv_12_ref;
62417                 CHECK(intermediate_nodes_arg_conv_12->arr_len == 33);
62418                 memcpy(intermediate_nodes_arg_conv_12_ref.compressed_form, intermediate_nodes_arg_conv_12->elems, 33); FREE(intermediate_nodes_arg_conv_12);
62419                 intermediate_nodes_arg_constr.data[m] = intermediate_nodes_arg_conv_12_ref;
62420         }
62421         FREE(intermediate_nodes_arg);
62422         void* destination_arg_ptr = untag_ptr(destination_arg);
62423         CHECK_ACCESS(destination_arg_ptr);
62424         LDKDestination destination_arg_conv = *(LDKDestination*)(destination_arg_ptr);
62425         destination_arg_conv = Destination_clone((LDKDestination*)untag_ptr(destination_arg));
62426         LDKOnionMessagePath ret_var = OnionMessagePath_new(intermediate_nodes_arg_constr, destination_arg_conv);
62427         uint64_t ret_ref = 0;
62428         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62429         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62430         return ret_ref;
62431 }
62432
62433 static inline uint64_t OnionMessagePath_clone_ptr(LDKOnionMessagePath *NONNULL_PTR arg) {
62434         LDKOnionMessagePath ret_var = OnionMessagePath_clone(arg);
62435         uint64_t ret_ref = 0;
62436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62438         return ret_ref;
62439 }
62440 int64_t  __attribute__((export_name("TS_OnionMessagePath_clone_ptr"))) TS_OnionMessagePath_clone_ptr(uint64_t arg) {
62441         LDKOnionMessagePath arg_conv;
62442         arg_conv.inner = untag_ptr(arg);
62443         arg_conv.is_owned = ptr_is_owned(arg);
62444         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62445         arg_conv.is_owned = false;
62446         int64_t ret_conv = OnionMessagePath_clone_ptr(&arg_conv);
62447         return ret_conv;
62448 }
62449
62450 uint64_t  __attribute__((export_name("TS_OnionMessagePath_clone"))) TS_OnionMessagePath_clone(uint64_t orig) {
62451         LDKOnionMessagePath orig_conv;
62452         orig_conv.inner = untag_ptr(orig);
62453         orig_conv.is_owned = ptr_is_owned(orig);
62454         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62455         orig_conv.is_owned = false;
62456         LDKOnionMessagePath ret_var = OnionMessagePath_clone(&orig_conv);
62457         uint64_t ret_ref = 0;
62458         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62459         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62460         return ret_ref;
62461 }
62462
62463 void  __attribute__((export_name("TS_Destination_free"))) TS_Destination_free(uint64_t this_ptr) {
62464         if (!ptr_is_owned(this_ptr)) return;
62465         void* this_ptr_ptr = untag_ptr(this_ptr);
62466         CHECK_ACCESS(this_ptr_ptr);
62467         LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
62468         FREE(untag_ptr(this_ptr));
62469         Destination_free(this_ptr_conv);
62470 }
62471
62472 static inline uint64_t Destination_clone_ptr(LDKDestination *NONNULL_PTR arg) {
62473         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
62474         *ret_copy = Destination_clone(arg);
62475         uint64_t ret_ref = tag_ptr(ret_copy, true);
62476         return ret_ref;
62477 }
62478 int64_t  __attribute__((export_name("TS_Destination_clone_ptr"))) TS_Destination_clone_ptr(uint64_t arg) {
62479         LDKDestination* arg_conv = (LDKDestination*)untag_ptr(arg);
62480         int64_t ret_conv = Destination_clone_ptr(arg_conv);
62481         return ret_conv;
62482 }
62483
62484 uint64_t  __attribute__((export_name("TS_Destination_clone"))) TS_Destination_clone(uint64_t orig) {
62485         LDKDestination* orig_conv = (LDKDestination*)untag_ptr(orig);
62486         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
62487         *ret_copy = Destination_clone(orig_conv);
62488         uint64_t ret_ref = tag_ptr(ret_copy, true);
62489         return ret_ref;
62490 }
62491
62492 uint64_t  __attribute__((export_name("TS_Destination_node"))) TS_Destination_node(int8_tArray a) {
62493         LDKPublicKey a_ref;
62494         CHECK(a->arr_len == 33);
62495         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
62496         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
62497         *ret_copy = Destination_node(a_ref);
62498         uint64_t ret_ref = tag_ptr(ret_copy, true);
62499         return ret_ref;
62500 }
62501
62502 uint64_t  __attribute__((export_name("TS_Destination_blinded_path"))) TS_Destination_blinded_path(uint64_t a) {
62503         LDKBlindedPath a_conv;
62504         a_conv.inner = untag_ptr(a);
62505         a_conv.is_owned = ptr_is_owned(a);
62506         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62507         a_conv = BlindedPath_clone(&a_conv);
62508         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
62509         *ret_copy = Destination_blinded_path(a_conv);
62510         uint64_t ret_ref = tag_ptr(ret_copy, true);
62511         return ret_ref;
62512 }
62513
62514 void  __attribute__((export_name("TS_SendError_free"))) TS_SendError_free(uint64_t this_ptr) {
62515         if (!ptr_is_owned(this_ptr)) return;
62516         void* this_ptr_ptr = untag_ptr(this_ptr);
62517         CHECK_ACCESS(this_ptr_ptr);
62518         LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
62519         FREE(untag_ptr(this_ptr));
62520         SendError_free(this_ptr_conv);
62521 }
62522
62523 static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
62524         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
62525         *ret_copy = SendError_clone(arg);
62526         uint64_t ret_ref = tag_ptr(ret_copy, true);
62527         return ret_ref;
62528 }
62529 int64_t  __attribute__((export_name("TS_SendError_clone_ptr"))) TS_SendError_clone_ptr(uint64_t arg) {
62530         LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
62531         int64_t ret_conv = SendError_clone_ptr(arg_conv);
62532         return ret_conv;
62533 }
62534
62535 uint64_t  __attribute__((export_name("TS_SendError_clone"))) TS_SendError_clone(uint64_t orig) {
62536         LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
62537         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
62538         *ret_copy = SendError_clone(orig_conv);
62539         uint64_t ret_ref = tag_ptr(ret_copy, true);
62540         return ret_ref;
62541 }
62542
62543 uint64_t  __attribute__((export_name("TS_SendError_secp256k1"))) TS_SendError_secp256k1(uint32_t a) {
62544         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
62545         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
62546         *ret_copy = SendError_secp256k1(a_conv);
62547         uint64_t ret_ref = tag_ptr(ret_copy, true);
62548         return ret_ref;
62549 }
62550
62551 uint64_t  __attribute__((export_name("TS_SendError_too_big_packet"))) TS_SendError_too_big_packet() {
62552         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
62553         *ret_copy = SendError_too_big_packet();
62554         uint64_t ret_ref = tag_ptr(ret_copy, true);
62555         return ret_ref;
62556 }
62557
62558 uint64_t  __attribute__((export_name("TS_SendError_too_few_blinded_hops"))) TS_SendError_too_few_blinded_hops() {
62559         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
62560         *ret_copy = SendError_too_few_blinded_hops();
62561         uint64_t ret_ref = tag_ptr(ret_copy, true);
62562         return ret_ref;
62563 }
62564
62565 uint64_t  __attribute__((export_name("TS_SendError_invalid_first_hop"))) TS_SendError_invalid_first_hop() {
62566         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
62567         *ret_copy = SendError_invalid_first_hop();
62568         uint64_t ret_ref = tag_ptr(ret_copy, true);
62569         return ret_ref;
62570 }
62571
62572 uint64_t  __attribute__((export_name("TS_SendError_invalid_message"))) TS_SendError_invalid_message() {
62573         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
62574         *ret_copy = SendError_invalid_message();
62575         uint64_t ret_ref = tag_ptr(ret_copy, true);
62576         return ret_ref;
62577 }
62578
62579 uint64_t  __attribute__((export_name("TS_SendError_buffer_full"))) TS_SendError_buffer_full() {
62580         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
62581         *ret_copy = SendError_buffer_full();
62582         uint64_t ret_ref = tag_ptr(ret_copy, true);
62583         return ret_ref;
62584 }
62585
62586 uint64_t  __attribute__((export_name("TS_SendError_get_node_id_failed"))) TS_SendError_get_node_id_failed() {
62587         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
62588         *ret_copy = SendError_get_node_id_failed();
62589         uint64_t ret_ref = tag_ptr(ret_copy, true);
62590         return ret_ref;
62591 }
62592
62593 uint64_t  __attribute__((export_name("TS_SendError_blinded_path_advance_failed"))) TS_SendError_blinded_path_advance_failed() {
62594         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
62595         *ret_copy = SendError_blinded_path_advance_failed();
62596         uint64_t ret_ref = tag_ptr(ret_copy, true);
62597         return ret_ref;
62598 }
62599
62600 jboolean  __attribute__((export_name("TS_SendError_eq"))) TS_SendError_eq(uint64_t a, uint64_t b) {
62601         LDKSendError* a_conv = (LDKSendError*)untag_ptr(a);
62602         LDKSendError* b_conv = (LDKSendError*)untag_ptr(b);
62603         jboolean ret_conv = SendError_eq(a_conv, b_conv);
62604         return ret_conv;
62605 }
62606
62607 void  __attribute__((export_name("TS_CustomOnionMessageHandler_free"))) TS_CustomOnionMessageHandler_free(uint64_t this_ptr) {
62608         if (!ptr_is_owned(this_ptr)) return;
62609         void* this_ptr_ptr = untag_ptr(this_ptr);
62610         CHECK_ACCESS(this_ptr_ptr);
62611         LDKCustomOnionMessageHandler this_ptr_conv = *(LDKCustomOnionMessageHandler*)(this_ptr_ptr);
62612         FREE(untag_ptr(this_ptr));
62613         CustomOnionMessageHandler_free(this_ptr_conv);
62614 }
62615
62616 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) {
62617         void* entropy_source_ptr = untag_ptr(entropy_source);
62618         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
62619         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
62620         void* node_signer_ptr = untag_ptr(node_signer);
62621         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
62622         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
62623         LDKOnionMessagePath path_conv;
62624         path_conv.inner = untag_ptr(path);
62625         path_conv.is_owned = ptr_is_owned(path);
62626         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
62627         path_conv = OnionMessagePath_clone(&path_conv);
62628         void* message_ptr = untag_ptr(message);
62629         CHECK_ACCESS(message_ptr);
62630         LDKOnionMessageContents message_conv = *(LDKOnionMessageContents*)(message_ptr);
62631         message_conv = OnionMessageContents_clone((LDKOnionMessageContents*)untag_ptr(message));
62632         LDKBlindedPath reply_path_conv;
62633         reply_path_conv.inner = untag_ptr(reply_path);
62634         reply_path_conv.is_owned = ptr_is_owned(reply_path);
62635         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
62636         reply_path_conv = BlindedPath_clone(&reply_path_conv);
62637         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ), "LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ");
62638         *ret_conv = create_onion_message(entropy_source_conv, node_signer_conv, path_conv, message_conv, reply_path_conv);
62639         return tag_ptr(ret_conv, true);
62640 }
62641
62642 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) {
62643         void* entropy_source_ptr = untag_ptr(entropy_source);
62644         CHECK_ACCESS(entropy_source_ptr);
62645         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
62646         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
62647                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62648                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
62649         }
62650         void* node_signer_ptr = untag_ptr(node_signer);
62651         CHECK_ACCESS(node_signer_ptr);
62652         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
62653         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
62654                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62655                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
62656         }
62657         void* logger_ptr = untag_ptr(logger);
62658         CHECK_ACCESS(logger_ptr);
62659         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
62660         if (logger_conv.free == LDKLogger_JCalls_free) {
62661                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62662                 LDKLogger_JCalls_cloned(&logger_conv);
62663         }
62664         void* message_router_ptr = untag_ptr(message_router);
62665         CHECK_ACCESS(message_router_ptr);
62666         LDKMessageRouter message_router_conv = *(LDKMessageRouter*)(message_router_ptr);
62667         if (message_router_conv.free == LDKMessageRouter_JCalls_free) {
62668                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62669                 LDKMessageRouter_JCalls_cloned(&message_router_conv);
62670         }
62671         void* offers_handler_ptr = untag_ptr(offers_handler);
62672         CHECK_ACCESS(offers_handler_ptr);
62673         LDKOffersMessageHandler offers_handler_conv = *(LDKOffersMessageHandler*)(offers_handler_ptr);
62674         if (offers_handler_conv.free == LDKOffersMessageHandler_JCalls_free) {
62675                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62676                 LDKOffersMessageHandler_JCalls_cloned(&offers_handler_conv);
62677         }
62678         void* custom_handler_ptr = untag_ptr(custom_handler);
62679         CHECK_ACCESS(custom_handler_ptr);
62680         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
62681         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
62682                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62683                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
62684         }
62685         LDKOnionMessenger ret_var = OnionMessenger_new(entropy_source_conv, node_signer_conv, logger_conv, message_router_conv, offers_handler_conv, custom_handler_conv);
62686         uint64_t ret_ref = 0;
62687         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62688         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62689         return ret_ref;
62690 }
62691
62692 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) {
62693         LDKOnionMessenger this_arg_conv;
62694         this_arg_conv.inner = untag_ptr(this_arg);
62695         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62697         this_arg_conv.is_owned = false;
62698         LDKOnionMessagePath path_conv;
62699         path_conv.inner = untag_ptr(path);
62700         path_conv.is_owned = ptr_is_owned(path);
62701         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
62702         path_conv = OnionMessagePath_clone(&path_conv);
62703         void* message_ptr = untag_ptr(message);
62704         CHECK_ACCESS(message_ptr);
62705         LDKOnionMessageContents message_conv = *(LDKOnionMessageContents*)(message_ptr);
62706         message_conv = OnionMessageContents_clone((LDKOnionMessageContents*)untag_ptr(message));
62707         LDKBlindedPath reply_path_conv;
62708         reply_path_conv.inner = untag_ptr(reply_path);
62709         reply_path_conv.is_owned = ptr_is_owned(reply_path);
62710         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
62711         reply_path_conv = BlindedPath_clone(&reply_path_conv);
62712         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
62713         *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, path_conv, message_conv, reply_path_conv);
62714         return tag_ptr(ret_conv, true);
62715 }
62716
62717 uint64_t  __attribute__((export_name("TS_OnionMessenger_as_OnionMessageHandler"))) TS_OnionMessenger_as_OnionMessageHandler(uint64_t this_arg) {
62718         LDKOnionMessenger this_arg_conv;
62719         this_arg_conv.inner = untag_ptr(this_arg);
62720         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62722         this_arg_conv.is_owned = false;
62723         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
62724         *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
62725         return tag_ptr(ret_ret, true);
62726 }
62727
62728 uint64_t  __attribute__((export_name("TS_OnionMessenger_as_OnionMessageProvider"))) TS_OnionMessenger_as_OnionMessageProvider(uint64_t this_arg) {
62729         LDKOnionMessenger this_arg_conv;
62730         this_arg_conv.inner = untag_ptr(this_arg);
62731         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62733         this_arg_conv.is_owned = false;
62734         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
62735         *ret_ret = OnionMessenger_as_OnionMessageProvider(&this_arg_conv);
62736         return tag_ptr(ret_ret, true);
62737 }
62738
62739 void  __attribute__((export_name("TS_OffersMessageHandler_free"))) TS_OffersMessageHandler_free(uint64_t this_ptr) {
62740         if (!ptr_is_owned(this_ptr)) return;
62741         void* this_ptr_ptr = untag_ptr(this_ptr);
62742         CHECK_ACCESS(this_ptr_ptr);
62743         LDKOffersMessageHandler this_ptr_conv = *(LDKOffersMessageHandler*)(this_ptr_ptr);
62744         FREE(untag_ptr(this_ptr));
62745         OffersMessageHandler_free(this_ptr_conv);
62746 }
62747
62748 void  __attribute__((export_name("TS_OffersMessage_free"))) TS_OffersMessage_free(uint64_t this_ptr) {
62749         if (!ptr_is_owned(this_ptr)) return;
62750         void* this_ptr_ptr = untag_ptr(this_ptr);
62751         CHECK_ACCESS(this_ptr_ptr);
62752         LDKOffersMessage this_ptr_conv = *(LDKOffersMessage*)(this_ptr_ptr);
62753         FREE(untag_ptr(this_ptr));
62754         OffersMessage_free(this_ptr_conv);
62755 }
62756
62757 static inline uint64_t OffersMessage_clone_ptr(LDKOffersMessage *NONNULL_PTR arg) {
62758         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
62759         *ret_copy = OffersMessage_clone(arg);
62760         uint64_t ret_ref = tag_ptr(ret_copy, true);
62761         return ret_ref;
62762 }
62763 int64_t  __attribute__((export_name("TS_OffersMessage_clone_ptr"))) TS_OffersMessage_clone_ptr(uint64_t arg) {
62764         LDKOffersMessage* arg_conv = (LDKOffersMessage*)untag_ptr(arg);
62765         int64_t ret_conv = OffersMessage_clone_ptr(arg_conv);
62766         return ret_conv;
62767 }
62768
62769 uint64_t  __attribute__((export_name("TS_OffersMessage_clone"))) TS_OffersMessage_clone(uint64_t orig) {
62770         LDKOffersMessage* orig_conv = (LDKOffersMessage*)untag_ptr(orig);
62771         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
62772         *ret_copy = OffersMessage_clone(orig_conv);
62773         uint64_t ret_ref = tag_ptr(ret_copy, true);
62774         return ret_ref;
62775 }
62776
62777 uint64_t  __attribute__((export_name("TS_OffersMessage_invoice_request"))) TS_OffersMessage_invoice_request(uint64_t a) {
62778         LDKInvoiceRequest a_conv;
62779         a_conv.inner = untag_ptr(a);
62780         a_conv.is_owned = ptr_is_owned(a);
62781         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62782         a_conv = InvoiceRequest_clone(&a_conv);
62783         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
62784         *ret_copy = OffersMessage_invoice_request(a_conv);
62785         uint64_t ret_ref = tag_ptr(ret_copy, true);
62786         return ret_ref;
62787 }
62788
62789 uint64_t  __attribute__((export_name("TS_OffersMessage_invoice"))) TS_OffersMessage_invoice(uint64_t a) {
62790         LDKBolt12Invoice a_conv;
62791         a_conv.inner = untag_ptr(a);
62792         a_conv.is_owned = ptr_is_owned(a);
62793         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62794         a_conv = Bolt12Invoice_clone(&a_conv);
62795         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
62796         *ret_copy = OffersMessage_invoice(a_conv);
62797         uint64_t ret_ref = tag_ptr(ret_copy, true);
62798         return ret_ref;
62799 }
62800
62801 uint64_t  __attribute__((export_name("TS_OffersMessage_invoice_error"))) TS_OffersMessage_invoice_error(uint64_t a) {
62802         LDKInvoiceError a_conv;
62803         a_conv.inner = untag_ptr(a);
62804         a_conv.is_owned = ptr_is_owned(a);
62805         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62806         a_conv = InvoiceError_clone(&a_conv);
62807         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
62808         *ret_copy = OffersMessage_invoice_error(a_conv);
62809         uint64_t ret_ref = tag_ptr(ret_copy, true);
62810         return ret_ref;
62811 }
62812
62813 jboolean  __attribute__((export_name("TS_OffersMessage_is_known_type"))) TS_OffersMessage_is_known_type(int64_t tlv_type) {
62814         jboolean ret_conv = OffersMessage_is_known_type(tlv_type);
62815         return ret_conv;
62816 }
62817
62818 int64_t  __attribute__((export_name("TS_OffersMessage_tlv_type"))) TS_OffersMessage_tlv_type(uint64_t this_arg) {
62819         LDKOffersMessage* this_arg_conv = (LDKOffersMessage*)untag_ptr(this_arg);
62820         int64_t ret_conv = OffersMessage_tlv_type(this_arg_conv);
62821         return ret_conv;
62822 }
62823
62824 int8_tArray  __attribute__((export_name("TS_OffersMessage_write"))) TS_OffersMessage_write(uint64_t obj) {
62825         LDKOffersMessage* obj_conv = (LDKOffersMessage*)untag_ptr(obj);
62826         LDKCVec_u8Z ret_var = OffersMessage_write(obj_conv);
62827         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62828         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62829         CVec_u8Z_free(ret_var);
62830         return ret_arr;
62831 }
62832
62833 uint64_t  __attribute__((export_name("TS_OffersMessage_read"))) TS_OffersMessage_read(int8_tArray ser, int64_t arg_a, uint64_t arg_b) {
62834         LDKu8slice ser_ref;
62835         ser_ref.datalen = ser->arr_len;
62836         ser_ref.data = ser->elems;
62837         void* arg_b_ptr = untag_ptr(arg_b);
62838         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
62839         LDKLogger* arg_b_conv = (LDKLogger*)arg_b_ptr;
62840         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
62841         *ret_conv = OffersMessage_read(ser_ref, arg_a, arg_b_conv);
62842         FREE(ser);
62843         return tag_ptr(ret_conv, true);
62844 }
62845
62846 void  __attribute__((export_name("TS_Packet_free"))) TS_Packet_free(uint64_t this_obj) {
62847         LDKPacket this_obj_conv;
62848         this_obj_conv.inner = untag_ptr(this_obj);
62849         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62851         Packet_free(this_obj_conv);
62852 }
62853
62854 int8_t  __attribute__((export_name("TS_Packet_get_version"))) TS_Packet_get_version(uint64_t this_ptr) {
62855         LDKPacket this_ptr_conv;
62856         this_ptr_conv.inner = untag_ptr(this_ptr);
62857         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62859         this_ptr_conv.is_owned = false;
62860         int8_t ret_conv = Packet_get_version(&this_ptr_conv);
62861         return ret_conv;
62862 }
62863
62864 void  __attribute__((export_name("TS_Packet_set_version"))) TS_Packet_set_version(uint64_t this_ptr, int8_t val) {
62865         LDKPacket this_ptr_conv;
62866         this_ptr_conv.inner = untag_ptr(this_ptr);
62867         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62869         this_ptr_conv.is_owned = false;
62870         Packet_set_version(&this_ptr_conv, val);
62871 }
62872
62873 int8_tArray  __attribute__((export_name("TS_Packet_get_public_key"))) TS_Packet_get_public_key(uint64_t this_ptr) {
62874         LDKPacket this_ptr_conv;
62875         this_ptr_conv.inner = untag_ptr(this_ptr);
62876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62878         this_ptr_conv.is_owned = false;
62879         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
62880         memcpy(ret_arr->elems, Packet_get_public_key(&this_ptr_conv).compressed_form, 33);
62881         return ret_arr;
62882 }
62883
62884 void  __attribute__((export_name("TS_Packet_set_public_key"))) TS_Packet_set_public_key(uint64_t this_ptr, int8_tArray val) {
62885         LDKPacket this_ptr_conv;
62886         this_ptr_conv.inner = untag_ptr(this_ptr);
62887         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62889         this_ptr_conv.is_owned = false;
62890         LDKPublicKey val_ref;
62891         CHECK(val->arr_len == 33);
62892         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
62893         Packet_set_public_key(&this_ptr_conv, val_ref);
62894 }
62895
62896 int8_tArray  __attribute__((export_name("TS_Packet_get_hop_data"))) TS_Packet_get_hop_data(uint64_t this_ptr) {
62897         LDKPacket this_ptr_conv;
62898         this_ptr_conv.inner = untag_ptr(this_ptr);
62899         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62901         this_ptr_conv.is_owned = false;
62902         LDKCVec_u8Z ret_var = Packet_get_hop_data(&this_ptr_conv);
62903         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62904         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62905         CVec_u8Z_free(ret_var);
62906         return ret_arr;
62907 }
62908
62909 void  __attribute__((export_name("TS_Packet_set_hop_data"))) TS_Packet_set_hop_data(uint64_t this_ptr, int8_tArray val) {
62910         LDKPacket this_ptr_conv;
62911         this_ptr_conv.inner = untag_ptr(this_ptr);
62912         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62914         this_ptr_conv.is_owned = false;
62915         LDKCVec_u8Z val_ref;
62916         val_ref.datalen = val->arr_len;
62917         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
62918         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
62919         Packet_set_hop_data(&this_ptr_conv, val_ref);
62920 }
62921
62922 int8_tArray  __attribute__((export_name("TS_Packet_get_hmac"))) TS_Packet_get_hmac(uint64_t this_ptr) {
62923         LDKPacket this_ptr_conv;
62924         this_ptr_conv.inner = untag_ptr(this_ptr);
62925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62927         this_ptr_conv.is_owned = false;
62928         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
62929         memcpy(ret_arr->elems, *Packet_get_hmac(&this_ptr_conv), 32);
62930         return ret_arr;
62931 }
62932
62933 void  __attribute__((export_name("TS_Packet_set_hmac"))) TS_Packet_set_hmac(uint64_t this_ptr, int8_tArray val) {
62934         LDKPacket this_ptr_conv;
62935         this_ptr_conv.inner = untag_ptr(this_ptr);
62936         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62938         this_ptr_conv.is_owned = false;
62939         LDKThirtyTwoBytes val_ref;
62940         CHECK(val->arr_len == 32);
62941         memcpy(val_ref.data, val->elems, 32); FREE(val);
62942         Packet_set_hmac(&this_ptr_conv, val_ref);
62943 }
62944
62945 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) {
62946         LDKPublicKey public_key_arg_ref;
62947         CHECK(public_key_arg->arr_len == 33);
62948         memcpy(public_key_arg_ref.compressed_form, public_key_arg->elems, 33); FREE(public_key_arg);
62949         LDKCVec_u8Z hop_data_arg_ref;
62950         hop_data_arg_ref.datalen = hop_data_arg->arr_len;
62951         hop_data_arg_ref.data = MALLOC(hop_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
62952         memcpy(hop_data_arg_ref.data, hop_data_arg->elems, hop_data_arg_ref.datalen); FREE(hop_data_arg);
62953         LDKThirtyTwoBytes hmac_arg_ref;
62954         CHECK(hmac_arg->arr_len == 32);
62955         memcpy(hmac_arg_ref.data, hmac_arg->elems, 32); FREE(hmac_arg);
62956         LDKPacket ret_var = Packet_new(version_arg, public_key_arg_ref, hop_data_arg_ref, hmac_arg_ref);
62957         uint64_t ret_ref = 0;
62958         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62959         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62960         return ret_ref;
62961 }
62962
62963 static inline uint64_t Packet_clone_ptr(LDKPacket *NONNULL_PTR arg) {
62964         LDKPacket ret_var = Packet_clone(arg);
62965         uint64_t ret_ref = 0;
62966         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62967         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62968         return ret_ref;
62969 }
62970 int64_t  __attribute__((export_name("TS_Packet_clone_ptr"))) TS_Packet_clone_ptr(uint64_t arg) {
62971         LDKPacket arg_conv;
62972         arg_conv.inner = untag_ptr(arg);
62973         arg_conv.is_owned = ptr_is_owned(arg);
62974         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62975         arg_conv.is_owned = false;
62976         int64_t ret_conv = Packet_clone_ptr(&arg_conv);
62977         return ret_conv;
62978 }
62979
62980 uint64_t  __attribute__((export_name("TS_Packet_clone"))) TS_Packet_clone(uint64_t orig) {
62981         LDKPacket orig_conv;
62982         orig_conv.inner = untag_ptr(orig);
62983         orig_conv.is_owned = ptr_is_owned(orig);
62984         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62985         orig_conv.is_owned = false;
62986         LDKPacket ret_var = Packet_clone(&orig_conv);
62987         uint64_t ret_ref = 0;
62988         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62989         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62990         return ret_ref;
62991 }
62992
62993 jboolean  __attribute__((export_name("TS_Packet_eq"))) TS_Packet_eq(uint64_t a, uint64_t b) {
62994         LDKPacket a_conv;
62995         a_conv.inner = untag_ptr(a);
62996         a_conv.is_owned = ptr_is_owned(a);
62997         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62998         a_conv.is_owned = false;
62999         LDKPacket b_conv;
63000         b_conv.inner = untag_ptr(b);
63001         b_conv.is_owned = ptr_is_owned(b);
63002         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63003         b_conv.is_owned = false;
63004         jboolean ret_conv = Packet_eq(&a_conv, &b_conv);
63005         return ret_conv;
63006 }
63007
63008 int8_tArray  __attribute__((export_name("TS_Packet_write"))) TS_Packet_write(uint64_t obj) {
63009         LDKPacket obj_conv;
63010         obj_conv.inner = untag_ptr(obj);
63011         obj_conv.is_owned = ptr_is_owned(obj);
63012         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63013         obj_conv.is_owned = false;
63014         LDKCVec_u8Z ret_var = Packet_write(&obj_conv);
63015         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63016         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63017         CVec_u8Z_free(ret_var);
63018         return ret_arr;
63019 }
63020
63021 void  __attribute__((export_name("TS_OnionMessageContents_free"))) TS_OnionMessageContents_free(uint64_t this_ptr) {
63022         if (!ptr_is_owned(this_ptr)) return;
63023         void* this_ptr_ptr = untag_ptr(this_ptr);
63024         CHECK_ACCESS(this_ptr_ptr);
63025         LDKOnionMessageContents this_ptr_conv = *(LDKOnionMessageContents*)(this_ptr_ptr);
63026         FREE(untag_ptr(this_ptr));
63027         OnionMessageContents_free(this_ptr_conv);
63028 }
63029
63030 static inline uint64_t OnionMessageContents_clone_ptr(LDKOnionMessageContents *NONNULL_PTR arg) {
63031         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
63032         *ret_copy = OnionMessageContents_clone(arg);
63033         uint64_t ret_ref = tag_ptr(ret_copy, true);
63034         return ret_ref;
63035 }
63036 int64_t  __attribute__((export_name("TS_OnionMessageContents_clone_ptr"))) TS_OnionMessageContents_clone_ptr(uint64_t arg) {
63037         LDKOnionMessageContents* arg_conv = (LDKOnionMessageContents*)untag_ptr(arg);
63038         int64_t ret_conv = OnionMessageContents_clone_ptr(arg_conv);
63039         return ret_conv;
63040 }
63041
63042 uint64_t  __attribute__((export_name("TS_OnionMessageContents_clone"))) TS_OnionMessageContents_clone(uint64_t orig) {
63043         LDKOnionMessageContents* orig_conv = (LDKOnionMessageContents*)untag_ptr(orig);
63044         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
63045         *ret_copy = OnionMessageContents_clone(orig_conv);
63046         uint64_t ret_ref = tag_ptr(ret_copy, true);
63047         return ret_ref;
63048 }
63049
63050 uint64_t  __attribute__((export_name("TS_OnionMessageContents_offers"))) TS_OnionMessageContents_offers(uint64_t a) {
63051         void* a_ptr = untag_ptr(a);
63052         CHECK_ACCESS(a_ptr);
63053         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
63054         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
63055         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
63056         *ret_copy = OnionMessageContents_offers(a_conv);
63057         uint64_t ret_ref = tag_ptr(ret_copy, true);
63058         return ret_ref;
63059 }
63060
63061 uint64_t  __attribute__((export_name("TS_OnionMessageContents_custom"))) TS_OnionMessageContents_custom(uint64_t a) {
63062         void* a_ptr = untag_ptr(a);
63063         CHECK_ACCESS(a_ptr);
63064         LDKCustomOnionMessageContents a_conv = *(LDKCustomOnionMessageContents*)(a_ptr);
63065         if (a_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
63066                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63067                 LDKCustomOnionMessageContents_JCalls_cloned(&a_conv);
63068         }
63069         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
63070         *ret_copy = OnionMessageContents_custom(a_conv);
63071         uint64_t ret_ref = tag_ptr(ret_copy, true);
63072         return ret_ref;
63073 }
63074
63075 static inline uint64_t CustomOnionMessageContents_clone_ptr(LDKCustomOnionMessageContents *NONNULL_PTR arg) {
63076         LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
63077         *ret_ret = CustomOnionMessageContents_clone(arg);
63078         return tag_ptr(ret_ret, true);
63079 }
63080 int64_t  __attribute__((export_name("TS_CustomOnionMessageContents_clone_ptr"))) TS_CustomOnionMessageContents_clone_ptr(uint64_t arg) {
63081         void* arg_ptr = untag_ptr(arg);
63082         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
63083         LDKCustomOnionMessageContents* arg_conv = (LDKCustomOnionMessageContents*)arg_ptr;
63084         int64_t ret_conv = CustomOnionMessageContents_clone_ptr(arg_conv);
63085         return ret_conv;
63086 }
63087
63088 uint64_t  __attribute__((export_name("TS_CustomOnionMessageContents_clone"))) TS_CustomOnionMessageContents_clone(uint64_t orig) {
63089         void* orig_ptr = untag_ptr(orig);
63090         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
63091         LDKCustomOnionMessageContents* orig_conv = (LDKCustomOnionMessageContents*)orig_ptr;
63092         LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
63093         *ret_ret = CustomOnionMessageContents_clone(orig_conv);
63094         return tag_ptr(ret_ret, true);
63095 }
63096
63097 void  __attribute__((export_name("TS_CustomOnionMessageContents_free"))) TS_CustomOnionMessageContents_free(uint64_t this_ptr) {
63098         if (!ptr_is_owned(this_ptr)) return;
63099         void* this_ptr_ptr = untag_ptr(this_ptr);
63100         CHECK_ACCESS(this_ptr_ptr);
63101         LDKCustomOnionMessageContents this_ptr_conv = *(LDKCustomOnionMessageContents*)(this_ptr_ptr);
63102         FREE(untag_ptr(this_ptr));
63103         CustomOnionMessageContents_free(this_ptr_conv);
63104 }
63105
63106 void  __attribute__((export_name("TS_BlindedPath_free"))) TS_BlindedPath_free(uint64_t this_obj) {
63107         LDKBlindedPath this_obj_conv;
63108         this_obj_conv.inner = untag_ptr(this_obj);
63109         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63111         BlindedPath_free(this_obj_conv);
63112 }
63113
63114 int8_tArray  __attribute__((export_name("TS_BlindedPath_get_introduction_node_id"))) TS_BlindedPath_get_introduction_node_id(uint64_t this_ptr) {
63115         LDKBlindedPath this_ptr_conv;
63116         this_ptr_conv.inner = untag_ptr(this_ptr);
63117         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63119         this_ptr_conv.is_owned = false;
63120         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
63121         memcpy(ret_arr->elems, BlindedPath_get_introduction_node_id(&this_ptr_conv).compressed_form, 33);
63122         return ret_arr;
63123 }
63124
63125 void  __attribute__((export_name("TS_BlindedPath_set_introduction_node_id"))) TS_BlindedPath_set_introduction_node_id(uint64_t this_ptr, int8_tArray val) {
63126         LDKBlindedPath this_ptr_conv;
63127         this_ptr_conv.inner = untag_ptr(this_ptr);
63128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63130         this_ptr_conv.is_owned = false;
63131         LDKPublicKey val_ref;
63132         CHECK(val->arr_len == 33);
63133         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
63134         BlindedPath_set_introduction_node_id(&this_ptr_conv, val_ref);
63135 }
63136
63137 int8_tArray  __attribute__((export_name("TS_BlindedPath_get_blinding_point"))) TS_BlindedPath_get_blinding_point(uint64_t this_ptr) {
63138         LDKBlindedPath this_ptr_conv;
63139         this_ptr_conv.inner = untag_ptr(this_ptr);
63140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63142         this_ptr_conv.is_owned = false;
63143         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
63144         memcpy(ret_arr->elems, BlindedPath_get_blinding_point(&this_ptr_conv).compressed_form, 33);
63145         return ret_arr;
63146 }
63147
63148 void  __attribute__((export_name("TS_BlindedPath_set_blinding_point"))) TS_BlindedPath_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
63149         LDKBlindedPath this_ptr_conv;
63150         this_ptr_conv.inner = untag_ptr(this_ptr);
63151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63153         this_ptr_conv.is_owned = false;
63154         LDKPublicKey val_ref;
63155         CHECK(val->arr_len == 33);
63156         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
63157         BlindedPath_set_blinding_point(&this_ptr_conv, val_ref);
63158 }
63159
63160 uint64_tArray  __attribute__((export_name("TS_BlindedPath_get_blinded_hops"))) TS_BlindedPath_get_blinded_hops(uint64_t this_ptr) {
63161         LDKBlindedPath this_ptr_conv;
63162         this_ptr_conv.inner = untag_ptr(this_ptr);
63163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63165         this_ptr_conv.is_owned = false;
63166         LDKCVec_BlindedHopZ ret_var = BlindedPath_get_blinded_hops(&this_ptr_conv);
63167         uint64_tArray ret_arr = NULL;
63168         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
63169         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
63170         for (size_t m = 0; m < ret_var.datalen; m++) {
63171                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
63172                 uint64_t ret_conv_12_ref = 0;
63173                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
63174                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
63175                 ret_arr_ptr[m] = ret_conv_12_ref;
63176         }
63177         
63178         FREE(ret_var.data);
63179         return ret_arr;
63180 }
63181
63182 void  __attribute__((export_name("TS_BlindedPath_set_blinded_hops"))) TS_BlindedPath_set_blinded_hops(uint64_t this_ptr, uint64_tArray val) {
63183         LDKBlindedPath this_ptr_conv;
63184         this_ptr_conv.inner = untag_ptr(this_ptr);
63185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63187         this_ptr_conv.is_owned = false;
63188         LDKCVec_BlindedHopZ val_constr;
63189         val_constr.datalen = val->arr_len;
63190         if (val_constr.datalen > 0)
63191                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
63192         else
63193                 val_constr.data = NULL;
63194         uint64_t* val_vals = val->elems;
63195         for (size_t m = 0; m < val_constr.datalen; m++) {
63196                 uint64_t val_conv_12 = val_vals[m];
63197                 LDKBlindedHop val_conv_12_conv;
63198                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
63199                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
63200                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
63201                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
63202                 val_constr.data[m] = val_conv_12_conv;
63203         }
63204         FREE(val);
63205         BlindedPath_set_blinded_hops(&this_ptr_conv, val_constr);
63206 }
63207
63208 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) {
63209         LDKPublicKey introduction_node_id_arg_ref;
63210         CHECK(introduction_node_id_arg->arr_len == 33);
63211         memcpy(introduction_node_id_arg_ref.compressed_form, introduction_node_id_arg->elems, 33); FREE(introduction_node_id_arg);
63212         LDKPublicKey blinding_point_arg_ref;
63213         CHECK(blinding_point_arg->arr_len == 33);
63214         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
63215         LDKCVec_BlindedHopZ blinded_hops_arg_constr;
63216         blinded_hops_arg_constr.datalen = blinded_hops_arg->arr_len;
63217         if (blinded_hops_arg_constr.datalen > 0)
63218                 blinded_hops_arg_constr.data = MALLOC(blinded_hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
63219         else
63220                 blinded_hops_arg_constr.data = NULL;
63221         uint64_t* blinded_hops_arg_vals = blinded_hops_arg->elems;
63222         for (size_t m = 0; m < blinded_hops_arg_constr.datalen; m++) {
63223                 uint64_t blinded_hops_arg_conv_12 = blinded_hops_arg_vals[m];
63224                 LDKBlindedHop blinded_hops_arg_conv_12_conv;
63225                 blinded_hops_arg_conv_12_conv.inner = untag_ptr(blinded_hops_arg_conv_12);
63226                 blinded_hops_arg_conv_12_conv.is_owned = ptr_is_owned(blinded_hops_arg_conv_12);
63227                 CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_hops_arg_conv_12_conv);
63228                 blinded_hops_arg_conv_12_conv = BlindedHop_clone(&blinded_hops_arg_conv_12_conv);
63229                 blinded_hops_arg_constr.data[m] = blinded_hops_arg_conv_12_conv;
63230         }
63231         FREE(blinded_hops_arg);
63232         LDKBlindedPath ret_var = BlindedPath_new(introduction_node_id_arg_ref, blinding_point_arg_ref, blinded_hops_arg_constr);
63233         uint64_t ret_ref = 0;
63234         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63235         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63236         return ret_ref;
63237 }
63238
63239 static inline uint64_t BlindedPath_clone_ptr(LDKBlindedPath *NONNULL_PTR arg) {
63240         LDKBlindedPath ret_var = BlindedPath_clone(arg);
63241         uint64_t ret_ref = 0;
63242         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63243         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63244         return ret_ref;
63245 }
63246 int64_t  __attribute__((export_name("TS_BlindedPath_clone_ptr"))) TS_BlindedPath_clone_ptr(uint64_t arg) {
63247         LDKBlindedPath arg_conv;
63248         arg_conv.inner = untag_ptr(arg);
63249         arg_conv.is_owned = ptr_is_owned(arg);
63250         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63251         arg_conv.is_owned = false;
63252         int64_t ret_conv = BlindedPath_clone_ptr(&arg_conv);
63253         return ret_conv;
63254 }
63255
63256 uint64_t  __attribute__((export_name("TS_BlindedPath_clone"))) TS_BlindedPath_clone(uint64_t orig) {
63257         LDKBlindedPath orig_conv;
63258         orig_conv.inner = untag_ptr(orig);
63259         orig_conv.is_owned = ptr_is_owned(orig);
63260         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63261         orig_conv.is_owned = false;
63262         LDKBlindedPath ret_var = BlindedPath_clone(&orig_conv);
63263         uint64_t ret_ref = 0;
63264         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63265         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63266         return ret_ref;
63267 }
63268
63269 int64_t  __attribute__((export_name("TS_BlindedPath_hash"))) TS_BlindedPath_hash(uint64_t o) {
63270         LDKBlindedPath o_conv;
63271         o_conv.inner = untag_ptr(o);
63272         o_conv.is_owned = ptr_is_owned(o);
63273         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
63274         o_conv.is_owned = false;
63275         int64_t ret_conv = BlindedPath_hash(&o_conv);
63276         return ret_conv;
63277 }
63278
63279 jboolean  __attribute__((export_name("TS_BlindedPath_eq"))) TS_BlindedPath_eq(uint64_t a, uint64_t b) {
63280         LDKBlindedPath a_conv;
63281         a_conv.inner = untag_ptr(a);
63282         a_conv.is_owned = ptr_is_owned(a);
63283         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63284         a_conv.is_owned = false;
63285         LDKBlindedPath b_conv;
63286         b_conv.inner = untag_ptr(b);
63287         b_conv.is_owned = ptr_is_owned(b);
63288         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63289         b_conv.is_owned = false;
63290         jboolean ret_conv = BlindedPath_eq(&a_conv, &b_conv);
63291         return ret_conv;
63292 }
63293
63294 void  __attribute__((export_name("TS_BlindedHop_free"))) TS_BlindedHop_free(uint64_t this_obj) {
63295         LDKBlindedHop this_obj_conv;
63296         this_obj_conv.inner = untag_ptr(this_obj);
63297         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63299         BlindedHop_free(this_obj_conv);
63300 }
63301
63302 int8_tArray  __attribute__((export_name("TS_BlindedHop_get_blinded_node_id"))) TS_BlindedHop_get_blinded_node_id(uint64_t this_ptr) {
63303         LDKBlindedHop this_ptr_conv;
63304         this_ptr_conv.inner = untag_ptr(this_ptr);
63305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63307         this_ptr_conv.is_owned = false;
63308         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
63309         memcpy(ret_arr->elems, BlindedHop_get_blinded_node_id(&this_ptr_conv).compressed_form, 33);
63310         return ret_arr;
63311 }
63312
63313 void  __attribute__((export_name("TS_BlindedHop_set_blinded_node_id"))) TS_BlindedHop_set_blinded_node_id(uint64_t this_ptr, int8_tArray val) {
63314         LDKBlindedHop this_ptr_conv;
63315         this_ptr_conv.inner = untag_ptr(this_ptr);
63316         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63318         this_ptr_conv.is_owned = false;
63319         LDKPublicKey val_ref;
63320         CHECK(val->arr_len == 33);
63321         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
63322         BlindedHop_set_blinded_node_id(&this_ptr_conv, val_ref);
63323 }
63324
63325 int8_tArray  __attribute__((export_name("TS_BlindedHop_get_encrypted_payload"))) TS_BlindedHop_get_encrypted_payload(uint64_t this_ptr) {
63326         LDKBlindedHop this_ptr_conv;
63327         this_ptr_conv.inner = untag_ptr(this_ptr);
63328         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63330         this_ptr_conv.is_owned = false;
63331         LDKCVec_u8Z ret_var = BlindedHop_get_encrypted_payload(&this_ptr_conv);
63332         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63333         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63334         CVec_u8Z_free(ret_var);
63335         return ret_arr;
63336 }
63337
63338 void  __attribute__((export_name("TS_BlindedHop_set_encrypted_payload"))) TS_BlindedHop_set_encrypted_payload(uint64_t this_ptr, int8_tArray val) {
63339         LDKBlindedHop this_ptr_conv;
63340         this_ptr_conv.inner = untag_ptr(this_ptr);
63341         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63343         this_ptr_conv.is_owned = false;
63344         LDKCVec_u8Z val_ref;
63345         val_ref.datalen = val->arr_len;
63346         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
63347         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
63348         BlindedHop_set_encrypted_payload(&this_ptr_conv, val_ref);
63349 }
63350
63351 uint64_t  __attribute__((export_name("TS_BlindedHop_new"))) TS_BlindedHop_new(int8_tArray blinded_node_id_arg, int8_tArray encrypted_payload_arg) {
63352         LDKPublicKey blinded_node_id_arg_ref;
63353         CHECK(blinded_node_id_arg->arr_len == 33);
63354         memcpy(blinded_node_id_arg_ref.compressed_form, blinded_node_id_arg->elems, 33); FREE(blinded_node_id_arg);
63355         LDKCVec_u8Z encrypted_payload_arg_ref;
63356         encrypted_payload_arg_ref.datalen = encrypted_payload_arg->arr_len;
63357         encrypted_payload_arg_ref.data = MALLOC(encrypted_payload_arg_ref.datalen, "LDKCVec_u8Z Bytes");
63358         memcpy(encrypted_payload_arg_ref.data, encrypted_payload_arg->elems, encrypted_payload_arg_ref.datalen); FREE(encrypted_payload_arg);
63359         LDKBlindedHop ret_var = BlindedHop_new(blinded_node_id_arg_ref, encrypted_payload_arg_ref);
63360         uint64_t ret_ref = 0;
63361         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63362         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63363         return ret_ref;
63364 }
63365
63366 static inline uint64_t BlindedHop_clone_ptr(LDKBlindedHop *NONNULL_PTR arg) {
63367         LDKBlindedHop ret_var = BlindedHop_clone(arg);
63368         uint64_t ret_ref = 0;
63369         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63370         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63371         return ret_ref;
63372 }
63373 int64_t  __attribute__((export_name("TS_BlindedHop_clone_ptr"))) TS_BlindedHop_clone_ptr(uint64_t arg) {
63374         LDKBlindedHop arg_conv;
63375         arg_conv.inner = untag_ptr(arg);
63376         arg_conv.is_owned = ptr_is_owned(arg);
63377         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63378         arg_conv.is_owned = false;
63379         int64_t ret_conv = BlindedHop_clone_ptr(&arg_conv);
63380         return ret_conv;
63381 }
63382
63383 uint64_t  __attribute__((export_name("TS_BlindedHop_clone"))) TS_BlindedHop_clone(uint64_t orig) {
63384         LDKBlindedHop orig_conv;
63385         orig_conv.inner = untag_ptr(orig);
63386         orig_conv.is_owned = ptr_is_owned(orig);
63387         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63388         orig_conv.is_owned = false;
63389         LDKBlindedHop ret_var = BlindedHop_clone(&orig_conv);
63390         uint64_t ret_ref = 0;
63391         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63392         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63393         return ret_ref;
63394 }
63395
63396 int64_t  __attribute__((export_name("TS_BlindedHop_hash"))) TS_BlindedHop_hash(uint64_t o) {
63397         LDKBlindedHop o_conv;
63398         o_conv.inner = untag_ptr(o);
63399         o_conv.is_owned = ptr_is_owned(o);
63400         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
63401         o_conv.is_owned = false;
63402         int64_t ret_conv = BlindedHop_hash(&o_conv);
63403         return ret_conv;
63404 }
63405
63406 jboolean  __attribute__((export_name("TS_BlindedHop_eq"))) TS_BlindedHop_eq(uint64_t a, uint64_t b) {
63407         LDKBlindedHop a_conv;
63408         a_conv.inner = untag_ptr(a);
63409         a_conv.is_owned = ptr_is_owned(a);
63410         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63411         a_conv.is_owned = false;
63412         LDKBlindedHop b_conv;
63413         b_conv.inner = untag_ptr(b);
63414         b_conv.is_owned = ptr_is_owned(b);
63415         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63416         b_conv.is_owned = false;
63417         jboolean ret_conv = BlindedHop_eq(&a_conv, &b_conv);
63418         return ret_conv;
63419 }
63420
63421 uint64_t  __attribute__((export_name("TS_BlindedPath_new_for_message"))) TS_BlindedPath_new_for_message(ptrArray node_pks, uint64_t entropy_source) {
63422         LDKCVec_PublicKeyZ node_pks_constr;
63423         node_pks_constr.datalen = node_pks->arr_len;
63424         if (node_pks_constr.datalen > 0)
63425                 node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
63426         else
63427                 node_pks_constr.data = NULL;
63428         int8_tArray* node_pks_vals = (void*) node_pks->elems;
63429         for (size_t m = 0; m < node_pks_constr.datalen; m++) {
63430                 int8_tArray node_pks_conv_12 = node_pks_vals[m];
63431                 LDKPublicKey node_pks_conv_12_ref;
63432                 CHECK(node_pks_conv_12->arr_len == 33);
63433                 memcpy(node_pks_conv_12_ref.compressed_form, node_pks_conv_12->elems, 33); FREE(node_pks_conv_12);
63434                 node_pks_constr.data[m] = node_pks_conv_12_ref;
63435         }
63436         FREE(node_pks);
63437         void* entropy_source_ptr = untag_ptr(entropy_source);
63438         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
63439         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
63440         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
63441         *ret_conv = BlindedPath_new_for_message(node_pks_constr, entropy_source_conv);
63442         return tag_ptr(ret_conv, true);
63443 }
63444
63445 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) {
63446         LDKPublicKey payee_node_id_ref;
63447         CHECK(payee_node_id->arr_len == 33);
63448         memcpy(payee_node_id_ref.compressed_form, payee_node_id->elems, 33); FREE(payee_node_id);
63449         LDKReceiveTlvs payee_tlvs_conv;
63450         payee_tlvs_conv.inner = untag_ptr(payee_tlvs);
63451         payee_tlvs_conv.is_owned = ptr_is_owned(payee_tlvs);
63452         CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_tlvs_conv);
63453         payee_tlvs_conv = ReceiveTlvs_clone(&payee_tlvs_conv);
63454         void* entropy_source_ptr = untag_ptr(entropy_source);
63455         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
63456         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
63457         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
63458         *ret_conv = BlindedPath_one_hop_for_payment(payee_node_id_ref, payee_tlvs_conv, entropy_source_conv);
63459         return tag_ptr(ret_conv, true);
63460 }
63461
63462 int8_tArray  __attribute__((export_name("TS_BlindedPath_write"))) TS_BlindedPath_write(uint64_t obj) {
63463         LDKBlindedPath obj_conv;
63464         obj_conv.inner = untag_ptr(obj);
63465         obj_conv.is_owned = ptr_is_owned(obj);
63466         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63467         obj_conv.is_owned = false;
63468         LDKCVec_u8Z ret_var = BlindedPath_write(&obj_conv);
63469         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63470         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63471         CVec_u8Z_free(ret_var);
63472         return ret_arr;
63473 }
63474
63475 uint64_t  __attribute__((export_name("TS_BlindedPath_read"))) TS_BlindedPath_read(int8_tArray ser) {
63476         LDKu8slice ser_ref;
63477         ser_ref.datalen = ser->arr_len;
63478         ser_ref.data = ser->elems;
63479         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
63480         *ret_conv = BlindedPath_read(ser_ref);
63481         FREE(ser);
63482         return tag_ptr(ret_conv, true);
63483 }
63484
63485 int8_tArray  __attribute__((export_name("TS_BlindedHop_write"))) TS_BlindedHop_write(uint64_t obj) {
63486         LDKBlindedHop obj_conv;
63487         obj_conv.inner = untag_ptr(obj);
63488         obj_conv.is_owned = ptr_is_owned(obj);
63489         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63490         obj_conv.is_owned = false;
63491         LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
63492         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63493         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63494         CVec_u8Z_free(ret_var);
63495         return ret_arr;
63496 }
63497
63498 uint64_t  __attribute__((export_name("TS_BlindedHop_read"))) TS_BlindedHop_read(int8_tArray ser) {
63499         LDKu8slice ser_ref;
63500         ser_ref.datalen = ser->arr_len;
63501         ser_ref.data = ser->elems;
63502         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
63503         *ret_conv = BlindedHop_read(ser_ref);
63504         FREE(ser);
63505         return tag_ptr(ret_conv, true);
63506 }
63507
63508 void  __attribute__((export_name("TS_ForwardNode_free"))) TS_ForwardNode_free(uint64_t this_obj) {
63509         LDKForwardNode this_obj_conv;
63510         this_obj_conv.inner = untag_ptr(this_obj);
63511         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63513         ForwardNode_free(this_obj_conv);
63514 }
63515
63516 uint64_t  __attribute__((export_name("TS_ForwardNode_get_tlvs"))) TS_ForwardNode_get_tlvs(uint64_t this_ptr) {
63517         LDKForwardNode this_ptr_conv;
63518         this_ptr_conv.inner = untag_ptr(this_ptr);
63519         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63521         this_ptr_conv.is_owned = false;
63522         LDKForwardTlvs ret_var = ForwardNode_get_tlvs(&this_ptr_conv);
63523         uint64_t ret_ref = 0;
63524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63526         return ret_ref;
63527 }
63528
63529 void  __attribute__((export_name("TS_ForwardNode_set_tlvs"))) TS_ForwardNode_set_tlvs(uint64_t this_ptr, uint64_t val) {
63530         LDKForwardNode this_ptr_conv;
63531         this_ptr_conv.inner = untag_ptr(this_ptr);
63532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63534         this_ptr_conv.is_owned = false;
63535         LDKForwardTlvs val_conv;
63536         val_conv.inner = untag_ptr(val);
63537         val_conv.is_owned = ptr_is_owned(val);
63538         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63539         val_conv = ForwardTlvs_clone(&val_conv);
63540         ForwardNode_set_tlvs(&this_ptr_conv, val_conv);
63541 }
63542
63543 int8_tArray  __attribute__((export_name("TS_ForwardNode_get_node_id"))) TS_ForwardNode_get_node_id(uint64_t this_ptr) {
63544         LDKForwardNode this_ptr_conv;
63545         this_ptr_conv.inner = untag_ptr(this_ptr);
63546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63548         this_ptr_conv.is_owned = false;
63549         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
63550         memcpy(ret_arr->elems, ForwardNode_get_node_id(&this_ptr_conv).compressed_form, 33);
63551         return ret_arr;
63552 }
63553
63554 void  __attribute__((export_name("TS_ForwardNode_set_node_id"))) TS_ForwardNode_set_node_id(uint64_t this_ptr, int8_tArray val) {
63555         LDKForwardNode this_ptr_conv;
63556         this_ptr_conv.inner = untag_ptr(this_ptr);
63557         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63559         this_ptr_conv.is_owned = false;
63560         LDKPublicKey val_ref;
63561         CHECK(val->arr_len == 33);
63562         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
63563         ForwardNode_set_node_id(&this_ptr_conv, val_ref);
63564 }
63565
63566 int64_t  __attribute__((export_name("TS_ForwardNode_get_htlc_maximum_msat"))) TS_ForwardNode_get_htlc_maximum_msat(uint64_t this_ptr) {
63567         LDKForwardNode this_ptr_conv;
63568         this_ptr_conv.inner = untag_ptr(this_ptr);
63569         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63571         this_ptr_conv.is_owned = false;
63572         int64_t ret_conv = ForwardNode_get_htlc_maximum_msat(&this_ptr_conv);
63573         return ret_conv;
63574 }
63575
63576 void  __attribute__((export_name("TS_ForwardNode_set_htlc_maximum_msat"))) TS_ForwardNode_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
63577         LDKForwardNode this_ptr_conv;
63578         this_ptr_conv.inner = untag_ptr(this_ptr);
63579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63581         this_ptr_conv.is_owned = false;
63582         ForwardNode_set_htlc_maximum_msat(&this_ptr_conv, val);
63583 }
63584
63585 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) {
63586         LDKForwardTlvs tlvs_arg_conv;
63587         tlvs_arg_conv.inner = untag_ptr(tlvs_arg);
63588         tlvs_arg_conv.is_owned = ptr_is_owned(tlvs_arg);
63589         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_arg_conv);
63590         tlvs_arg_conv = ForwardTlvs_clone(&tlvs_arg_conv);
63591         LDKPublicKey node_id_arg_ref;
63592         CHECK(node_id_arg->arr_len == 33);
63593         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
63594         LDKForwardNode ret_var = ForwardNode_new(tlvs_arg_conv, node_id_arg_ref, htlc_maximum_msat_arg);
63595         uint64_t ret_ref = 0;
63596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63598         return ret_ref;
63599 }
63600
63601 static inline uint64_t ForwardNode_clone_ptr(LDKForwardNode *NONNULL_PTR arg) {
63602         LDKForwardNode ret_var = ForwardNode_clone(arg);
63603         uint64_t ret_ref = 0;
63604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63606         return ret_ref;
63607 }
63608 int64_t  __attribute__((export_name("TS_ForwardNode_clone_ptr"))) TS_ForwardNode_clone_ptr(uint64_t arg) {
63609         LDKForwardNode arg_conv;
63610         arg_conv.inner = untag_ptr(arg);
63611         arg_conv.is_owned = ptr_is_owned(arg);
63612         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63613         arg_conv.is_owned = false;
63614         int64_t ret_conv = ForwardNode_clone_ptr(&arg_conv);
63615         return ret_conv;
63616 }
63617
63618 uint64_t  __attribute__((export_name("TS_ForwardNode_clone"))) TS_ForwardNode_clone(uint64_t orig) {
63619         LDKForwardNode orig_conv;
63620         orig_conv.inner = untag_ptr(orig);
63621         orig_conv.is_owned = ptr_is_owned(orig);
63622         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63623         orig_conv.is_owned = false;
63624         LDKForwardNode ret_var = ForwardNode_clone(&orig_conv);
63625         uint64_t ret_ref = 0;
63626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63628         return ret_ref;
63629 }
63630
63631 void  __attribute__((export_name("TS_ForwardTlvs_free"))) TS_ForwardTlvs_free(uint64_t this_obj) {
63632         LDKForwardTlvs this_obj_conv;
63633         this_obj_conv.inner = untag_ptr(this_obj);
63634         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63636         ForwardTlvs_free(this_obj_conv);
63637 }
63638
63639 int64_t  __attribute__((export_name("TS_ForwardTlvs_get_short_channel_id"))) TS_ForwardTlvs_get_short_channel_id(uint64_t this_ptr) {
63640         LDKForwardTlvs this_ptr_conv;
63641         this_ptr_conv.inner = untag_ptr(this_ptr);
63642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63644         this_ptr_conv.is_owned = false;
63645         int64_t ret_conv = ForwardTlvs_get_short_channel_id(&this_ptr_conv);
63646         return ret_conv;
63647 }
63648
63649 void  __attribute__((export_name("TS_ForwardTlvs_set_short_channel_id"))) TS_ForwardTlvs_set_short_channel_id(uint64_t this_ptr, int64_t val) {
63650         LDKForwardTlvs this_ptr_conv;
63651         this_ptr_conv.inner = untag_ptr(this_ptr);
63652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63654         this_ptr_conv.is_owned = false;
63655         ForwardTlvs_set_short_channel_id(&this_ptr_conv, val);
63656 }
63657
63658 uint64_t  __attribute__((export_name("TS_ForwardTlvs_get_payment_relay"))) TS_ForwardTlvs_get_payment_relay(uint64_t this_ptr) {
63659         LDKForwardTlvs this_ptr_conv;
63660         this_ptr_conv.inner = untag_ptr(this_ptr);
63661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63663         this_ptr_conv.is_owned = false;
63664         LDKPaymentRelay ret_var = ForwardTlvs_get_payment_relay(&this_ptr_conv);
63665         uint64_t ret_ref = 0;
63666         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63667         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63668         return ret_ref;
63669 }
63670
63671 void  __attribute__((export_name("TS_ForwardTlvs_set_payment_relay"))) TS_ForwardTlvs_set_payment_relay(uint64_t this_ptr, uint64_t val) {
63672         LDKForwardTlvs this_ptr_conv;
63673         this_ptr_conv.inner = untag_ptr(this_ptr);
63674         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63676         this_ptr_conv.is_owned = false;
63677         LDKPaymentRelay val_conv;
63678         val_conv.inner = untag_ptr(val);
63679         val_conv.is_owned = ptr_is_owned(val);
63680         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63681         val_conv = PaymentRelay_clone(&val_conv);
63682         ForwardTlvs_set_payment_relay(&this_ptr_conv, val_conv);
63683 }
63684
63685 uint64_t  __attribute__((export_name("TS_ForwardTlvs_get_payment_constraints"))) TS_ForwardTlvs_get_payment_constraints(uint64_t this_ptr) {
63686         LDKForwardTlvs this_ptr_conv;
63687         this_ptr_conv.inner = untag_ptr(this_ptr);
63688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63690         this_ptr_conv.is_owned = false;
63691         LDKPaymentConstraints ret_var = ForwardTlvs_get_payment_constraints(&this_ptr_conv);
63692         uint64_t ret_ref = 0;
63693         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63694         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63695         return ret_ref;
63696 }
63697
63698 void  __attribute__((export_name("TS_ForwardTlvs_set_payment_constraints"))) TS_ForwardTlvs_set_payment_constraints(uint64_t this_ptr, uint64_t val) {
63699         LDKForwardTlvs this_ptr_conv;
63700         this_ptr_conv.inner = untag_ptr(this_ptr);
63701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63703         this_ptr_conv.is_owned = false;
63704         LDKPaymentConstraints val_conv;
63705         val_conv.inner = untag_ptr(val);
63706         val_conv.is_owned = ptr_is_owned(val);
63707         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63708         val_conv = PaymentConstraints_clone(&val_conv);
63709         ForwardTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
63710 }
63711
63712 uint64_t  __attribute__((export_name("TS_ForwardTlvs_get_features"))) TS_ForwardTlvs_get_features(uint64_t this_ptr) {
63713         LDKForwardTlvs this_ptr_conv;
63714         this_ptr_conv.inner = untag_ptr(this_ptr);
63715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63717         this_ptr_conv.is_owned = false;
63718         LDKBlindedHopFeatures ret_var = ForwardTlvs_get_features(&this_ptr_conv);
63719         uint64_t ret_ref = 0;
63720         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63721         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63722         return ret_ref;
63723 }
63724
63725 void  __attribute__((export_name("TS_ForwardTlvs_set_features"))) TS_ForwardTlvs_set_features(uint64_t this_ptr, uint64_t val) {
63726         LDKForwardTlvs this_ptr_conv;
63727         this_ptr_conv.inner = untag_ptr(this_ptr);
63728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63730         this_ptr_conv.is_owned = false;
63731         LDKBlindedHopFeatures val_conv;
63732         val_conv.inner = untag_ptr(val);
63733         val_conv.is_owned = ptr_is_owned(val);
63734         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63735         val_conv = BlindedHopFeatures_clone(&val_conv);
63736         ForwardTlvs_set_features(&this_ptr_conv, val_conv);
63737 }
63738
63739 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) {
63740         LDKPaymentRelay payment_relay_arg_conv;
63741         payment_relay_arg_conv.inner = untag_ptr(payment_relay_arg);
63742         payment_relay_arg_conv.is_owned = ptr_is_owned(payment_relay_arg);
63743         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_relay_arg_conv);
63744         payment_relay_arg_conv = PaymentRelay_clone(&payment_relay_arg_conv);
63745         LDKPaymentConstraints payment_constraints_arg_conv;
63746         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
63747         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
63748         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
63749         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
63750         LDKBlindedHopFeatures features_arg_conv;
63751         features_arg_conv.inner = untag_ptr(features_arg);
63752         features_arg_conv.is_owned = ptr_is_owned(features_arg);
63753         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
63754         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
63755         LDKForwardTlvs ret_var = ForwardTlvs_new(short_channel_id_arg, payment_relay_arg_conv, payment_constraints_arg_conv, features_arg_conv);
63756         uint64_t ret_ref = 0;
63757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63759         return ret_ref;
63760 }
63761
63762 static inline uint64_t ForwardTlvs_clone_ptr(LDKForwardTlvs *NONNULL_PTR arg) {
63763         LDKForwardTlvs ret_var = ForwardTlvs_clone(arg);
63764         uint64_t ret_ref = 0;
63765         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63766         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63767         return ret_ref;
63768 }
63769 int64_t  __attribute__((export_name("TS_ForwardTlvs_clone_ptr"))) TS_ForwardTlvs_clone_ptr(uint64_t arg) {
63770         LDKForwardTlvs arg_conv;
63771         arg_conv.inner = untag_ptr(arg);
63772         arg_conv.is_owned = ptr_is_owned(arg);
63773         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63774         arg_conv.is_owned = false;
63775         int64_t ret_conv = ForwardTlvs_clone_ptr(&arg_conv);
63776         return ret_conv;
63777 }
63778
63779 uint64_t  __attribute__((export_name("TS_ForwardTlvs_clone"))) TS_ForwardTlvs_clone(uint64_t orig) {
63780         LDKForwardTlvs orig_conv;
63781         orig_conv.inner = untag_ptr(orig);
63782         orig_conv.is_owned = ptr_is_owned(orig);
63783         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63784         orig_conv.is_owned = false;
63785         LDKForwardTlvs ret_var = ForwardTlvs_clone(&orig_conv);
63786         uint64_t ret_ref = 0;
63787         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63788         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63789         return ret_ref;
63790 }
63791
63792 void  __attribute__((export_name("TS_ReceiveTlvs_free"))) TS_ReceiveTlvs_free(uint64_t this_obj) {
63793         LDKReceiveTlvs this_obj_conv;
63794         this_obj_conv.inner = untag_ptr(this_obj);
63795         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63797         ReceiveTlvs_free(this_obj_conv);
63798 }
63799
63800 int8_tArray  __attribute__((export_name("TS_ReceiveTlvs_get_payment_secret"))) TS_ReceiveTlvs_get_payment_secret(uint64_t this_ptr) {
63801         LDKReceiveTlvs this_ptr_conv;
63802         this_ptr_conv.inner = untag_ptr(this_ptr);
63803         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63805         this_ptr_conv.is_owned = false;
63806         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
63807         memcpy(ret_arr->elems, *ReceiveTlvs_get_payment_secret(&this_ptr_conv), 32);
63808         return ret_arr;
63809 }
63810
63811 void  __attribute__((export_name("TS_ReceiveTlvs_set_payment_secret"))) TS_ReceiveTlvs_set_payment_secret(uint64_t this_ptr, int8_tArray val) {
63812         LDKReceiveTlvs this_ptr_conv;
63813         this_ptr_conv.inner = untag_ptr(this_ptr);
63814         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63816         this_ptr_conv.is_owned = false;
63817         LDKThirtyTwoBytes val_ref;
63818         CHECK(val->arr_len == 32);
63819         memcpy(val_ref.data, val->elems, 32); FREE(val);
63820         ReceiveTlvs_set_payment_secret(&this_ptr_conv, val_ref);
63821 }
63822
63823 uint64_t  __attribute__((export_name("TS_ReceiveTlvs_get_payment_constraints"))) TS_ReceiveTlvs_get_payment_constraints(uint64_t this_ptr) {
63824         LDKReceiveTlvs this_ptr_conv;
63825         this_ptr_conv.inner = untag_ptr(this_ptr);
63826         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63828         this_ptr_conv.is_owned = false;
63829         LDKPaymentConstraints ret_var = ReceiveTlvs_get_payment_constraints(&this_ptr_conv);
63830         uint64_t ret_ref = 0;
63831         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63832         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63833         return ret_ref;
63834 }
63835
63836 void  __attribute__((export_name("TS_ReceiveTlvs_set_payment_constraints"))) TS_ReceiveTlvs_set_payment_constraints(uint64_t this_ptr, uint64_t val) {
63837         LDKReceiveTlvs this_ptr_conv;
63838         this_ptr_conv.inner = untag_ptr(this_ptr);
63839         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63841         this_ptr_conv.is_owned = false;
63842         LDKPaymentConstraints val_conv;
63843         val_conv.inner = untag_ptr(val);
63844         val_conv.is_owned = ptr_is_owned(val);
63845         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63846         val_conv = PaymentConstraints_clone(&val_conv);
63847         ReceiveTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
63848 }
63849
63850 uint64_t  __attribute__((export_name("TS_ReceiveTlvs_new"))) TS_ReceiveTlvs_new(int8_tArray payment_secret_arg, uint64_t payment_constraints_arg) {
63851         LDKThirtyTwoBytes payment_secret_arg_ref;
63852         CHECK(payment_secret_arg->arr_len == 32);
63853         memcpy(payment_secret_arg_ref.data, payment_secret_arg->elems, 32); FREE(payment_secret_arg);
63854         LDKPaymentConstraints payment_constraints_arg_conv;
63855         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
63856         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
63857         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
63858         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
63859         LDKReceiveTlvs ret_var = ReceiveTlvs_new(payment_secret_arg_ref, payment_constraints_arg_conv);
63860         uint64_t ret_ref = 0;
63861         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63862         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63863         return ret_ref;
63864 }
63865
63866 static inline uint64_t ReceiveTlvs_clone_ptr(LDKReceiveTlvs *NONNULL_PTR arg) {
63867         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(arg);
63868         uint64_t ret_ref = 0;
63869         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63870         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63871         return ret_ref;
63872 }
63873 int64_t  __attribute__((export_name("TS_ReceiveTlvs_clone_ptr"))) TS_ReceiveTlvs_clone_ptr(uint64_t arg) {
63874         LDKReceiveTlvs arg_conv;
63875         arg_conv.inner = untag_ptr(arg);
63876         arg_conv.is_owned = ptr_is_owned(arg);
63877         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63878         arg_conv.is_owned = false;
63879         int64_t ret_conv = ReceiveTlvs_clone_ptr(&arg_conv);
63880         return ret_conv;
63881 }
63882
63883 uint64_t  __attribute__((export_name("TS_ReceiveTlvs_clone"))) TS_ReceiveTlvs_clone(uint64_t orig) {
63884         LDKReceiveTlvs orig_conv;
63885         orig_conv.inner = untag_ptr(orig);
63886         orig_conv.is_owned = ptr_is_owned(orig);
63887         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63888         orig_conv.is_owned = false;
63889         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(&orig_conv);
63890         uint64_t ret_ref = 0;
63891         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63892         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63893         return ret_ref;
63894 }
63895
63896 void  __attribute__((export_name("TS_PaymentRelay_free"))) TS_PaymentRelay_free(uint64_t this_obj) {
63897         LDKPaymentRelay this_obj_conv;
63898         this_obj_conv.inner = untag_ptr(this_obj);
63899         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63901         PaymentRelay_free(this_obj_conv);
63902 }
63903
63904 int16_t  __attribute__((export_name("TS_PaymentRelay_get_cltv_expiry_delta"))) TS_PaymentRelay_get_cltv_expiry_delta(uint64_t this_ptr) {
63905         LDKPaymentRelay this_ptr_conv;
63906         this_ptr_conv.inner = untag_ptr(this_ptr);
63907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63909         this_ptr_conv.is_owned = false;
63910         int16_t ret_conv = PaymentRelay_get_cltv_expiry_delta(&this_ptr_conv);
63911         return ret_conv;
63912 }
63913
63914 void  __attribute__((export_name("TS_PaymentRelay_set_cltv_expiry_delta"))) TS_PaymentRelay_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
63915         LDKPaymentRelay this_ptr_conv;
63916         this_ptr_conv.inner = untag_ptr(this_ptr);
63917         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63919         this_ptr_conv.is_owned = false;
63920         PaymentRelay_set_cltv_expiry_delta(&this_ptr_conv, val);
63921 }
63922
63923 int32_t  __attribute__((export_name("TS_PaymentRelay_get_fee_proportional_millionths"))) TS_PaymentRelay_get_fee_proportional_millionths(uint64_t this_ptr) {
63924         LDKPaymentRelay this_ptr_conv;
63925         this_ptr_conv.inner = untag_ptr(this_ptr);
63926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63928         this_ptr_conv.is_owned = false;
63929         int32_t ret_conv = PaymentRelay_get_fee_proportional_millionths(&this_ptr_conv);
63930         return ret_conv;
63931 }
63932
63933 void  __attribute__((export_name("TS_PaymentRelay_set_fee_proportional_millionths"))) TS_PaymentRelay_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
63934         LDKPaymentRelay this_ptr_conv;
63935         this_ptr_conv.inner = untag_ptr(this_ptr);
63936         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63938         this_ptr_conv.is_owned = false;
63939         PaymentRelay_set_fee_proportional_millionths(&this_ptr_conv, val);
63940 }
63941
63942 int32_t  __attribute__((export_name("TS_PaymentRelay_get_fee_base_msat"))) TS_PaymentRelay_get_fee_base_msat(uint64_t this_ptr) {
63943         LDKPaymentRelay this_ptr_conv;
63944         this_ptr_conv.inner = untag_ptr(this_ptr);
63945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63947         this_ptr_conv.is_owned = false;
63948         int32_t ret_conv = PaymentRelay_get_fee_base_msat(&this_ptr_conv);
63949         return ret_conv;
63950 }
63951
63952 void  __attribute__((export_name("TS_PaymentRelay_set_fee_base_msat"))) TS_PaymentRelay_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
63953         LDKPaymentRelay this_ptr_conv;
63954         this_ptr_conv.inner = untag_ptr(this_ptr);
63955         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63957         this_ptr_conv.is_owned = false;
63958         PaymentRelay_set_fee_base_msat(&this_ptr_conv, val);
63959 }
63960
63961 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) {
63962         LDKPaymentRelay ret_var = PaymentRelay_new(cltv_expiry_delta_arg, fee_proportional_millionths_arg, fee_base_msat_arg);
63963         uint64_t ret_ref = 0;
63964         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63965         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63966         return ret_ref;
63967 }
63968
63969 static inline uint64_t PaymentRelay_clone_ptr(LDKPaymentRelay *NONNULL_PTR arg) {
63970         LDKPaymentRelay ret_var = PaymentRelay_clone(arg);
63971         uint64_t ret_ref = 0;
63972         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63973         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63974         return ret_ref;
63975 }
63976 int64_t  __attribute__((export_name("TS_PaymentRelay_clone_ptr"))) TS_PaymentRelay_clone_ptr(uint64_t arg) {
63977         LDKPaymentRelay arg_conv;
63978         arg_conv.inner = untag_ptr(arg);
63979         arg_conv.is_owned = ptr_is_owned(arg);
63980         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63981         arg_conv.is_owned = false;
63982         int64_t ret_conv = PaymentRelay_clone_ptr(&arg_conv);
63983         return ret_conv;
63984 }
63985
63986 uint64_t  __attribute__((export_name("TS_PaymentRelay_clone"))) TS_PaymentRelay_clone(uint64_t orig) {
63987         LDKPaymentRelay orig_conv;
63988         orig_conv.inner = untag_ptr(orig);
63989         orig_conv.is_owned = ptr_is_owned(orig);
63990         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63991         orig_conv.is_owned = false;
63992         LDKPaymentRelay ret_var = PaymentRelay_clone(&orig_conv);
63993         uint64_t ret_ref = 0;
63994         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63995         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63996         return ret_ref;
63997 }
63998
63999 void  __attribute__((export_name("TS_PaymentConstraints_free"))) TS_PaymentConstraints_free(uint64_t this_obj) {
64000         LDKPaymentConstraints this_obj_conv;
64001         this_obj_conv.inner = untag_ptr(this_obj);
64002         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64004         PaymentConstraints_free(this_obj_conv);
64005 }
64006
64007 int32_t  __attribute__((export_name("TS_PaymentConstraints_get_max_cltv_expiry"))) TS_PaymentConstraints_get_max_cltv_expiry(uint64_t this_ptr) {
64008         LDKPaymentConstraints this_ptr_conv;
64009         this_ptr_conv.inner = untag_ptr(this_ptr);
64010         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64012         this_ptr_conv.is_owned = false;
64013         int32_t ret_conv = PaymentConstraints_get_max_cltv_expiry(&this_ptr_conv);
64014         return ret_conv;
64015 }
64016
64017 void  __attribute__((export_name("TS_PaymentConstraints_set_max_cltv_expiry"))) TS_PaymentConstraints_set_max_cltv_expiry(uint64_t this_ptr, int32_t val) {
64018         LDKPaymentConstraints this_ptr_conv;
64019         this_ptr_conv.inner = untag_ptr(this_ptr);
64020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64022         this_ptr_conv.is_owned = false;
64023         PaymentConstraints_set_max_cltv_expiry(&this_ptr_conv, val);
64024 }
64025
64026 int64_t  __attribute__((export_name("TS_PaymentConstraints_get_htlc_minimum_msat"))) TS_PaymentConstraints_get_htlc_minimum_msat(uint64_t this_ptr) {
64027         LDKPaymentConstraints this_ptr_conv;
64028         this_ptr_conv.inner = untag_ptr(this_ptr);
64029         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64031         this_ptr_conv.is_owned = false;
64032         int64_t ret_conv = PaymentConstraints_get_htlc_minimum_msat(&this_ptr_conv);
64033         return ret_conv;
64034 }
64035
64036 void  __attribute__((export_name("TS_PaymentConstraints_set_htlc_minimum_msat"))) TS_PaymentConstraints_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
64037         LDKPaymentConstraints this_ptr_conv;
64038         this_ptr_conv.inner = untag_ptr(this_ptr);
64039         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64041         this_ptr_conv.is_owned = false;
64042         PaymentConstraints_set_htlc_minimum_msat(&this_ptr_conv, val);
64043 }
64044
64045 uint64_t  __attribute__((export_name("TS_PaymentConstraints_new"))) TS_PaymentConstraints_new(int32_t max_cltv_expiry_arg, int64_t htlc_minimum_msat_arg) {
64046         LDKPaymentConstraints ret_var = PaymentConstraints_new(max_cltv_expiry_arg, htlc_minimum_msat_arg);
64047         uint64_t ret_ref = 0;
64048         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64049         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64050         return ret_ref;
64051 }
64052
64053 static inline uint64_t PaymentConstraints_clone_ptr(LDKPaymentConstraints *NONNULL_PTR arg) {
64054         LDKPaymentConstraints ret_var = PaymentConstraints_clone(arg);
64055         uint64_t ret_ref = 0;
64056         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64057         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64058         return ret_ref;
64059 }
64060 int64_t  __attribute__((export_name("TS_PaymentConstraints_clone_ptr"))) TS_PaymentConstraints_clone_ptr(uint64_t arg) {
64061         LDKPaymentConstraints arg_conv;
64062         arg_conv.inner = untag_ptr(arg);
64063         arg_conv.is_owned = ptr_is_owned(arg);
64064         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64065         arg_conv.is_owned = false;
64066         int64_t ret_conv = PaymentConstraints_clone_ptr(&arg_conv);
64067         return ret_conv;
64068 }
64069
64070 uint64_t  __attribute__((export_name("TS_PaymentConstraints_clone"))) TS_PaymentConstraints_clone(uint64_t orig) {
64071         LDKPaymentConstraints orig_conv;
64072         orig_conv.inner = untag_ptr(orig);
64073         orig_conv.is_owned = ptr_is_owned(orig);
64074         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64075         orig_conv.is_owned = false;
64076         LDKPaymentConstraints ret_var = PaymentConstraints_clone(&orig_conv);
64077         uint64_t ret_ref = 0;
64078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64080         return ret_ref;
64081 }
64082
64083 int8_tArray  __attribute__((export_name("TS_ForwardTlvs_write"))) TS_ForwardTlvs_write(uint64_t obj) {
64084         LDKForwardTlvs obj_conv;
64085         obj_conv.inner = untag_ptr(obj);
64086         obj_conv.is_owned = ptr_is_owned(obj);
64087         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64088         obj_conv.is_owned = false;
64089         LDKCVec_u8Z ret_var = ForwardTlvs_write(&obj_conv);
64090         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64091         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64092         CVec_u8Z_free(ret_var);
64093         return ret_arr;
64094 }
64095
64096 int8_tArray  __attribute__((export_name("TS_ReceiveTlvs_write"))) TS_ReceiveTlvs_write(uint64_t obj) {
64097         LDKReceiveTlvs obj_conv;
64098         obj_conv.inner = untag_ptr(obj);
64099         obj_conv.is_owned = ptr_is_owned(obj);
64100         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64101         obj_conv.is_owned = false;
64102         LDKCVec_u8Z ret_var = ReceiveTlvs_write(&obj_conv);
64103         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64104         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64105         CVec_u8Z_free(ret_var);
64106         return ret_arr;
64107 }
64108
64109 uint64_t  __attribute__((export_name("TS_ReceiveTlvs_read"))) TS_ReceiveTlvs_read(int8_tArray ser) {
64110         LDKu8slice ser_ref;
64111         ser_ref.datalen = ser->arr_len;
64112         ser_ref.data = ser->elems;
64113         LDKCResult_ReceiveTlvsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ), "LDKCResult_ReceiveTlvsDecodeErrorZ");
64114         *ret_conv = ReceiveTlvs_read(ser_ref);
64115         FREE(ser);
64116         return tag_ptr(ret_conv, true);
64117 }
64118
64119 int8_tArray  __attribute__((export_name("TS_PaymentRelay_write"))) TS_PaymentRelay_write(uint64_t obj) {
64120         LDKPaymentRelay obj_conv;
64121         obj_conv.inner = untag_ptr(obj);
64122         obj_conv.is_owned = ptr_is_owned(obj);
64123         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64124         obj_conv.is_owned = false;
64125         LDKCVec_u8Z ret_var = PaymentRelay_write(&obj_conv);
64126         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64127         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64128         CVec_u8Z_free(ret_var);
64129         return ret_arr;
64130 }
64131
64132 uint64_t  __attribute__((export_name("TS_PaymentRelay_read"))) TS_PaymentRelay_read(int8_tArray ser) {
64133         LDKu8slice ser_ref;
64134         ser_ref.datalen = ser->arr_len;
64135         ser_ref.data = ser->elems;
64136         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
64137         *ret_conv = PaymentRelay_read(ser_ref);
64138         FREE(ser);
64139         return tag_ptr(ret_conv, true);
64140 }
64141
64142 int8_tArray  __attribute__((export_name("TS_PaymentConstraints_write"))) TS_PaymentConstraints_write(uint64_t obj) {
64143         LDKPaymentConstraints obj_conv;
64144         obj_conv.inner = untag_ptr(obj);
64145         obj_conv.is_owned = ptr_is_owned(obj);
64146         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64147         obj_conv.is_owned = false;
64148         LDKCVec_u8Z ret_var = PaymentConstraints_write(&obj_conv);
64149         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64150         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64151         CVec_u8Z_free(ret_var);
64152         return ret_arr;
64153 }
64154
64155 uint64_t  __attribute__((export_name("TS_PaymentConstraints_read"))) TS_PaymentConstraints_read(int8_tArray ser) {
64156         LDKu8slice ser_ref;
64157         ser_ref.datalen = ser->arr_len;
64158         ser_ref.data = ser->elems;
64159         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
64160         *ret_conv = PaymentConstraints_read(ser_ref);
64161         FREE(ser);
64162         return tag_ptr(ret_conv, true);
64163 }
64164
64165 void  __attribute__((export_name("TS_PaymentPurpose_free"))) TS_PaymentPurpose_free(uint64_t this_ptr) {
64166         if (!ptr_is_owned(this_ptr)) return;
64167         void* this_ptr_ptr = untag_ptr(this_ptr);
64168         CHECK_ACCESS(this_ptr_ptr);
64169         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
64170         FREE(untag_ptr(this_ptr));
64171         PaymentPurpose_free(this_ptr_conv);
64172 }
64173
64174 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
64175         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
64176         *ret_copy = PaymentPurpose_clone(arg);
64177         uint64_t ret_ref = tag_ptr(ret_copy, true);
64178         return ret_ref;
64179 }
64180 int64_t  __attribute__((export_name("TS_PaymentPurpose_clone_ptr"))) TS_PaymentPurpose_clone_ptr(uint64_t arg) {
64181         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
64182         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
64183         return ret_conv;
64184 }
64185
64186 uint64_t  __attribute__((export_name("TS_PaymentPurpose_clone"))) TS_PaymentPurpose_clone(uint64_t orig) {
64187         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
64188         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
64189         *ret_copy = PaymentPurpose_clone(orig_conv);
64190         uint64_t ret_ref = tag_ptr(ret_copy, true);
64191         return ret_ref;
64192 }
64193
64194 uint64_t  __attribute__((export_name("TS_PaymentPurpose_invoice_payment"))) TS_PaymentPurpose_invoice_payment(uint64_t payment_preimage, int8_tArray payment_secret) {
64195         void* payment_preimage_ptr = untag_ptr(payment_preimage);
64196         CHECK_ACCESS(payment_preimage_ptr);
64197         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
64198         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
64199         LDKThirtyTwoBytes payment_secret_ref;
64200         CHECK(payment_secret->arr_len == 32);
64201         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
64202         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
64203         *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_conv, payment_secret_ref);
64204         uint64_t ret_ref = tag_ptr(ret_copy, true);
64205         return ret_ref;
64206 }
64207
64208 uint64_t  __attribute__((export_name("TS_PaymentPurpose_spontaneous_payment"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
64209         LDKThirtyTwoBytes a_ref;
64210         CHECK(a->arr_len == 32);
64211         memcpy(a_ref.data, a->elems, 32); FREE(a);
64212         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
64213         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
64214         uint64_t ret_ref = tag_ptr(ret_copy, true);
64215         return ret_ref;
64216 }
64217
64218 jboolean  __attribute__((export_name("TS_PaymentPurpose_eq"))) TS_PaymentPurpose_eq(uint64_t a, uint64_t b) {
64219         LDKPaymentPurpose* a_conv = (LDKPaymentPurpose*)untag_ptr(a);
64220         LDKPaymentPurpose* b_conv = (LDKPaymentPurpose*)untag_ptr(b);
64221         jboolean ret_conv = PaymentPurpose_eq(a_conv, b_conv);
64222         return ret_conv;
64223 }
64224
64225 int8_tArray  __attribute__((export_name("TS_PaymentPurpose_write"))) TS_PaymentPurpose_write(uint64_t obj) {
64226         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
64227         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
64228         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64229         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64230         CVec_u8Z_free(ret_var);
64231         return ret_arr;
64232 }
64233
64234 uint64_t  __attribute__((export_name("TS_PaymentPurpose_read"))) TS_PaymentPurpose_read(int8_tArray ser) {
64235         LDKu8slice ser_ref;
64236         ser_ref.datalen = ser->arr_len;
64237         ser_ref.data = ser->elems;
64238         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
64239         *ret_conv = PaymentPurpose_read(ser_ref);
64240         FREE(ser);
64241         return tag_ptr(ret_conv, true);
64242 }
64243
64244 void  __attribute__((export_name("TS_ClaimedHTLC_free"))) TS_ClaimedHTLC_free(uint64_t this_obj) {
64245         LDKClaimedHTLC this_obj_conv;
64246         this_obj_conv.inner = untag_ptr(this_obj);
64247         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64249         ClaimedHTLC_free(this_obj_conv);
64250 }
64251
64252 int8_tArray  __attribute__((export_name("TS_ClaimedHTLC_get_channel_id"))) TS_ClaimedHTLC_get_channel_id(uint64_t this_ptr) {
64253         LDKClaimedHTLC this_ptr_conv;
64254         this_ptr_conv.inner = untag_ptr(this_ptr);
64255         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64257         this_ptr_conv.is_owned = false;
64258         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
64259         memcpy(ret_arr->elems, *ClaimedHTLC_get_channel_id(&this_ptr_conv), 32);
64260         return ret_arr;
64261 }
64262
64263 void  __attribute__((export_name("TS_ClaimedHTLC_set_channel_id"))) TS_ClaimedHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
64264         LDKClaimedHTLC this_ptr_conv;
64265         this_ptr_conv.inner = untag_ptr(this_ptr);
64266         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64268         this_ptr_conv.is_owned = false;
64269         LDKThirtyTwoBytes val_ref;
64270         CHECK(val->arr_len == 32);
64271         memcpy(val_ref.data, val->elems, 32); FREE(val);
64272         ClaimedHTLC_set_channel_id(&this_ptr_conv, val_ref);
64273 }
64274
64275 int8_tArray  __attribute__((export_name("TS_ClaimedHTLC_get_user_channel_id"))) TS_ClaimedHTLC_get_user_channel_id(uint64_t this_ptr) {
64276         LDKClaimedHTLC this_ptr_conv;
64277         this_ptr_conv.inner = untag_ptr(this_ptr);
64278         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64280         this_ptr_conv.is_owned = false;
64281         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
64282         memcpy(ret_arr->elems, ClaimedHTLC_get_user_channel_id(&this_ptr_conv).le_bytes, 16);
64283         return ret_arr;
64284 }
64285
64286 void  __attribute__((export_name("TS_ClaimedHTLC_set_user_channel_id"))) TS_ClaimedHTLC_set_user_channel_id(uint64_t this_ptr, int8_tArray val) {
64287         LDKClaimedHTLC this_ptr_conv;
64288         this_ptr_conv.inner = untag_ptr(this_ptr);
64289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64291         this_ptr_conv.is_owned = false;
64292         LDKU128 val_ref;
64293         CHECK(val->arr_len == 16);
64294         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
64295         ClaimedHTLC_set_user_channel_id(&this_ptr_conv, val_ref);
64296 }
64297
64298 int32_t  __attribute__((export_name("TS_ClaimedHTLC_get_cltv_expiry"))) TS_ClaimedHTLC_get_cltv_expiry(uint64_t this_ptr) {
64299         LDKClaimedHTLC this_ptr_conv;
64300         this_ptr_conv.inner = untag_ptr(this_ptr);
64301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64303         this_ptr_conv.is_owned = false;
64304         int32_t ret_conv = ClaimedHTLC_get_cltv_expiry(&this_ptr_conv);
64305         return ret_conv;
64306 }
64307
64308 void  __attribute__((export_name("TS_ClaimedHTLC_set_cltv_expiry"))) TS_ClaimedHTLC_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
64309         LDKClaimedHTLC this_ptr_conv;
64310         this_ptr_conv.inner = untag_ptr(this_ptr);
64311         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64313         this_ptr_conv.is_owned = false;
64314         ClaimedHTLC_set_cltv_expiry(&this_ptr_conv, val);
64315 }
64316
64317 int64_t  __attribute__((export_name("TS_ClaimedHTLC_get_value_msat"))) TS_ClaimedHTLC_get_value_msat(uint64_t this_ptr) {
64318         LDKClaimedHTLC this_ptr_conv;
64319         this_ptr_conv.inner = untag_ptr(this_ptr);
64320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64322         this_ptr_conv.is_owned = false;
64323         int64_t ret_conv = ClaimedHTLC_get_value_msat(&this_ptr_conv);
64324         return ret_conv;
64325 }
64326
64327 void  __attribute__((export_name("TS_ClaimedHTLC_set_value_msat"))) TS_ClaimedHTLC_set_value_msat(uint64_t this_ptr, int64_t val) {
64328         LDKClaimedHTLC this_ptr_conv;
64329         this_ptr_conv.inner = untag_ptr(this_ptr);
64330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64332         this_ptr_conv.is_owned = false;
64333         ClaimedHTLC_set_value_msat(&this_ptr_conv, val);
64334 }
64335
64336 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) {
64337         LDKThirtyTwoBytes channel_id_arg_ref;
64338         CHECK(channel_id_arg->arr_len == 32);
64339         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
64340         LDKU128 user_channel_id_arg_ref;
64341         CHECK(user_channel_id_arg->arr_len == 16);
64342         memcpy(user_channel_id_arg_ref.le_bytes, user_channel_id_arg->elems, 16); FREE(user_channel_id_arg);
64343         LDKClaimedHTLC ret_var = ClaimedHTLC_new(channel_id_arg_ref, user_channel_id_arg_ref, cltv_expiry_arg, value_msat_arg);
64344         uint64_t ret_ref = 0;
64345         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64346         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64347         return ret_ref;
64348 }
64349
64350 static inline uint64_t ClaimedHTLC_clone_ptr(LDKClaimedHTLC *NONNULL_PTR arg) {
64351         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(arg);
64352         uint64_t ret_ref = 0;
64353         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64354         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64355         return ret_ref;
64356 }
64357 int64_t  __attribute__((export_name("TS_ClaimedHTLC_clone_ptr"))) TS_ClaimedHTLC_clone_ptr(uint64_t arg) {
64358         LDKClaimedHTLC arg_conv;
64359         arg_conv.inner = untag_ptr(arg);
64360         arg_conv.is_owned = ptr_is_owned(arg);
64361         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64362         arg_conv.is_owned = false;
64363         int64_t ret_conv = ClaimedHTLC_clone_ptr(&arg_conv);
64364         return ret_conv;
64365 }
64366
64367 uint64_t  __attribute__((export_name("TS_ClaimedHTLC_clone"))) TS_ClaimedHTLC_clone(uint64_t orig) {
64368         LDKClaimedHTLC orig_conv;
64369         orig_conv.inner = untag_ptr(orig);
64370         orig_conv.is_owned = ptr_is_owned(orig);
64371         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64372         orig_conv.is_owned = false;
64373         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(&orig_conv);
64374         uint64_t ret_ref = 0;
64375         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64376         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64377         return ret_ref;
64378 }
64379
64380 jboolean  __attribute__((export_name("TS_ClaimedHTLC_eq"))) TS_ClaimedHTLC_eq(uint64_t a, uint64_t b) {
64381         LDKClaimedHTLC a_conv;
64382         a_conv.inner = untag_ptr(a);
64383         a_conv.is_owned = ptr_is_owned(a);
64384         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64385         a_conv.is_owned = false;
64386         LDKClaimedHTLC b_conv;
64387         b_conv.inner = untag_ptr(b);
64388         b_conv.is_owned = ptr_is_owned(b);
64389         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64390         b_conv.is_owned = false;
64391         jboolean ret_conv = ClaimedHTLC_eq(&a_conv, &b_conv);
64392         return ret_conv;
64393 }
64394
64395 int8_tArray  __attribute__((export_name("TS_ClaimedHTLC_write"))) TS_ClaimedHTLC_write(uint64_t obj) {
64396         LDKClaimedHTLC obj_conv;
64397         obj_conv.inner = untag_ptr(obj);
64398         obj_conv.is_owned = ptr_is_owned(obj);
64399         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64400         obj_conv.is_owned = false;
64401         LDKCVec_u8Z ret_var = ClaimedHTLC_write(&obj_conv);
64402         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64403         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64404         CVec_u8Z_free(ret_var);
64405         return ret_arr;
64406 }
64407
64408 uint64_t  __attribute__((export_name("TS_ClaimedHTLC_read"))) TS_ClaimedHTLC_read(int8_tArray ser) {
64409         LDKu8slice ser_ref;
64410         ser_ref.datalen = ser->arr_len;
64411         ser_ref.data = ser->elems;
64412         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
64413         *ret_conv = ClaimedHTLC_read(ser_ref);
64414         FREE(ser);
64415         return tag_ptr(ret_conv, true);
64416 }
64417
64418 void  __attribute__((export_name("TS_PathFailure_free"))) TS_PathFailure_free(uint64_t this_ptr) {
64419         if (!ptr_is_owned(this_ptr)) return;
64420         void* this_ptr_ptr = untag_ptr(this_ptr);
64421         CHECK_ACCESS(this_ptr_ptr);
64422         LDKPathFailure this_ptr_conv = *(LDKPathFailure*)(this_ptr_ptr);
64423         FREE(untag_ptr(this_ptr));
64424         PathFailure_free(this_ptr_conv);
64425 }
64426
64427 static inline uint64_t PathFailure_clone_ptr(LDKPathFailure *NONNULL_PTR arg) {
64428         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
64429         *ret_copy = PathFailure_clone(arg);
64430         uint64_t ret_ref = tag_ptr(ret_copy, true);
64431         return ret_ref;
64432 }
64433 int64_t  __attribute__((export_name("TS_PathFailure_clone_ptr"))) TS_PathFailure_clone_ptr(uint64_t arg) {
64434         LDKPathFailure* arg_conv = (LDKPathFailure*)untag_ptr(arg);
64435         int64_t ret_conv = PathFailure_clone_ptr(arg_conv);
64436         return ret_conv;
64437 }
64438
64439 uint64_t  __attribute__((export_name("TS_PathFailure_clone"))) TS_PathFailure_clone(uint64_t orig) {
64440         LDKPathFailure* orig_conv = (LDKPathFailure*)untag_ptr(orig);
64441         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
64442         *ret_copy = PathFailure_clone(orig_conv);
64443         uint64_t ret_ref = tag_ptr(ret_copy, true);
64444         return ret_ref;
64445 }
64446
64447 uint64_t  __attribute__((export_name("TS_PathFailure_initial_send"))) TS_PathFailure_initial_send(uint64_t err) {
64448         void* err_ptr = untag_ptr(err);
64449         CHECK_ACCESS(err_ptr);
64450         LDKAPIError err_conv = *(LDKAPIError*)(err_ptr);
64451         err_conv = APIError_clone((LDKAPIError*)untag_ptr(err));
64452         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
64453         *ret_copy = PathFailure_initial_send(err_conv);
64454         uint64_t ret_ref = tag_ptr(ret_copy, true);
64455         return ret_ref;
64456 }
64457
64458 uint64_t  __attribute__((export_name("TS_PathFailure_on_path"))) TS_PathFailure_on_path(uint64_t network_update) {
64459         void* network_update_ptr = untag_ptr(network_update);
64460         CHECK_ACCESS(network_update_ptr);
64461         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
64462         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
64463         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
64464         *ret_copy = PathFailure_on_path(network_update_conv);
64465         uint64_t ret_ref = tag_ptr(ret_copy, true);
64466         return ret_ref;
64467 }
64468
64469 jboolean  __attribute__((export_name("TS_PathFailure_eq"))) TS_PathFailure_eq(uint64_t a, uint64_t b) {
64470         LDKPathFailure* a_conv = (LDKPathFailure*)untag_ptr(a);
64471         LDKPathFailure* b_conv = (LDKPathFailure*)untag_ptr(b);
64472         jboolean ret_conv = PathFailure_eq(a_conv, b_conv);
64473         return ret_conv;
64474 }
64475
64476 int8_tArray  __attribute__((export_name("TS_PathFailure_write"))) TS_PathFailure_write(uint64_t obj) {
64477         LDKPathFailure* obj_conv = (LDKPathFailure*)untag_ptr(obj);
64478         LDKCVec_u8Z ret_var = PathFailure_write(obj_conv);
64479         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64480         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64481         CVec_u8Z_free(ret_var);
64482         return ret_arr;
64483 }
64484
64485 uint64_t  __attribute__((export_name("TS_PathFailure_read"))) TS_PathFailure_read(int8_tArray ser) {
64486         LDKu8slice ser_ref;
64487         ser_ref.datalen = ser->arr_len;
64488         ser_ref.data = ser->elems;
64489         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
64490         *ret_conv = PathFailure_read(ser_ref);
64491         FREE(ser);
64492         return tag_ptr(ret_conv, true);
64493 }
64494
64495 void  __attribute__((export_name("TS_ClosureReason_free"))) TS_ClosureReason_free(uint64_t this_ptr) {
64496         if (!ptr_is_owned(this_ptr)) return;
64497         void* this_ptr_ptr = untag_ptr(this_ptr);
64498         CHECK_ACCESS(this_ptr_ptr);
64499         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
64500         FREE(untag_ptr(this_ptr));
64501         ClosureReason_free(this_ptr_conv);
64502 }
64503
64504 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
64505         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64506         *ret_copy = ClosureReason_clone(arg);
64507         uint64_t ret_ref = tag_ptr(ret_copy, true);
64508         return ret_ref;
64509 }
64510 int64_t  __attribute__((export_name("TS_ClosureReason_clone_ptr"))) TS_ClosureReason_clone_ptr(uint64_t arg) {
64511         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
64512         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
64513         return ret_conv;
64514 }
64515
64516 uint64_t  __attribute__((export_name("TS_ClosureReason_clone"))) TS_ClosureReason_clone(uint64_t orig) {
64517         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
64518         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64519         *ret_copy = ClosureReason_clone(orig_conv);
64520         uint64_t ret_ref = tag_ptr(ret_copy, true);
64521         return ret_ref;
64522 }
64523
64524 uint64_t  __attribute__((export_name("TS_ClosureReason_counterparty_force_closed"))) TS_ClosureReason_counterparty_force_closed(uint64_t peer_msg) {
64525         LDKUntrustedString peer_msg_conv;
64526         peer_msg_conv.inner = untag_ptr(peer_msg);
64527         peer_msg_conv.is_owned = ptr_is_owned(peer_msg);
64528         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_conv);
64529         peer_msg_conv = UntrustedString_clone(&peer_msg_conv);
64530         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64531         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
64532         uint64_t ret_ref = tag_ptr(ret_copy, true);
64533         return ret_ref;
64534 }
64535
64536 uint64_t  __attribute__((export_name("TS_ClosureReason_holder_force_closed"))) TS_ClosureReason_holder_force_closed() {
64537         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64538         *ret_copy = ClosureReason_holder_force_closed();
64539         uint64_t ret_ref = tag_ptr(ret_copy, true);
64540         return ret_ref;
64541 }
64542
64543 uint64_t  __attribute__((export_name("TS_ClosureReason_cooperative_closure"))) TS_ClosureReason_cooperative_closure() {
64544         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64545         *ret_copy = ClosureReason_cooperative_closure();
64546         uint64_t ret_ref = tag_ptr(ret_copy, true);
64547         return ret_ref;
64548 }
64549
64550 uint64_t  __attribute__((export_name("TS_ClosureReason_commitment_tx_confirmed"))) TS_ClosureReason_commitment_tx_confirmed() {
64551         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64552         *ret_copy = ClosureReason_commitment_tx_confirmed();
64553         uint64_t ret_ref = tag_ptr(ret_copy, true);
64554         return ret_ref;
64555 }
64556
64557 uint64_t  __attribute__((export_name("TS_ClosureReason_funding_timed_out"))) TS_ClosureReason_funding_timed_out() {
64558         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64559         *ret_copy = ClosureReason_funding_timed_out();
64560         uint64_t ret_ref = tag_ptr(ret_copy, true);
64561         return ret_ref;
64562 }
64563
64564 uint64_t  __attribute__((export_name("TS_ClosureReason_processing_error"))) TS_ClosureReason_processing_error(jstring err) {
64565         LDKStr err_conv = str_ref_to_owned_c(err);
64566         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64567         *ret_copy = ClosureReason_processing_error(err_conv);
64568         uint64_t ret_ref = tag_ptr(ret_copy, true);
64569         return ret_ref;
64570 }
64571
64572 uint64_t  __attribute__((export_name("TS_ClosureReason_disconnected_peer"))) TS_ClosureReason_disconnected_peer() {
64573         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64574         *ret_copy = ClosureReason_disconnected_peer();
64575         uint64_t ret_ref = tag_ptr(ret_copy, true);
64576         return ret_ref;
64577 }
64578
64579 uint64_t  __attribute__((export_name("TS_ClosureReason_outdated_channel_manager"))) TS_ClosureReason_outdated_channel_manager() {
64580         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64581         *ret_copy = ClosureReason_outdated_channel_manager();
64582         uint64_t ret_ref = tag_ptr(ret_copy, true);
64583         return ret_ref;
64584 }
64585
64586 uint64_t  __attribute__((export_name("TS_ClosureReason_counterparty_coop_closed_unfunded_channel"))) TS_ClosureReason_counterparty_coop_closed_unfunded_channel() {
64587         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64588         *ret_copy = ClosureReason_counterparty_coop_closed_unfunded_channel();
64589         uint64_t ret_ref = tag_ptr(ret_copy, true);
64590         return ret_ref;
64591 }
64592
64593 uint64_t  __attribute__((export_name("TS_ClosureReason_funding_batch_closure"))) TS_ClosureReason_funding_batch_closure() {
64594         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64595         *ret_copy = ClosureReason_funding_batch_closure();
64596         uint64_t ret_ref = tag_ptr(ret_copy, true);
64597         return ret_ref;
64598 }
64599
64600 jboolean  __attribute__((export_name("TS_ClosureReason_eq"))) TS_ClosureReason_eq(uint64_t a, uint64_t b) {
64601         LDKClosureReason* a_conv = (LDKClosureReason*)untag_ptr(a);
64602         LDKClosureReason* b_conv = (LDKClosureReason*)untag_ptr(b);
64603         jboolean ret_conv = ClosureReason_eq(a_conv, b_conv);
64604         return ret_conv;
64605 }
64606
64607 int8_tArray  __attribute__((export_name("TS_ClosureReason_write"))) TS_ClosureReason_write(uint64_t obj) {
64608         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
64609         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
64610         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64611         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64612         CVec_u8Z_free(ret_var);
64613         return ret_arr;
64614 }
64615
64616 uint64_t  __attribute__((export_name("TS_ClosureReason_read"))) TS_ClosureReason_read(int8_tArray ser) {
64617         LDKu8slice ser_ref;
64618         ser_ref.datalen = ser->arr_len;
64619         ser_ref.data = ser->elems;
64620         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
64621         *ret_conv = ClosureReason_read(ser_ref);
64622         FREE(ser);
64623         return tag_ptr(ret_conv, true);
64624 }
64625
64626 void  __attribute__((export_name("TS_HTLCDestination_free"))) TS_HTLCDestination_free(uint64_t this_ptr) {
64627         if (!ptr_is_owned(this_ptr)) return;
64628         void* this_ptr_ptr = untag_ptr(this_ptr);
64629         CHECK_ACCESS(this_ptr_ptr);
64630         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
64631         FREE(untag_ptr(this_ptr));
64632         HTLCDestination_free(this_ptr_conv);
64633 }
64634
64635 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
64636         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
64637         *ret_copy = HTLCDestination_clone(arg);
64638         uint64_t ret_ref = tag_ptr(ret_copy, true);
64639         return ret_ref;
64640 }
64641 int64_t  __attribute__((export_name("TS_HTLCDestination_clone_ptr"))) TS_HTLCDestination_clone_ptr(uint64_t arg) {
64642         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
64643         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
64644         return ret_conv;
64645 }
64646
64647 uint64_t  __attribute__((export_name("TS_HTLCDestination_clone"))) TS_HTLCDestination_clone(uint64_t orig) {
64648         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
64649         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
64650         *ret_copy = HTLCDestination_clone(orig_conv);
64651         uint64_t ret_ref = tag_ptr(ret_copy, true);
64652         return ret_ref;
64653 }
64654
64655 uint64_t  __attribute__((export_name("TS_HTLCDestination_next_hop_channel"))) TS_HTLCDestination_next_hop_channel(int8_tArray node_id, int8_tArray channel_id) {
64656         LDKPublicKey node_id_ref;
64657         CHECK(node_id->arr_len == 33);
64658         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
64659         LDKThirtyTwoBytes channel_id_ref;
64660         CHECK(channel_id->arr_len == 32);
64661         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
64662         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
64663         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
64664         uint64_t ret_ref = tag_ptr(ret_copy, true);
64665         return ret_ref;
64666 }
64667
64668 uint64_t  __attribute__((export_name("TS_HTLCDestination_unknown_next_hop"))) TS_HTLCDestination_unknown_next_hop(int64_t requested_forward_scid) {
64669         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
64670         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
64671         uint64_t ret_ref = tag_ptr(ret_copy, true);
64672         return ret_ref;
64673 }
64674
64675 uint64_t  __attribute__((export_name("TS_HTLCDestination_invalid_forward"))) TS_HTLCDestination_invalid_forward(int64_t requested_forward_scid) {
64676         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
64677         *ret_copy = HTLCDestination_invalid_forward(requested_forward_scid);
64678         uint64_t ret_ref = tag_ptr(ret_copy, true);
64679         return ret_ref;
64680 }
64681
64682 uint64_t  __attribute__((export_name("TS_HTLCDestination_failed_payment"))) TS_HTLCDestination_failed_payment(int8_tArray payment_hash) {
64683         LDKThirtyTwoBytes payment_hash_ref;
64684         CHECK(payment_hash->arr_len == 32);
64685         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
64686         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
64687         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
64688         uint64_t ret_ref = tag_ptr(ret_copy, true);
64689         return ret_ref;
64690 }
64691
64692 jboolean  __attribute__((export_name("TS_HTLCDestination_eq"))) TS_HTLCDestination_eq(uint64_t a, uint64_t b) {
64693         LDKHTLCDestination* a_conv = (LDKHTLCDestination*)untag_ptr(a);
64694         LDKHTLCDestination* b_conv = (LDKHTLCDestination*)untag_ptr(b);
64695         jboolean ret_conv = HTLCDestination_eq(a_conv, b_conv);
64696         return ret_conv;
64697 }
64698
64699 int8_tArray  __attribute__((export_name("TS_HTLCDestination_write"))) TS_HTLCDestination_write(uint64_t obj) {
64700         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
64701         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
64702         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64703         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64704         CVec_u8Z_free(ret_var);
64705         return ret_arr;
64706 }
64707
64708 uint64_t  __attribute__((export_name("TS_HTLCDestination_read"))) TS_HTLCDestination_read(int8_tArray ser) {
64709         LDKu8slice ser_ref;
64710         ser_ref.datalen = ser->arr_len;
64711         ser_ref.data = ser->elems;
64712         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
64713         *ret_conv = HTLCDestination_read(ser_ref);
64714         FREE(ser);
64715         return tag_ptr(ret_conv, true);
64716 }
64717
64718 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_clone"))) TS_PaymentFailureReason_clone(uint64_t orig) {
64719         LDKPaymentFailureReason* orig_conv = (LDKPaymentFailureReason*)untag_ptr(orig);
64720         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_clone(orig_conv));
64721         return ret_conv;
64722 }
64723
64724 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_recipient_rejected"))) TS_PaymentFailureReason_recipient_rejected() {
64725         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_recipient_rejected());
64726         return ret_conv;
64727 }
64728
64729 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_user_abandoned"))) TS_PaymentFailureReason_user_abandoned() {
64730         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_user_abandoned());
64731         return ret_conv;
64732 }
64733
64734 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_retries_exhausted"))) TS_PaymentFailureReason_retries_exhausted() {
64735         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_retries_exhausted());
64736         return ret_conv;
64737 }
64738
64739 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_payment_expired"))) TS_PaymentFailureReason_payment_expired() {
64740         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_payment_expired());
64741         return ret_conv;
64742 }
64743
64744 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_route_not_found"))) TS_PaymentFailureReason_route_not_found() {
64745         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_route_not_found());
64746         return ret_conv;
64747 }
64748
64749 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_unexpected_error"))) TS_PaymentFailureReason_unexpected_error() {
64750         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_unexpected_error());
64751         return ret_conv;
64752 }
64753
64754 jboolean  __attribute__((export_name("TS_PaymentFailureReason_eq"))) TS_PaymentFailureReason_eq(uint64_t a, uint64_t b) {
64755         LDKPaymentFailureReason* a_conv = (LDKPaymentFailureReason*)untag_ptr(a);
64756         LDKPaymentFailureReason* b_conv = (LDKPaymentFailureReason*)untag_ptr(b);
64757         jboolean ret_conv = PaymentFailureReason_eq(a_conv, b_conv);
64758         return ret_conv;
64759 }
64760
64761 int8_tArray  __attribute__((export_name("TS_PaymentFailureReason_write"))) TS_PaymentFailureReason_write(uint64_t obj) {
64762         LDKPaymentFailureReason* obj_conv = (LDKPaymentFailureReason*)untag_ptr(obj);
64763         LDKCVec_u8Z ret_var = PaymentFailureReason_write(obj_conv);
64764         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64765         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64766         CVec_u8Z_free(ret_var);
64767         return ret_arr;
64768 }
64769
64770 uint64_t  __attribute__((export_name("TS_PaymentFailureReason_read"))) TS_PaymentFailureReason_read(int8_tArray ser) {
64771         LDKu8slice ser_ref;
64772         ser_ref.datalen = ser->arr_len;
64773         ser_ref.data = ser->elems;
64774         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
64775         *ret_conv = PaymentFailureReason_read(ser_ref);
64776         FREE(ser);
64777         return tag_ptr(ret_conv, true);
64778 }
64779
64780 void  __attribute__((export_name("TS_Event_free"))) TS_Event_free(uint64_t this_ptr) {
64781         if (!ptr_is_owned(this_ptr)) return;
64782         void* this_ptr_ptr = untag_ptr(this_ptr);
64783         CHECK_ACCESS(this_ptr_ptr);
64784         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
64785         FREE(untag_ptr(this_ptr));
64786         Event_free(this_ptr_conv);
64787 }
64788
64789 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
64790         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64791         *ret_copy = Event_clone(arg);
64792         uint64_t ret_ref = tag_ptr(ret_copy, true);
64793         return ret_ref;
64794 }
64795 int64_t  __attribute__((export_name("TS_Event_clone_ptr"))) TS_Event_clone_ptr(uint64_t arg) {
64796         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
64797         int64_t ret_conv = Event_clone_ptr(arg_conv);
64798         return ret_conv;
64799 }
64800
64801 uint64_t  __attribute__((export_name("TS_Event_clone"))) TS_Event_clone(uint64_t orig) {
64802         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
64803         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64804         *ret_copy = Event_clone(orig_conv);
64805         uint64_t ret_ref = tag_ptr(ret_copy, true);
64806         return ret_ref;
64807 }
64808
64809 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) {
64810         LDKThirtyTwoBytes temporary_channel_id_ref;
64811         CHECK(temporary_channel_id->arr_len == 32);
64812         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
64813         LDKPublicKey counterparty_node_id_ref;
64814         CHECK(counterparty_node_id->arr_len == 33);
64815         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
64816         LDKCVec_u8Z output_script_ref;
64817         output_script_ref.datalen = output_script->arr_len;
64818         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
64819         memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen); FREE(output_script);
64820         LDKU128 user_channel_id_ref;
64821         CHECK(user_channel_id->arr_len == 16);
64822         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
64823         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64824         *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id_ref);
64825         uint64_t ret_ref = tag_ptr(ret_copy, true);
64826         return ret_ref;
64827 }
64828
64829 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) {
64830         LDKPublicKey receiver_node_id_ref;
64831         CHECK(receiver_node_id->arr_len == 33);
64832         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
64833         LDKThirtyTwoBytes payment_hash_ref;
64834         CHECK(payment_hash->arr_len == 32);
64835         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
64836         LDKRecipientOnionFields onion_fields_conv;
64837         onion_fields_conv.inner = untag_ptr(onion_fields);
64838         onion_fields_conv.is_owned = ptr_is_owned(onion_fields);
64839         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_conv);
64840         onion_fields_conv = RecipientOnionFields_clone(&onion_fields_conv);
64841         void* purpose_ptr = untag_ptr(purpose);
64842         CHECK_ACCESS(purpose_ptr);
64843         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
64844         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
64845         void* via_channel_id_ptr = untag_ptr(via_channel_id);
64846         CHECK_ACCESS(via_channel_id_ptr);
64847         LDKCOption_ThirtyTwoBytesZ via_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(via_channel_id_ptr);
64848         via_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(via_channel_id));
64849         void* via_user_channel_id_ptr = untag_ptr(via_user_channel_id);
64850         CHECK_ACCESS(via_user_channel_id_ptr);
64851         LDKCOption_U128Z via_user_channel_id_conv = *(LDKCOption_U128Z*)(via_user_channel_id_ptr);
64852         via_user_channel_id_conv = COption_U128Z_clone((LDKCOption_U128Z*)untag_ptr(via_user_channel_id));
64853         void* claim_deadline_ptr = untag_ptr(claim_deadline);
64854         CHECK_ACCESS(claim_deadline_ptr);
64855         LDKCOption_u32Z claim_deadline_conv = *(LDKCOption_u32Z*)(claim_deadline_ptr);
64856         claim_deadline_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(claim_deadline));
64857         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64858         *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);
64859         uint64_t ret_ref = tag_ptr(ret_copy, true);
64860         return ret_ref;
64861 }
64862
64863 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) {
64864         LDKPublicKey receiver_node_id_ref;
64865         CHECK(receiver_node_id->arr_len == 33);
64866         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
64867         LDKThirtyTwoBytes payment_hash_ref;
64868         CHECK(payment_hash->arr_len == 32);
64869         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
64870         void* purpose_ptr = untag_ptr(purpose);
64871         CHECK_ACCESS(purpose_ptr);
64872         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
64873         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
64874         LDKCVec_ClaimedHTLCZ htlcs_constr;
64875         htlcs_constr.datalen = htlcs->arr_len;
64876         if (htlcs_constr.datalen > 0)
64877                 htlcs_constr.data = MALLOC(htlcs_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
64878         else
64879                 htlcs_constr.data = NULL;
64880         uint64_t* htlcs_vals = htlcs->elems;
64881         for (size_t n = 0; n < htlcs_constr.datalen; n++) {
64882                 uint64_t htlcs_conv_13 = htlcs_vals[n];
64883                 LDKClaimedHTLC htlcs_conv_13_conv;
64884                 htlcs_conv_13_conv.inner = untag_ptr(htlcs_conv_13);
64885                 htlcs_conv_13_conv.is_owned = ptr_is_owned(htlcs_conv_13);
64886                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_conv);
64887                 htlcs_conv_13_conv = ClaimedHTLC_clone(&htlcs_conv_13_conv);
64888                 htlcs_constr.data[n] = htlcs_conv_13_conv;
64889         }
64890         FREE(htlcs);
64891         void* sender_intended_total_msat_ptr = untag_ptr(sender_intended_total_msat);
64892         CHECK_ACCESS(sender_intended_total_msat_ptr);
64893         LDKCOption_u64Z sender_intended_total_msat_conv = *(LDKCOption_u64Z*)(sender_intended_total_msat_ptr);
64894         sender_intended_total_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(sender_intended_total_msat));
64895         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64896         *ret_copy = Event_payment_claimed(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv, htlcs_constr, sender_intended_total_msat_conv);
64897         uint64_t ret_ref = tag_ptr(ret_copy, true);
64898         return ret_ref;
64899 }
64900
64901 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) {
64902         void* payment_id_ptr = untag_ptr(payment_id);
64903         CHECK_ACCESS(payment_id_ptr);
64904         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
64905         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
64906         LDKThirtyTwoBytes payment_preimage_ref;
64907         CHECK(payment_preimage->arr_len == 32);
64908         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
64909         LDKThirtyTwoBytes payment_hash_ref;
64910         CHECK(payment_hash->arr_len == 32);
64911         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
64912         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
64913         CHECK_ACCESS(fee_paid_msat_ptr);
64914         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
64915         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
64916         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64917         *ret_copy = Event_payment_sent(payment_id_conv, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
64918         uint64_t ret_ref = tag_ptr(ret_copy, true);
64919         return ret_ref;
64920 }
64921
64922 uint64_t  __attribute__((export_name("TS_Event_payment_failed"))) TS_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash, uint64_t reason) {
64923         LDKThirtyTwoBytes payment_id_ref;
64924         CHECK(payment_id->arr_len == 32);
64925         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
64926         LDKThirtyTwoBytes payment_hash_ref;
64927         CHECK(payment_hash->arr_len == 32);
64928         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
64929         void* reason_ptr = untag_ptr(reason);
64930         CHECK_ACCESS(reason_ptr);
64931         LDKCOption_PaymentFailureReasonZ reason_conv = *(LDKCOption_PaymentFailureReasonZ*)(reason_ptr);
64932         reason_conv = COption_PaymentFailureReasonZ_clone((LDKCOption_PaymentFailureReasonZ*)untag_ptr(reason));
64933         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64934         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref, reason_conv);
64935         uint64_t ret_ref = tag_ptr(ret_copy, true);
64936         return ret_ref;
64937 }
64938
64939 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) {
64940         LDKThirtyTwoBytes payment_id_ref;
64941         CHECK(payment_id->arr_len == 32);
64942         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
64943         void* payment_hash_ptr = untag_ptr(payment_hash);
64944         CHECK_ACCESS(payment_hash_ptr);
64945         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
64946         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
64947         LDKPath path_conv;
64948         path_conv.inner = untag_ptr(path);
64949         path_conv.is_owned = ptr_is_owned(path);
64950         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
64951         path_conv = Path_clone(&path_conv);
64952         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64953         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_conv, path_conv);
64954         uint64_t ret_ref = tag_ptr(ret_copy, true);
64955         return ret_ref;
64956 }
64957
64958 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) {
64959         void* payment_id_ptr = untag_ptr(payment_id);
64960         CHECK_ACCESS(payment_id_ptr);
64961         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
64962         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
64963         LDKThirtyTwoBytes payment_hash_ref;
64964         CHECK(payment_hash->arr_len == 32);
64965         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
64966         void* failure_ptr = untag_ptr(failure);
64967         CHECK_ACCESS(failure_ptr);
64968         LDKPathFailure failure_conv = *(LDKPathFailure*)(failure_ptr);
64969         failure_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(failure));
64970         LDKPath path_conv;
64971         path_conv.inner = untag_ptr(path);
64972         path_conv.is_owned = ptr_is_owned(path);
64973         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
64974         path_conv = Path_clone(&path_conv);
64975         void* short_channel_id_ptr = untag_ptr(short_channel_id);
64976         CHECK_ACCESS(short_channel_id_ptr);
64977         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
64978         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
64979         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64980         *ret_copy = Event_payment_path_failed(payment_id_conv, payment_hash_ref, payment_failed_permanently, failure_conv, path_conv, short_channel_id_conv);
64981         uint64_t ret_ref = tag_ptr(ret_copy, true);
64982         return ret_ref;
64983 }
64984
64985 uint64_t  __attribute__((export_name("TS_Event_probe_successful"))) TS_Event_probe_successful(int8_tArray payment_id, int8_tArray payment_hash, uint64_t path) {
64986         LDKThirtyTwoBytes payment_id_ref;
64987         CHECK(payment_id->arr_len == 32);
64988         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
64989         LDKThirtyTwoBytes payment_hash_ref;
64990         CHECK(payment_hash->arr_len == 32);
64991         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
64992         LDKPath path_conv;
64993         path_conv.inner = untag_ptr(path);
64994         path_conv.is_owned = ptr_is_owned(path);
64995         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
64996         path_conv = Path_clone(&path_conv);
64997         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64998         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_conv);
64999         uint64_t ret_ref = tag_ptr(ret_copy, true);
65000         return ret_ref;
65001 }
65002
65003 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) {
65004         LDKThirtyTwoBytes payment_id_ref;
65005         CHECK(payment_id->arr_len == 32);
65006         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
65007         LDKThirtyTwoBytes payment_hash_ref;
65008         CHECK(payment_hash->arr_len == 32);
65009         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
65010         LDKPath path_conv;
65011         path_conv.inner = untag_ptr(path);
65012         path_conv.is_owned = ptr_is_owned(path);
65013         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
65014         path_conv = Path_clone(&path_conv);
65015         void* short_channel_id_ptr = untag_ptr(short_channel_id);
65016         CHECK_ACCESS(short_channel_id_ptr);
65017         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
65018         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
65019         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
65020         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_conv, short_channel_id_conv);
65021         uint64_t ret_ref = tag_ptr(ret_copy, true);
65022         return ret_ref;
65023 }
65024
65025 uint64_t  __attribute__((export_name("TS_Event_pending_htlcs_forwardable"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
65026         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
65027         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
65028         uint64_t ret_ref = tag_ptr(ret_copy, true);
65029         return ret_ref;
65030 }
65031
65032 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) {
65033         LDKThirtyTwoBytes intercept_id_ref;
65034         CHECK(intercept_id->arr_len == 32);
65035         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
65036         LDKThirtyTwoBytes payment_hash_ref;
65037         CHECK(payment_hash->arr_len == 32);
65038         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
65039         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
65040         *ret_copy = Event_htlcintercepted(intercept_id_ref, requested_next_hop_scid, payment_hash_ref, inbound_amount_msat, expected_outbound_amount_msat);
65041         uint64_t ret_ref = tag_ptr(ret_copy, true);
65042         return ret_ref;
65043 }
65044
65045 uint64_t  __attribute__((export_name("TS_Event_spendable_outputs"))) TS_Event_spendable_outputs(uint64_tArray outputs, uint64_t channel_id) {
65046         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
65047         outputs_constr.datalen = outputs->arr_len;
65048         if (outputs_constr.datalen > 0)
65049                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
65050         else
65051                 outputs_constr.data = NULL;
65052         uint64_t* outputs_vals = outputs->elems;
65053         for (size_t b = 0; b < outputs_constr.datalen; b++) {
65054                 uint64_t outputs_conv_27 = outputs_vals[b];
65055                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
65056                 CHECK_ACCESS(outputs_conv_27_ptr);
65057                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
65058                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
65059                 outputs_constr.data[b] = outputs_conv_27_conv;
65060         }
65061         FREE(outputs);
65062         void* channel_id_ptr = untag_ptr(channel_id);
65063         CHECK_ACCESS(channel_id_ptr);
65064         LDKCOption_ThirtyTwoBytesZ channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(channel_id_ptr);
65065         channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(channel_id));
65066         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
65067         *ret_copy = Event_spendable_outputs(outputs_constr, channel_id_conv);
65068         uint64_t ret_ref = tag_ptr(ret_copy, true);
65069         return ret_ref;
65070 }
65071
65072 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) {
65073         void* prev_channel_id_ptr = untag_ptr(prev_channel_id);
65074         CHECK_ACCESS(prev_channel_id_ptr);
65075         LDKCOption_ThirtyTwoBytesZ prev_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(prev_channel_id_ptr);
65076         prev_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(prev_channel_id));
65077         void* next_channel_id_ptr = untag_ptr(next_channel_id);
65078         CHECK_ACCESS(next_channel_id_ptr);
65079         LDKCOption_ThirtyTwoBytesZ next_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(next_channel_id_ptr);
65080         next_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(next_channel_id));
65081         void* fee_earned_msat_ptr = untag_ptr(fee_earned_msat);
65082         CHECK_ACCESS(fee_earned_msat_ptr);
65083         LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
65084         fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_earned_msat));
65085         void* outbound_amount_forwarded_msat_ptr = untag_ptr(outbound_amount_forwarded_msat);
65086         CHECK_ACCESS(outbound_amount_forwarded_msat_ptr);
65087         LDKCOption_u64Z outbound_amount_forwarded_msat_conv = *(LDKCOption_u64Z*)(outbound_amount_forwarded_msat_ptr);
65088         outbound_amount_forwarded_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_amount_forwarded_msat));
65089         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
65090         *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);
65091         uint64_t ret_ref = tag_ptr(ret_copy, true);
65092         return ret_ref;
65093 }
65094
65095 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) {
65096         LDKThirtyTwoBytes channel_id_ref;
65097         CHECK(channel_id->arr_len == 32);
65098         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
65099         LDKU128 user_channel_id_ref;
65100         CHECK(user_channel_id->arr_len == 16);
65101         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
65102         void* former_temporary_channel_id_ptr = untag_ptr(former_temporary_channel_id);
65103         CHECK_ACCESS(former_temporary_channel_id_ptr);
65104         LDKCOption_ThirtyTwoBytesZ former_temporary_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(former_temporary_channel_id_ptr);
65105         former_temporary_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(former_temporary_channel_id));
65106         LDKPublicKey counterparty_node_id_ref;
65107         CHECK(counterparty_node_id->arr_len == 33);
65108         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
65109         LDKOutPoint funding_txo_conv;
65110         funding_txo_conv.inner = untag_ptr(funding_txo);
65111         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
65112         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
65113         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
65114         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
65115         *ret_copy = Event_channel_pending(channel_id_ref, user_channel_id_ref, former_temporary_channel_id_conv, counterparty_node_id_ref, funding_txo_conv);
65116         uint64_t ret_ref = tag_ptr(ret_copy, true);
65117         return ret_ref;
65118 }
65119
65120 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) {
65121         LDKThirtyTwoBytes channel_id_ref;
65122         CHECK(channel_id->arr_len == 32);
65123         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
65124         LDKU128 user_channel_id_ref;
65125         CHECK(user_channel_id->arr_len == 16);
65126         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
65127         LDKPublicKey counterparty_node_id_ref;
65128         CHECK(counterparty_node_id->arr_len == 33);
65129         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
65130         LDKChannelTypeFeatures channel_type_conv;
65131         channel_type_conv.inner = untag_ptr(channel_type);
65132         channel_type_conv.is_owned = ptr_is_owned(channel_type);
65133         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
65134         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
65135         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
65136         *ret_copy = Event_channel_ready(channel_id_ref, user_channel_id_ref, counterparty_node_id_ref, channel_type_conv);
65137         uint64_t ret_ref = tag_ptr(ret_copy, true);
65138         return ret_ref;
65139 }
65140
65141 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) {
65142         LDKThirtyTwoBytes channel_id_ref;
65143         CHECK(channel_id->arr_len == 32);
65144         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
65145         LDKU128 user_channel_id_ref;
65146         CHECK(user_channel_id->arr_len == 16);
65147         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
65148         void* reason_ptr = untag_ptr(reason);
65149         CHECK_ACCESS(reason_ptr);
65150         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
65151         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
65152         LDKPublicKey counterparty_node_id_ref;
65153         CHECK(counterparty_node_id->arr_len == 33);
65154         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
65155         void* channel_capacity_sats_ptr = untag_ptr(channel_capacity_sats);
65156         CHECK_ACCESS(channel_capacity_sats_ptr);
65157         LDKCOption_u64Z channel_capacity_sats_conv = *(LDKCOption_u64Z*)(channel_capacity_sats_ptr);
65158         channel_capacity_sats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(channel_capacity_sats));
65159         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
65160         *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id_ref, reason_conv, counterparty_node_id_ref, channel_capacity_sats_conv);
65161         uint64_t ret_ref = tag_ptr(ret_copy, true);
65162         return ret_ref;
65163 }
65164
65165 uint64_t  __attribute__((export_name("TS_Event_discard_funding"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
65166         LDKThirtyTwoBytes channel_id_ref;
65167         CHECK(channel_id->arr_len == 32);
65168         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
65169         LDKTransaction transaction_ref;
65170         transaction_ref.datalen = transaction->arr_len;
65171         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
65172         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
65173         transaction_ref.data_is_owned = true;
65174         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
65175         *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
65176         uint64_t ret_ref = tag_ptr(ret_copy, true);
65177         return ret_ref;
65178 }
65179
65180 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) {
65181         LDKThirtyTwoBytes temporary_channel_id_ref;
65182         CHECK(temporary_channel_id->arr_len == 32);
65183         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
65184         LDKPublicKey counterparty_node_id_ref;
65185         CHECK(counterparty_node_id->arr_len == 33);
65186         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
65187         LDKChannelTypeFeatures channel_type_conv;
65188         channel_type_conv.inner = untag_ptr(channel_type);
65189         channel_type_conv.is_owned = ptr_is_owned(channel_type);
65190         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
65191         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
65192         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
65193         *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
65194         uint64_t ret_ref = tag_ptr(ret_copy, true);
65195         return ret_ref;
65196 }
65197
65198 uint64_t  __attribute__((export_name("TS_Event_htlchandling_failed"))) TS_Event_htlchandling_failed(int8_tArray prev_channel_id, uint64_t failed_next_destination) {
65199         LDKThirtyTwoBytes prev_channel_id_ref;
65200         CHECK(prev_channel_id->arr_len == 32);
65201         memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
65202         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
65203         CHECK_ACCESS(failed_next_destination_ptr);
65204         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
65205         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
65206         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
65207         *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
65208         uint64_t ret_ref = tag_ptr(ret_copy, true);
65209         return ret_ref;
65210 }
65211
65212 uint64_t  __attribute__((export_name("TS_Event_bump_transaction"))) TS_Event_bump_transaction(uint64_t a) {
65213         void* a_ptr = untag_ptr(a);
65214         CHECK_ACCESS(a_ptr);
65215         LDKBumpTransactionEvent a_conv = *(LDKBumpTransactionEvent*)(a_ptr);
65216         a_conv = BumpTransactionEvent_clone((LDKBumpTransactionEvent*)untag_ptr(a));
65217         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
65218         *ret_copy = Event_bump_transaction(a_conv);
65219         uint64_t ret_ref = tag_ptr(ret_copy, true);
65220         return ret_ref;
65221 }
65222
65223 jboolean  __attribute__((export_name("TS_Event_eq"))) TS_Event_eq(uint64_t a, uint64_t b) {
65224         LDKEvent* a_conv = (LDKEvent*)untag_ptr(a);
65225         LDKEvent* b_conv = (LDKEvent*)untag_ptr(b);
65226         jboolean ret_conv = Event_eq(a_conv, b_conv);
65227         return ret_conv;
65228 }
65229
65230 int8_tArray  __attribute__((export_name("TS_Event_write"))) TS_Event_write(uint64_t obj) {
65231         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
65232         LDKCVec_u8Z ret_var = Event_write(obj_conv);
65233         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65234         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65235         CVec_u8Z_free(ret_var);
65236         return ret_arr;
65237 }
65238
65239 uint64_t  __attribute__((export_name("TS_Event_read"))) TS_Event_read(int8_tArray ser) {
65240         LDKu8slice ser_ref;
65241         ser_ref.datalen = ser->arr_len;
65242         ser_ref.data = ser->elems;
65243         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
65244         *ret_conv = Event_read(ser_ref);
65245         FREE(ser);
65246         return tag_ptr(ret_conv, true);
65247 }
65248
65249 void  __attribute__((export_name("TS_MessageSendEvent_free"))) TS_MessageSendEvent_free(uint64_t this_ptr) {
65250         if (!ptr_is_owned(this_ptr)) return;
65251         void* this_ptr_ptr = untag_ptr(this_ptr);
65252         CHECK_ACCESS(this_ptr_ptr);
65253         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
65254         FREE(untag_ptr(this_ptr));
65255         MessageSendEvent_free(this_ptr_conv);
65256 }
65257
65258 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
65259         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65260         *ret_copy = MessageSendEvent_clone(arg);
65261         uint64_t ret_ref = tag_ptr(ret_copy, true);
65262         return ret_ref;
65263 }
65264 int64_t  __attribute__((export_name("TS_MessageSendEvent_clone_ptr"))) TS_MessageSendEvent_clone_ptr(uint64_t arg) {
65265         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
65266         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
65267         return ret_conv;
65268 }
65269
65270 uint64_t  __attribute__((export_name("TS_MessageSendEvent_clone"))) TS_MessageSendEvent_clone(uint64_t orig) {
65271         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
65272         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65273         *ret_copy = MessageSendEvent_clone(orig_conv);
65274         uint64_t ret_ref = tag_ptr(ret_copy, true);
65275         return ret_ref;
65276 }
65277
65278 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_accept_channel"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint64_t msg) {
65279         LDKPublicKey node_id_ref;
65280         CHECK(node_id->arr_len == 33);
65281         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65282         LDKAcceptChannel msg_conv;
65283         msg_conv.inner = untag_ptr(msg);
65284         msg_conv.is_owned = ptr_is_owned(msg);
65285         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65286         msg_conv = AcceptChannel_clone(&msg_conv);
65287         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65288         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
65289         uint64_t ret_ref = tag_ptr(ret_copy, true);
65290         return ret_ref;
65291 }
65292
65293 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_accept_channel_v2"))) TS_MessageSendEvent_send_accept_channel_v2(int8_tArray node_id, uint64_t msg) {
65294         LDKPublicKey node_id_ref;
65295         CHECK(node_id->arr_len == 33);
65296         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65297         LDKAcceptChannelV2 msg_conv;
65298         msg_conv.inner = untag_ptr(msg);
65299         msg_conv.is_owned = ptr_is_owned(msg);
65300         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65301         msg_conv = AcceptChannelV2_clone(&msg_conv);
65302         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65303         *ret_copy = MessageSendEvent_send_accept_channel_v2(node_id_ref, msg_conv);
65304         uint64_t ret_ref = tag_ptr(ret_copy, true);
65305         return ret_ref;
65306 }
65307
65308 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_open_channel"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint64_t msg) {
65309         LDKPublicKey node_id_ref;
65310         CHECK(node_id->arr_len == 33);
65311         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65312         LDKOpenChannel msg_conv;
65313         msg_conv.inner = untag_ptr(msg);
65314         msg_conv.is_owned = ptr_is_owned(msg);
65315         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65316         msg_conv = OpenChannel_clone(&msg_conv);
65317         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65318         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
65319         uint64_t ret_ref = tag_ptr(ret_copy, true);
65320         return ret_ref;
65321 }
65322
65323 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_open_channel_v2"))) TS_MessageSendEvent_send_open_channel_v2(int8_tArray node_id, uint64_t msg) {
65324         LDKPublicKey node_id_ref;
65325         CHECK(node_id->arr_len == 33);
65326         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65327         LDKOpenChannelV2 msg_conv;
65328         msg_conv.inner = untag_ptr(msg);
65329         msg_conv.is_owned = ptr_is_owned(msg);
65330         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65331         msg_conv = OpenChannelV2_clone(&msg_conv);
65332         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65333         *ret_copy = MessageSendEvent_send_open_channel_v2(node_id_ref, msg_conv);
65334         uint64_t ret_ref = tag_ptr(ret_copy, true);
65335         return ret_ref;
65336 }
65337
65338 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_created"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint64_t msg) {
65339         LDKPublicKey node_id_ref;
65340         CHECK(node_id->arr_len == 33);
65341         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65342         LDKFundingCreated msg_conv;
65343         msg_conv.inner = untag_ptr(msg);
65344         msg_conv.is_owned = ptr_is_owned(msg);
65345         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65346         msg_conv = FundingCreated_clone(&msg_conv);
65347         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65348         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
65349         uint64_t ret_ref = tag_ptr(ret_copy, true);
65350         return ret_ref;
65351 }
65352
65353 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_signed"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint64_t msg) {
65354         LDKPublicKey node_id_ref;
65355         CHECK(node_id->arr_len == 33);
65356         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65357         LDKFundingSigned msg_conv;
65358         msg_conv.inner = untag_ptr(msg);
65359         msg_conv.is_owned = ptr_is_owned(msg);
65360         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65361         msg_conv = FundingSigned_clone(&msg_conv);
65362         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65363         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
65364         uint64_t ret_ref = tag_ptr(ret_copy, true);
65365         return ret_ref;
65366 }
65367
65368 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_add_input"))) TS_MessageSendEvent_send_tx_add_input(int8_tArray node_id, uint64_t msg) {
65369         LDKPublicKey node_id_ref;
65370         CHECK(node_id->arr_len == 33);
65371         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65372         LDKTxAddInput msg_conv;
65373         msg_conv.inner = untag_ptr(msg);
65374         msg_conv.is_owned = ptr_is_owned(msg);
65375         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65376         msg_conv = TxAddInput_clone(&msg_conv);
65377         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65378         *ret_copy = MessageSendEvent_send_tx_add_input(node_id_ref, msg_conv);
65379         uint64_t ret_ref = tag_ptr(ret_copy, true);
65380         return ret_ref;
65381 }
65382
65383 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_add_output"))) TS_MessageSendEvent_send_tx_add_output(int8_tArray node_id, uint64_t msg) {
65384         LDKPublicKey node_id_ref;
65385         CHECK(node_id->arr_len == 33);
65386         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65387         LDKTxAddOutput msg_conv;
65388         msg_conv.inner = untag_ptr(msg);
65389         msg_conv.is_owned = ptr_is_owned(msg);
65390         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65391         msg_conv = TxAddOutput_clone(&msg_conv);
65392         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65393         *ret_copy = MessageSendEvent_send_tx_add_output(node_id_ref, msg_conv);
65394         uint64_t ret_ref = tag_ptr(ret_copy, true);
65395         return ret_ref;
65396 }
65397
65398 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_remove_input"))) TS_MessageSendEvent_send_tx_remove_input(int8_tArray node_id, uint64_t msg) {
65399         LDKPublicKey node_id_ref;
65400         CHECK(node_id->arr_len == 33);
65401         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65402         LDKTxRemoveInput msg_conv;
65403         msg_conv.inner = untag_ptr(msg);
65404         msg_conv.is_owned = ptr_is_owned(msg);
65405         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65406         msg_conv = TxRemoveInput_clone(&msg_conv);
65407         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65408         *ret_copy = MessageSendEvent_send_tx_remove_input(node_id_ref, msg_conv);
65409         uint64_t ret_ref = tag_ptr(ret_copy, true);
65410         return ret_ref;
65411 }
65412
65413 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_remove_output"))) TS_MessageSendEvent_send_tx_remove_output(int8_tArray node_id, uint64_t msg) {
65414         LDKPublicKey node_id_ref;
65415         CHECK(node_id->arr_len == 33);
65416         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65417         LDKTxRemoveOutput msg_conv;
65418         msg_conv.inner = untag_ptr(msg);
65419         msg_conv.is_owned = ptr_is_owned(msg);
65420         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65421         msg_conv = TxRemoveOutput_clone(&msg_conv);
65422         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65423         *ret_copy = MessageSendEvent_send_tx_remove_output(node_id_ref, msg_conv);
65424         uint64_t ret_ref = tag_ptr(ret_copy, true);
65425         return ret_ref;
65426 }
65427
65428 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_complete"))) TS_MessageSendEvent_send_tx_complete(int8_tArray node_id, uint64_t msg) {
65429         LDKPublicKey node_id_ref;
65430         CHECK(node_id->arr_len == 33);
65431         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65432         LDKTxComplete msg_conv;
65433         msg_conv.inner = untag_ptr(msg);
65434         msg_conv.is_owned = ptr_is_owned(msg);
65435         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65436         msg_conv = TxComplete_clone(&msg_conv);
65437         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65438         *ret_copy = MessageSendEvent_send_tx_complete(node_id_ref, msg_conv);
65439         uint64_t ret_ref = tag_ptr(ret_copy, true);
65440         return ret_ref;
65441 }
65442
65443 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_signatures"))) TS_MessageSendEvent_send_tx_signatures(int8_tArray node_id, uint64_t msg) {
65444         LDKPublicKey node_id_ref;
65445         CHECK(node_id->arr_len == 33);
65446         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65447         LDKTxSignatures msg_conv;
65448         msg_conv.inner = untag_ptr(msg);
65449         msg_conv.is_owned = ptr_is_owned(msg);
65450         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65451         msg_conv = TxSignatures_clone(&msg_conv);
65452         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65453         *ret_copy = MessageSendEvent_send_tx_signatures(node_id_ref, msg_conv);
65454         uint64_t ret_ref = tag_ptr(ret_copy, true);
65455         return ret_ref;
65456 }
65457
65458 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_init_rbf"))) TS_MessageSendEvent_send_tx_init_rbf(int8_tArray node_id, uint64_t msg) {
65459         LDKPublicKey node_id_ref;
65460         CHECK(node_id->arr_len == 33);
65461         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65462         LDKTxInitRbf msg_conv;
65463         msg_conv.inner = untag_ptr(msg);
65464         msg_conv.is_owned = ptr_is_owned(msg);
65465         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65466         msg_conv = TxInitRbf_clone(&msg_conv);
65467         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65468         *ret_copy = MessageSendEvent_send_tx_init_rbf(node_id_ref, msg_conv);
65469         uint64_t ret_ref = tag_ptr(ret_copy, true);
65470         return ret_ref;
65471 }
65472
65473 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_ack_rbf"))) TS_MessageSendEvent_send_tx_ack_rbf(int8_tArray node_id, uint64_t msg) {
65474         LDKPublicKey node_id_ref;
65475         CHECK(node_id->arr_len == 33);
65476         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65477         LDKTxAckRbf msg_conv;
65478         msg_conv.inner = untag_ptr(msg);
65479         msg_conv.is_owned = ptr_is_owned(msg);
65480         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65481         msg_conv = TxAckRbf_clone(&msg_conv);
65482         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65483         *ret_copy = MessageSendEvent_send_tx_ack_rbf(node_id_ref, msg_conv);
65484         uint64_t ret_ref = tag_ptr(ret_copy, true);
65485         return ret_ref;
65486 }
65487
65488 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_abort"))) TS_MessageSendEvent_send_tx_abort(int8_tArray node_id, uint64_t msg) {
65489         LDKPublicKey node_id_ref;
65490         CHECK(node_id->arr_len == 33);
65491         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65492         LDKTxAbort msg_conv;
65493         msg_conv.inner = untag_ptr(msg);
65494         msg_conv.is_owned = ptr_is_owned(msg);
65495         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65496         msg_conv = TxAbort_clone(&msg_conv);
65497         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65498         *ret_copy = MessageSendEvent_send_tx_abort(node_id_ref, msg_conv);
65499         uint64_t ret_ref = tag_ptr(ret_copy, true);
65500         return ret_ref;
65501 }
65502
65503 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_ready"))) TS_MessageSendEvent_send_channel_ready(int8_tArray node_id, uint64_t msg) {
65504         LDKPublicKey node_id_ref;
65505         CHECK(node_id->arr_len == 33);
65506         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65507         LDKChannelReady msg_conv;
65508         msg_conv.inner = untag_ptr(msg);
65509         msg_conv.is_owned = ptr_is_owned(msg);
65510         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65511         msg_conv = ChannelReady_clone(&msg_conv);
65512         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65513         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
65514         uint64_t ret_ref = tag_ptr(ret_copy, true);
65515         return ret_ref;
65516 }
65517
65518 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_announcement_signatures"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint64_t msg) {
65519         LDKPublicKey node_id_ref;
65520         CHECK(node_id->arr_len == 33);
65521         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65522         LDKAnnouncementSignatures msg_conv;
65523         msg_conv.inner = untag_ptr(msg);
65524         msg_conv.is_owned = ptr_is_owned(msg);
65525         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65526         msg_conv = AnnouncementSignatures_clone(&msg_conv);
65527         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65528         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
65529         uint64_t ret_ref = tag_ptr(ret_copy, true);
65530         return ret_ref;
65531 }
65532
65533 uint64_t  __attribute__((export_name("TS_MessageSendEvent_update_htlcs"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint64_t updates) {
65534         LDKPublicKey node_id_ref;
65535         CHECK(node_id->arr_len == 33);
65536         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65537         LDKCommitmentUpdate updates_conv;
65538         updates_conv.inner = untag_ptr(updates);
65539         updates_conv.is_owned = ptr_is_owned(updates);
65540         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
65541         updates_conv = CommitmentUpdate_clone(&updates_conv);
65542         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65543         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
65544         uint64_t ret_ref = tag_ptr(ret_copy, true);
65545         return ret_ref;
65546 }
65547
65548 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_revoke_and_ack"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint64_t msg) {
65549         LDKPublicKey node_id_ref;
65550         CHECK(node_id->arr_len == 33);
65551         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65552         LDKRevokeAndACK msg_conv;
65553         msg_conv.inner = untag_ptr(msg);
65554         msg_conv.is_owned = ptr_is_owned(msg);
65555         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65556         msg_conv = RevokeAndACK_clone(&msg_conv);
65557         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65558         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
65559         uint64_t ret_ref = tag_ptr(ret_copy, true);
65560         return ret_ref;
65561 }
65562
65563 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_closing_signed"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint64_t msg) {
65564         LDKPublicKey node_id_ref;
65565         CHECK(node_id->arr_len == 33);
65566         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65567         LDKClosingSigned msg_conv;
65568         msg_conv.inner = untag_ptr(msg);
65569         msg_conv.is_owned = ptr_is_owned(msg);
65570         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65571         msg_conv = ClosingSigned_clone(&msg_conv);
65572         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65573         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
65574         uint64_t ret_ref = tag_ptr(ret_copy, true);
65575         return ret_ref;
65576 }
65577
65578 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_shutdown"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint64_t msg) {
65579         LDKPublicKey node_id_ref;
65580         CHECK(node_id->arr_len == 33);
65581         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65582         LDKShutdown msg_conv;
65583         msg_conv.inner = untag_ptr(msg);
65584         msg_conv.is_owned = ptr_is_owned(msg);
65585         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65586         msg_conv = Shutdown_clone(&msg_conv);
65587         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65588         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
65589         uint64_t ret_ref = tag_ptr(ret_copy, true);
65590         return ret_ref;
65591 }
65592
65593 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_reestablish"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint64_t msg) {
65594         LDKPublicKey node_id_ref;
65595         CHECK(node_id->arr_len == 33);
65596         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65597         LDKChannelReestablish msg_conv;
65598         msg_conv.inner = untag_ptr(msg);
65599         msg_conv.is_owned = ptr_is_owned(msg);
65600         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65601         msg_conv = ChannelReestablish_clone(&msg_conv);
65602         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65603         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
65604         uint64_t ret_ref = tag_ptr(ret_copy, true);
65605         return ret_ref;
65606 }
65607
65608 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) {
65609         LDKPublicKey node_id_ref;
65610         CHECK(node_id->arr_len == 33);
65611         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65612         LDKChannelAnnouncement msg_conv;
65613         msg_conv.inner = untag_ptr(msg);
65614         msg_conv.is_owned = ptr_is_owned(msg);
65615         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65616         msg_conv = ChannelAnnouncement_clone(&msg_conv);
65617         LDKChannelUpdate update_msg_conv;
65618         update_msg_conv.inner = untag_ptr(update_msg);
65619         update_msg_conv.is_owned = ptr_is_owned(update_msg);
65620         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
65621         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
65622         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65623         *ret_copy = MessageSendEvent_send_channel_announcement(node_id_ref, msg_conv, update_msg_conv);
65624         uint64_t ret_ref = tag_ptr(ret_copy, true);
65625         return ret_ref;
65626 }
65627
65628 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_announcement"))) TS_MessageSendEvent_broadcast_channel_announcement(uint64_t msg, uint64_t update_msg) {
65629         LDKChannelAnnouncement msg_conv;
65630         msg_conv.inner = untag_ptr(msg);
65631         msg_conv.is_owned = ptr_is_owned(msg);
65632         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65633         msg_conv = ChannelAnnouncement_clone(&msg_conv);
65634         LDKChannelUpdate update_msg_conv;
65635         update_msg_conv.inner = untag_ptr(update_msg);
65636         update_msg_conv.is_owned = ptr_is_owned(update_msg);
65637         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
65638         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
65639         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65640         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
65641         uint64_t ret_ref = tag_ptr(ret_copy, true);
65642         return ret_ref;
65643 }
65644
65645 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_update"))) TS_MessageSendEvent_broadcast_channel_update(uint64_t msg) {
65646         LDKChannelUpdate msg_conv;
65647         msg_conv.inner = untag_ptr(msg);
65648         msg_conv.is_owned = ptr_is_owned(msg);
65649         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65650         msg_conv = ChannelUpdate_clone(&msg_conv);
65651         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65652         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
65653         uint64_t ret_ref = tag_ptr(ret_copy, true);
65654         return ret_ref;
65655 }
65656
65657 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_node_announcement"))) TS_MessageSendEvent_broadcast_node_announcement(uint64_t msg) {
65658         LDKNodeAnnouncement msg_conv;
65659         msg_conv.inner = untag_ptr(msg);
65660         msg_conv.is_owned = ptr_is_owned(msg);
65661         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65662         msg_conv = NodeAnnouncement_clone(&msg_conv);
65663         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65664         *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
65665         uint64_t ret_ref = tag_ptr(ret_copy, true);
65666         return ret_ref;
65667 }
65668
65669 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_update"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint64_t msg) {
65670         LDKPublicKey node_id_ref;
65671         CHECK(node_id->arr_len == 33);
65672         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65673         LDKChannelUpdate msg_conv;
65674         msg_conv.inner = untag_ptr(msg);
65675         msg_conv.is_owned = ptr_is_owned(msg);
65676         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65677         msg_conv = ChannelUpdate_clone(&msg_conv);
65678         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65679         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
65680         uint64_t ret_ref = tag_ptr(ret_copy, true);
65681         return ret_ref;
65682 }
65683
65684 uint64_t  __attribute__((export_name("TS_MessageSendEvent_handle_error"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint64_t action) {
65685         LDKPublicKey node_id_ref;
65686         CHECK(node_id->arr_len == 33);
65687         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65688         void* action_ptr = untag_ptr(action);
65689         CHECK_ACCESS(action_ptr);
65690         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
65691         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
65692         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65693         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
65694         uint64_t ret_ref = tag_ptr(ret_copy, true);
65695         return ret_ref;
65696 }
65697
65698 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_range_query"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint64_t msg) {
65699         LDKPublicKey node_id_ref;
65700         CHECK(node_id->arr_len == 33);
65701         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65702         LDKQueryChannelRange msg_conv;
65703         msg_conv.inner = untag_ptr(msg);
65704         msg_conv.is_owned = ptr_is_owned(msg);
65705         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65706         msg_conv = QueryChannelRange_clone(&msg_conv);
65707         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65708         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
65709         uint64_t ret_ref = tag_ptr(ret_copy, true);
65710         return ret_ref;
65711 }
65712
65713 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_short_ids_query"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint64_t msg) {
65714         LDKPublicKey node_id_ref;
65715         CHECK(node_id->arr_len == 33);
65716         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65717         LDKQueryShortChannelIds msg_conv;
65718         msg_conv.inner = untag_ptr(msg);
65719         msg_conv.is_owned = ptr_is_owned(msg);
65720         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65721         msg_conv = QueryShortChannelIds_clone(&msg_conv);
65722         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65723         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
65724         uint64_t ret_ref = tag_ptr(ret_copy, true);
65725         return ret_ref;
65726 }
65727
65728 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_reply_channel_range"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint64_t msg) {
65729         LDKPublicKey node_id_ref;
65730         CHECK(node_id->arr_len == 33);
65731         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65732         LDKReplyChannelRange msg_conv;
65733         msg_conv.inner = untag_ptr(msg);
65734         msg_conv.is_owned = ptr_is_owned(msg);
65735         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65736         msg_conv = ReplyChannelRange_clone(&msg_conv);
65737         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65738         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
65739         uint64_t ret_ref = tag_ptr(ret_copy, true);
65740         return ret_ref;
65741 }
65742
65743 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_gossip_timestamp_filter"))) TS_MessageSendEvent_send_gossip_timestamp_filter(int8_tArray node_id, uint64_t msg) {
65744         LDKPublicKey node_id_ref;
65745         CHECK(node_id->arr_len == 33);
65746         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65747         LDKGossipTimestampFilter msg_conv;
65748         msg_conv.inner = untag_ptr(msg);
65749         msg_conv.is_owned = ptr_is_owned(msg);
65750         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65751         msg_conv = GossipTimestampFilter_clone(&msg_conv);
65752         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65753         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
65754         uint64_t ret_ref = tag_ptr(ret_copy, true);
65755         return ret_ref;
65756 }
65757
65758 void  __attribute__((export_name("TS_MessageSendEventsProvider_free"))) TS_MessageSendEventsProvider_free(uint64_t this_ptr) {
65759         if (!ptr_is_owned(this_ptr)) return;
65760         void* this_ptr_ptr = untag_ptr(this_ptr);
65761         CHECK_ACCESS(this_ptr_ptr);
65762         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
65763         FREE(untag_ptr(this_ptr));
65764         MessageSendEventsProvider_free(this_ptr_conv);
65765 }
65766
65767 void  __attribute__((export_name("TS_OnionMessageProvider_free"))) TS_OnionMessageProvider_free(uint64_t this_ptr) {
65768         if (!ptr_is_owned(this_ptr)) return;
65769         void* this_ptr_ptr = untag_ptr(this_ptr);
65770         CHECK_ACCESS(this_ptr_ptr);
65771         LDKOnionMessageProvider this_ptr_conv = *(LDKOnionMessageProvider*)(this_ptr_ptr);
65772         FREE(untag_ptr(this_ptr));
65773         OnionMessageProvider_free(this_ptr_conv);
65774 }
65775
65776 void  __attribute__((export_name("TS_EventsProvider_free"))) TS_EventsProvider_free(uint64_t this_ptr) {
65777         if (!ptr_is_owned(this_ptr)) return;
65778         void* this_ptr_ptr = untag_ptr(this_ptr);
65779         CHECK_ACCESS(this_ptr_ptr);
65780         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
65781         FREE(untag_ptr(this_ptr));
65782         EventsProvider_free(this_ptr_conv);
65783 }
65784
65785 void  __attribute__((export_name("TS_EventHandler_free"))) TS_EventHandler_free(uint64_t this_ptr) {
65786         if (!ptr_is_owned(this_ptr)) return;
65787         void* this_ptr_ptr = untag_ptr(this_ptr);
65788         CHECK_ACCESS(this_ptr_ptr);
65789         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
65790         FREE(untag_ptr(this_ptr));
65791         EventHandler_free(this_ptr_conv);
65792 }
65793
65794 void  __attribute__((export_name("TS_ChannelDerivationParameters_free"))) TS_ChannelDerivationParameters_free(uint64_t this_obj) {
65795         LDKChannelDerivationParameters this_obj_conv;
65796         this_obj_conv.inner = untag_ptr(this_obj);
65797         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65799         ChannelDerivationParameters_free(this_obj_conv);
65800 }
65801
65802 int64_t  __attribute__((export_name("TS_ChannelDerivationParameters_get_value_satoshis"))) TS_ChannelDerivationParameters_get_value_satoshis(uint64_t this_ptr) {
65803         LDKChannelDerivationParameters this_ptr_conv;
65804         this_ptr_conv.inner = untag_ptr(this_ptr);
65805         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65807         this_ptr_conv.is_owned = false;
65808         int64_t ret_conv = ChannelDerivationParameters_get_value_satoshis(&this_ptr_conv);
65809         return ret_conv;
65810 }
65811
65812 void  __attribute__((export_name("TS_ChannelDerivationParameters_set_value_satoshis"))) TS_ChannelDerivationParameters_set_value_satoshis(uint64_t this_ptr, int64_t val) {
65813         LDKChannelDerivationParameters this_ptr_conv;
65814         this_ptr_conv.inner = untag_ptr(this_ptr);
65815         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65817         this_ptr_conv.is_owned = false;
65818         ChannelDerivationParameters_set_value_satoshis(&this_ptr_conv, val);
65819 }
65820
65821 int8_tArray  __attribute__((export_name("TS_ChannelDerivationParameters_get_keys_id"))) TS_ChannelDerivationParameters_get_keys_id(uint64_t this_ptr) {
65822         LDKChannelDerivationParameters this_ptr_conv;
65823         this_ptr_conv.inner = untag_ptr(this_ptr);
65824         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65826         this_ptr_conv.is_owned = false;
65827         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
65828         memcpy(ret_arr->elems, *ChannelDerivationParameters_get_keys_id(&this_ptr_conv), 32);
65829         return ret_arr;
65830 }
65831
65832 void  __attribute__((export_name("TS_ChannelDerivationParameters_set_keys_id"))) TS_ChannelDerivationParameters_set_keys_id(uint64_t this_ptr, int8_tArray val) {
65833         LDKChannelDerivationParameters this_ptr_conv;
65834         this_ptr_conv.inner = untag_ptr(this_ptr);
65835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65837         this_ptr_conv.is_owned = false;
65838         LDKThirtyTwoBytes val_ref;
65839         CHECK(val->arr_len == 32);
65840         memcpy(val_ref.data, val->elems, 32); FREE(val);
65841         ChannelDerivationParameters_set_keys_id(&this_ptr_conv, val_ref);
65842 }
65843
65844 uint64_t  __attribute__((export_name("TS_ChannelDerivationParameters_get_transaction_parameters"))) TS_ChannelDerivationParameters_get_transaction_parameters(uint64_t this_ptr) {
65845         LDKChannelDerivationParameters this_ptr_conv;
65846         this_ptr_conv.inner = untag_ptr(this_ptr);
65847         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65849         this_ptr_conv.is_owned = false;
65850         LDKChannelTransactionParameters ret_var = ChannelDerivationParameters_get_transaction_parameters(&this_ptr_conv);
65851         uint64_t ret_ref = 0;
65852         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65853         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65854         return ret_ref;
65855 }
65856
65857 void  __attribute__((export_name("TS_ChannelDerivationParameters_set_transaction_parameters"))) TS_ChannelDerivationParameters_set_transaction_parameters(uint64_t this_ptr, uint64_t val) {
65858         LDKChannelDerivationParameters this_ptr_conv;
65859         this_ptr_conv.inner = untag_ptr(this_ptr);
65860         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65862         this_ptr_conv.is_owned = false;
65863         LDKChannelTransactionParameters val_conv;
65864         val_conv.inner = untag_ptr(val);
65865         val_conv.is_owned = ptr_is_owned(val);
65866         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65867         val_conv = ChannelTransactionParameters_clone(&val_conv);
65868         ChannelDerivationParameters_set_transaction_parameters(&this_ptr_conv, val_conv);
65869 }
65870
65871 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) {
65872         LDKThirtyTwoBytes keys_id_arg_ref;
65873         CHECK(keys_id_arg->arr_len == 32);
65874         memcpy(keys_id_arg_ref.data, keys_id_arg->elems, 32); FREE(keys_id_arg);
65875         LDKChannelTransactionParameters transaction_parameters_arg_conv;
65876         transaction_parameters_arg_conv.inner = untag_ptr(transaction_parameters_arg);
65877         transaction_parameters_arg_conv.is_owned = ptr_is_owned(transaction_parameters_arg);
65878         CHECK_INNER_FIELD_ACCESS_OR_NULL(transaction_parameters_arg_conv);
65879         transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&transaction_parameters_arg_conv);
65880         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_new(value_satoshis_arg, keys_id_arg_ref, transaction_parameters_arg_conv);
65881         uint64_t ret_ref = 0;
65882         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65883         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65884         return ret_ref;
65885 }
65886
65887 static inline uint64_t ChannelDerivationParameters_clone_ptr(LDKChannelDerivationParameters *NONNULL_PTR arg) {
65888         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(arg);
65889         uint64_t ret_ref = 0;
65890         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65891         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65892         return ret_ref;
65893 }
65894 int64_t  __attribute__((export_name("TS_ChannelDerivationParameters_clone_ptr"))) TS_ChannelDerivationParameters_clone_ptr(uint64_t arg) {
65895         LDKChannelDerivationParameters arg_conv;
65896         arg_conv.inner = untag_ptr(arg);
65897         arg_conv.is_owned = ptr_is_owned(arg);
65898         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65899         arg_conv.is_owned = false;
65900         int64_t ret_conv = ChannelDerivationParameters_clone_ptr(&arg_conv);
65901         return ret_conv;
65902 }
65903
65904 uint64_t  __attribute__((export_name("TS_ChannelDerivationParameters_clone"))) TS_ChannelDerivationParameters_clone(uint64_t orig) {
65905         LDKChannelDerivationParameters orig_conv;
65906         orig_conv.inner = untag_ptr(orig);
65907         orig_conv.is_owned = ptr_is_owned(orig);
65908         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65909         orig_conv.is_owned = false;
65910         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(&orig_conv);
65911         uint64_t ret_ref = 0;
65912         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65913         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65914         return ret_ref;
65915 }
65916
65917 jboolean  __attribute__((export_name("TS_ChannelDerivationParameters_eq"))) TS_ChannelDerivationParameters_eq(uint64_t a, uint64_t b) {
65918         LDKChannelDerivationParameters a_conv;
65919         a_conv.inner = untag_ptr(a);
65920         a_conv.is_owned = ptr_is_owned(a);
65921         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65922         a_conv.is_owned = false;
65923         LDKChannelDerivationParameters b_conv;
65924         b_conv.inner = untag_ptr(b);
65925         b_conv.is_owned = ptr_is_owned(b);
65926         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65927         b_conv.is_owned = false;
65928         jboolean ret_conv = ChannelDerivationParameters_eq(&a_conv, &b_conv);
65929         return ret_conv;
65930 }
65931
65932 int8_tArray  __attribute__((export_name("TS_ChannelDerivationParameters_write"))) TS_ChannelDerivationParameters_write(uint64_t obj) {
65933         LDKChannelDerivationParameters obj_conv;
65934         obj_conv.inner = untag_ptr(obj);
65935         obj_conv.is_owned = ptr_is_owned(obj);
65936         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65937         obj_conv.is_owned = false;
65938         LDKCVec_u8Z ret_var = ChannelDerivationParameters_write(&obj_conv);
65939         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65940         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65941         CVec_u8Z_free(ret_var);
65942         return ret_arr;
65943 }
65944
65945 uint64_t  __attribute__((export_name("TS_ChannelDerivationParameters_read"))) TS_ChannelDerivationParameters_read(int8_tArray ser) {
65946         LDKu8slice ser_ref;
65947         ser_ref.datalen = ser->arr_len;
65948         ser_ref.data = ser->elems;
65949         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
65950         *ret_conv = ChannelDerivationParameters_read(ser_ref);
65951         FREE(ser);
65952         return tag_ptr(ret_conv, true);
65953 }
65954
65955 void  __attribute__((export_name("TS_AnchorDescriptor_free"))) TS_AnchorDescriptor_free(uint64_t this_obj) {
65956         LDKAnchorDescriptor this_obj_conv;
65957         this_obj_conv.inner = untag_ptr(this_obj);
65958         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65960         AnchorDescriptor_free(this_obj_conv);
65961 }
65962
65963 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_get_channel_derivation_parameters"))) TS_AnchorDescriptor_get_channel_derivation_parameters(uint64_t this_ptr) {
65964         LDKAnchorDescriptor this_ptr_conv;
65965         this_ptr_conv.inner = untag_ptr(this_ptr);
65966         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65968         this_ptr_conv.is_owned = false;
65969         LDKChannelDerivationParameters ret_var = AnchorDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
65970         uint64_t ret_ref = 0;
65971         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65972         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65973         return ret_ref;
65974 }
65975
65976 void  __attribute__((export_name("TS_AnchorDescriptor_set_channel_derivation_parameters"))) TS_AnchorDescriptor_set_channel_derivation_parameters(uint64_t this_ptr, uint64_t val) {
65977         LDKAnchorDescriptor this_ptr_conv;
65978         this_ptr_conv.inner = untag_ptr(this_ptr);
65979         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65981         this_ptr_conv.is_owned = false;
65982         LDKChannelDerivationParameters val_conv;
65983         val_conv.inner = untag_ptr(val);
65984         val_conv.is_owned = ptr_is_owned(val);
65985         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65986         val_conv = ChannelDerivationParameters_clone(&val_conv);
65987         AnchorDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
65988 }
65989
65990 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_get_outpoint"))) TS_AnchorDescriptor_get_outpoint(uint64_t this_ptr) {
65991         LDKAnchorDescriptor this_ptr_conv;
65992         this_ptr_conv.inner = untag_ptr(this_ptr);
65993         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65995         this_ptr_conv.is_owned = false;
65996         LDKOutPoint ret_var = AnchorDescriptor_get_outpoint(&this_ptr_conv);
65997         uint64_t ret_ref = 0;
65998         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65999         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66000         return ret_ref;
66001 }
66002
66003 void  __attribute__((export_name("TS_AnchorDescriptor_set_outpoint"))) TS_AnchorDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
66004         LDKAnchorDescriptor this_ptr_conv;
66005         this_ptr_conv.inner = untag_ptr(this_ptr);
66006         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66008         this_ptr_conv.is_owned = false;
66009         LDKOutPoint val_conv;
66010         val_conv.inner = untag_ptr(val);
66011         val_conv.is_owned = ptr_is_owned(val);
66012         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
66013         val_conv = OutPoint_clone(&val_conv);
66014         AnchorDescriptor_set_outpoint(&this_ptr_conv, val_conv);
66015 }
66016
66017 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_new"))) TS_AnchorDescriptor_new(uint64_t channel_derivation_parameters_arg, uint64_t outpoint_arg) {
66018         LDKChannelDerivationParameters channel_derivation_parameters_arg_conv;
66019         channel_derivation_parameters_arg_conv.inner = untag_ptr(channel_derivation_parameters_arg);
66020         channel_derivation_parameters_arg_conv.is_owned = ptr_is_owned(channel_derivation_parameters_arg);
66021         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_derivation_parameters_arg_conv);
66022         channel_derivation_parameters_arg_conv = ChannelDerivationParameters_clone(&channel_derivation_parameters_arg_conv);
66023         LDKOutPoint outpoint_arg_conv;
66024         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
66025         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
66026         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
66027         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
66028         LDKAnchorDescriptor ret_var = AnchorDescriptor_new(channel_derivation_parameters_arg_conv, outpoint_arg_conv);
66029         uint64_t ret_ref = 0;
66030         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66031         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66032         return ret_ref;
66033 }
66034
66035 static inline uint64_t AnchorDescriptor_clone_ptr(LDKAnchorDescriptor *NONNULL_PTR arg) {
66036         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(arg);
66037         uint64_t ret_ref = 0;
66038         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66039         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66040         return ret_ref;
66041 }
66042 int64_t  __attribute__((export_name("TS_AnchorDescriptor_clone_ptr"))) TS_AnchorDescriptor_clone_ptr(uint64_t arg) {
66043         LDKAnchorDescriptor arg_conv;
66044         arg_conv.inner = untag_ptr(arg);
66045         arg_conv.is_owned = ptr_is_owned(arg);
66046         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66047         arg_conv.is_owned = false;
66048         int64_t ret_conv = AnchorDescriptor_clone_ptr(&arg_conv);
66049         return ret_conv;
66050 }
66051
66052 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_clone"))) TS_AnchorDescriptor_clone(uint64_t orig) {
66053         LDKAnchorDescriptor orig_conv;
66054         orig_conv.inner = untag_ptr(orig);
66055         orig_conv.is_owned = ptr_is_owned(orig);
66056         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66057         orig_conv.is_owned = false;
66058         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(&orig_conv);
66059         uint64_t ret_ref = 0;
66060         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66061         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66062         return ret_ref;
66063 }
66064
66065 jboolean  __attribute__((export_name("TS_AnchorDescriptor_eq"))) TS_AnchorDescriptor_eq(uint64_t a, uint64_t b) {
66066         LDKAnchorDescriptor a_conv;
66067         a_conv.inner = untag_ptr(a);
66068         a_conv.is_owned = ptr_is_owned(a);
66069         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66070         a_conv.is_owned = false;
66071         LDKAnchorDescriptor b_conv;
66072         b_conv.inner = untag_ptr(b);
66073         b_conv.is_owned = ptr_is_owned(b);
66074         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
66075         b_conv.is_owned = false;
66076         jboolean ret_conv = AnchorDescriptor_eq(&a_conv, &b_conv);
66077         return ret_conv;
66078 }
66079
66080 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_previous_utxo"))) TS_AnchorDescriptor_previous_utxo(uint64_t this_arg) {
66081         LDKAnchorDescriptor this_arg_conv;
66082         this_arg_conv.inner = untag_ptr(this_arg);
66083         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66085         this_arg_conv.is_owned = false;
66086         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
66087         *ret_ref = AnchorDescriptor_previous_utxo(&this_arg_conv);
66088         return tag_ptr(ret_ref, true);
66089 }
66090
66091 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_unsigned_tx_input"))) TS_AnchorDescriptor_unsigned_tx_input(uint64_t this_arg) {
66092         LDKAnchorDescriptor this_arg_conv;
66093         this_arg_conv.inner = untag_ptr(this_arg);
66094         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66096         this_arg_conv.is_owned = false;
66097         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
66098         *ret_ref = AnchorDescriptor_unsigned_tx_input(&this_arg_conv);
66099         return tag_ptr(ret_ref, true);
66100 }
66101
66102 int8_tArray  __attribute__((export_name("TS_AnchorDescriptor_witness_script"))) TS_AnchorDescriptor_witness_script(uint64_t this_arg) {
66103         LDKAnchorDescriptor this_arg_conv;
66104         this_arg_conv.inner = untag_ptr(this_arg);
66105         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66107         this_arg_conv.is_owned = false;
66108         LDKCVec_u8Z ret_var = AnchorDescriptor_witness_script(&this_arg_conv);
66109         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66110         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66111         CVec_u8Z_free(ret_var);
66112         return ret_arr;
66113 }
66114
66115 int8_tArray  __attribute__((export_name("TS_AnchorDescriptor_tx_input_witness"))) TS_AnchorDescriptor_tx_input_witness(uint64_t this_arg, int8_tArray signature) {
66116         LDKAnchorDescriptor this_arg_conv;
66117         this_arg_conv.inner = untag_ptr(this_arg);
66118         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66120         this_arg_conv.is_owned = false;
66121         LDKECDSASignature signature_ref;
66122         CHECK(signature->arr_len == 64);
66123         memcpy(signature_ref.compact_form, signature->elems, 64); FREE(signature);
66124         LDKWitness ret_var = AnchorDescriptor_tx_input_witness(&this_arg_conv, signature_ref);
66125         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66126         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66127         Witness_free(ret_var);
66128         return ret_arr;
66129 }
66130
66131 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_derive_channel_signer"))) TS_AnchorDescriptor_derive_channel_signer(uint64_t this_arg, uint64_t signer_provider) {
66132         LDKAnchorDescriptor this_arg_conv;
66133         this_arg_conv.inner = untag_ptr(this_arg);
66134         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66136         this_arg_conv.is_owned = false;
66137         void* signer_provider_ptr = untag_ptr(signer_provider);
66138         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
66139         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
66140         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
66141         *ret_ret = AnchorDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
66142         return tag_ptr(ret_ret, true);
66143 }
66144
66145 void  __attribute__((export_name("TS_HTLCDescriptor_free"))) TS_HTLCDescriptor_free(uint64_t this_obj) {
66146         LDKHTLCDescriptor this_obj_conv;
66147         this_obj_conv.inner = untag_ptr(this_obj);
66148         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66150         HTLCDescriptor_free(this_obj_conv);
66151 }
66152
66153 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_get_channel_derivation_parameters"))) TS_HTLCDescriptor_get_channel_derivation_parameters(uint64_t this_ptr) {
66154         LDKHTLCDescriptor this_ptr_conv;
66155         this_ptr_conv.inner = untag_ptr(this_ptr);
66156         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66158         this_ptr_conv.is_owned = false;
66159         LDKChannelDerivationParameters ret_var = HTLCDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
66160         uint64_t ret_ref = 0;
66161         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66162         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66163         return ret_ref;
66164 }
66165
66166 void  __attribute__((export_name("TS_HTLCDescriptor_set_channel_derivation_parameters"))) TS_HTLCDescriptor_set_channel_derivation_parameters(uint64_t this_ptr, uint64_t val) {
66167         LDKHTLCDescriptor this_ptr_conv;
66168         this_ptr_conv.inner = untag_ptr(this_ptr);
66169         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66171         this_ptr_conv.is_owned = false;
66172         LDKChannelDerivationParameters val_conv;
66173         val_conv.inner = untag_ptr(val);
66174         val_conv.is_owned = ptr_is_owned(val);
66175         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
66176         val_conv = ChannelDerivationParameters_clone(&val_conv);
66177         HTLCDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
66178 }
66179
66180 int64_t  __attribute__((export_name("TS_HTLCDescriptor_get_per_commitment_number"))) TS_HTLCDescriptor_get_per_commitment_number(uint64_t this_ptr) {
66181         LDKHTLCDescriptor this_ptr_conv;
66182         this_ptr_conv.inner = untag_ptr(this_ptr);
66183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66185         this_ptr_conv.is_owned = false;
66186         int64_t ret_conv = HTLCDescriptor_get_per_commitment_number(&this_ptr_conv);
66187         return ret_conv;
66188 }
66189
66190 void  __attribute__((export_name("TS_HTLCDescriptor_set_per_commitment_number"))) TS_HTLCDescriptor_set_per_commitment_number(uint64_t this_ptr, int64_t val) {
66191         LDKHTLCDescriptor this_ptr_conv;
66192         this_ptr_conv.inner = untag_ptr(this_ptr);
66193         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66195         this_ptr_conv.is_owned = false;
66196         HTLCDescriptor_set_per_commitment_number(&this_ptr_conv, val);
66197 }
66198
66199 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_get_per_commitment_point"))) TS_HTLCDescriptor_get_per_commitment_point(uint64_t this_ptr) {
66200         LDKHTLCDescriptor this_ptr_conv;
66201         this_ptr_conv.inner = untag_ptr(this_ptr);
66202         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66204         this_ptr_conv.is_owned = false;
66205         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
66206         memcpy(ret_arr->elems, HTLCDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
66207         return ret_arr;
66208 }
66209
66210 void  __attribute__((export_name("TS_HTLCDescriptor_set_per_commitment_point"))) TS_HTLCDescriptor_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
66211         LDKHTLCDescriptor this_ptr_conv;
66212         this_ptr_conv.inner = untag_ptr(this_ptr);
66213         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66215         this_ptr_conv.is_owned = false;
66216         LDKPublicKey val_ref;
66217         CHECK(val->arr_len == 33);
66218         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
66219         HTLCDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
66220 }
66221
66222 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_get_htlc"))) TS_HTLCDescriptor_get_htlc(uint64_t this_ptr) {
66223         LDKHTLCDescriptor this_ptr_conv;
66224         this_ptr_conv.inner = untag_ptr(this_ptr);
66225         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66227         this_ptr_conv.is_owned = false;
66228         LDKHTLCOutputInCommitment ret_var = HTLCDescriptor_get_htlc(&this_ptr_conv);
66229         uint64_t ret_ref = 0;
66230         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66231         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66232         return ret_ref;
66233 }
66234
66235 void  __attribute__((export_name("TS_HTLCDescriptor_set_htlc"))) TS_HTLCDescriptor_set_htlc(uint64_t this_ptr, uint64_t val) {
66236         LDKHTLCDescriptor this_ptr_conv;
66237         this_ptr_conv.inner = untag_ptr(this_ptr);
66238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66240         this_ptr_conv.is_owned = false;
66241         LDKHTLCOutputInCommitment val_conv;
66242         val_conv.inner = untag_ptr(val);
66243         val_conv.is_owned = ptr_is_owned(val);
66244         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
66245         val_conv = HTLCOutputInCommitment_clone(&val_conv);
66246         HTLCDescriptor_set_htlc(&this_ptr_conv, val_conv);
66247 }
66248
66249 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_get_preimage"))) TS_HTLCDescriptor_get_preimage(uint64_t this_ptr) {
66250         LDKHTLCDescriptor this_ptr_conv;
66251         this_ptr_conv.inner = untag_ptr(this_ptr);
66252         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66254         this_ptr_conv.is_owned = false;
66255         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
66256         *ret_copy = HTLCDescriptor_get_preimage(&this_ptr_conv);
66257         uint64_t ret_ref = tag_ptr(ret_copy, true);
66258         return ret_ref;
66259 }
66260
66261 void  __attribute__((export_name("TS_HTLCDescriptor_set_preimage"))) TS_HTLCDescriptor_set_preimage(uint64_t this_ptr, uint64_t val) {
66262         LDKHTLCDescriptor this_ptr_conv;
66263         this_ptr_conv.inner = untag_ptr(this_ptr);
66264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66266         this_ptr_conv.is_owned = false;
66267         void* val_ptr = untag_ptr(val);
66268         CHECK_ACCESS(val_ptr);
66269         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
66270         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
66271         HTLCDescriptor_set_preimage(&this_ptr_conv, val_conv);
66272 }
66273
66274 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_get_counterparty_sig"))) TS_HTLCDescriptor_get_counterparty_sig(uint64_t this_ptr) {
66275         LDKHTLCDescriptor this_ptr_conv;
66276         this_ptr_conv.inner = untag_ptr(this_ptr);
66277         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66279         this_ptr_conv.is_owned = false;
66280         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
66281         memcpy(ret_arr->elems, HTLCDescriptor_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
66282         return ret_arr;
66283 }
66284
66285 void  __attribute__((export_name("TS_HTLCDescriptor_set_counterparty_sig"))) TS_HTLCDescriptor_set_counterparty_sig(uint64_t this_ptr, int8_tArray val) {
66286         LDKHTLCDescriptor this_ptr_conv;
66287         this_ptr_conv.inner = untag_ptr(this_ptr);
66288         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66290         this_ptr_conv.is_owned = false;
66291         LDKECDSASignature val_ref;
66292         CHECK(val->arr_len == 64);
66293         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
66294         HTLCDescriptor_set_counterparty_sig(&this_ptr_conv, val_ref);
66295 }
66296
66297 static inline uint64_t HTLCDescriptor_clone_ptr(LDKHTLCDescriptor *NONNULL_PTR arg) {
66298         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(arg);
66299         uint64_t ret_ref = 0;
66300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66302         return ret_ref;
66303 }
66304 int64_t  __attribute__((export_name("TS_HTLCDescriptor_clone_ptr"))) TS_HTLCDescriptor_clone_ptr(uint64_t arg) {
66305         LDKHTLCDescriptor arg_conv;
66306         arg_conv.inner = untag_ptr(arg);
66307         arg_conv.is_owned = ptr_is_owned(arg);
66308         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66309         arg_conv.is_owned = false;
66310         int64_t ret_conv = HTLCDescriptor_clone_ptr(&arg_conv);
66311         return ret_conv;
66312 }
66313
66314 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_clone"))) TS_HTLCDescriptor_clone(uint64_t orig) {
66315         LDKHTLCDescriptor orig_conv;
66316         orig_conv.inner = untag_ptr(orig);
66317         orig_conv.is_owned = ptr_is_owned(orig);
66318         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66319         orig_conv.is_owned = false;
66320         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(&orig_conv);
66321         uint64_t ret_ref = 0;
66322         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66323         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66324         return ret_ref;
66325 }
66326
66327 jboolean  __attribute__((export_name("TS_HTLCDescriptor_eq"))) TS_HTLCDescriptor_eq(uint64_t a, uint64_t b) {
66328         LDKHTLCDescriptor a_conv;
66329         a_conv.inner = untag_ptr(a);
66330         a_conv.is_owned = ptr_is_owned(a);
66331         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66332         a_conv.is_owned = false;
66333         LDKHTLCDescriptor b_conv;
66334         b_conv.inner = untag_ptr(b);
66335         b_conv.is_owned = ptr_is_owned(b);
66336         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
66337         b_conv.is_owned = false;
66338         jboolean ret_conv = HTLCDescriptor_eq(&a_conv, &b_conv);
66339         return ret_conv;
66340 }
66341
66342 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_write"))) TS_HTLCDescriptor_write(uint64_t obj) {
66343         LDKHTLCDescriptor obj_conv;
66344         obj_conv.inner = untag_ptr(obj);
66345         obj_conv.is_owned = ptr_is_owned(obj);
66346         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66347         obj_conv.is_owned = false;
66348         LDKCVec_u8Z ret_var = HTLCDescriptor_write(&obj_conv);
66349         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66350         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66351         CVec_u8Z_free(ret_var);
66352         return ret_arr;
66353 }
66354
66355 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_read"))) TS_HTLCDescriptor_read(int8_tArray ser) {
66356         LDKu8slice ser_ref;
66357         ser_ref.datalen = ser->arr_len;
66358         ser_ref.data = ser->elems;
66359         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
66360         *ret_conv = HTLCDescriptor_read(ser_ref);
66361         FREE(ser);
66362         return tag_ptr(ret_conv, true);
66363 }
66364
66365 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_outpoint"))) TS_HTLCDescriptor_outpoint(uint64_t this_arg) {
66366         LDKHTLCDescriptor this_arg_conv;
66367         this_arg_conv.inner = untag_ptr(this_arg);
66368         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66370         this_arg_conv.is_owned = false;
66371         LDKOutPoint ret_var = HTLCDescriptor_outpoint(&this_arg_conv);
66372         uint64_t ret_ref = 0;
66373         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66374         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66375         return ret_ref;
66376 }
66377
66378 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_previous_utxo"))) TS_HTLCDescriptor_previous_utxo(uint64_t this_arg) {
66379         LDKHTLCDescriptor this_arg_conv;
66380         this_arg_conv.inner = untag_ptr(this_arg);
66381         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66383         this_arg_conv.is_owned = false;
66384         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
66385         *ret_ref = HTLCDescriptor_previous_utxo(&this_arg_conv);
66386         return tag_ptr(ret_ref, true);
66387 }
66388
66389 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_unsigned_tx_input"))) TS_HTLCDescriptor_unsigned_tx_input(uint64_t this_arg) {
66390         LDKHTLCDescriptor this_arg_conv;
66391         this_arg_conv.inner = untag_ptr(this_arg);
66392         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66394         this_arg_conv.is_owned = false;
66395         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
66396         *ret_ref = HTLCDescriptor_unsigned_tx_input(&this_arg_conv);
66397         return tag_ptr(ret_ref, true);
66398 }
66399
66400 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_tx_output"))) TS_HTLCDescriptor_tx_output(uint64_t this_arg) {
66401         LDKHTLCDescriptor this_arg_conv;
66402         this_arg_conv.inner = untag_ptr(this_arg);
66403         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66405         this_arg_conv.is_owned = false;
66406         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
66407         *ret_ref = HTLCDescriptor_tx_output(&this_arg_conv);
66408         return tag_ptr(ret_ref, true);
66409 }
66410
66411 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_witness_script"))) TS_HTLCDescriptor_witness_script(uint64_t this_arg) {
66412         LDKHTLCDescriptor this_arg_conv;
66413         this_arg_conv.inner = untag_ptr(this_arg);
66414         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66416         this_arg_conv.is_owned = false;
66417         LDKCVec_u8Z ret_var = HTLCDescriptor_witness_script(&this_arg_conv);
66418         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66419         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66420         CVec_u8Z_free(ret_var);
66421         return ret_arr;
66422 }
66423
66424 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) {
66425         LDKHTLCDescriptor this_arg_conv;
66426         this_arg_conv.inner = untag_ptr(this_arg);
66427         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66429         this_arg_conv.is_owned = false;
66430         LDKECDSASignature signature_ref;
66431         CHECK(signature->arr_len == 64);
66432         memcpy(signature_ref.compact_form, signature->elems, 64); FREE(signature);
66433         LDKu8slice witness_script_ref;
66434         witness_script_ref.datalen = witness_script->arr_len;
66435         witness_script_ref.data = witness_script->elems;
66436         LDKWitness ret_var = HTLCDescriptor_tx_input_witness(&this_arg_conv, signature_ref, witness_script_ref);
66437         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66438         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66439         Witness_free(ret_var);
66440         FREE(witness_script);
66441         return ret_arr;
66442 }
66443
66444 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_derive_channel_signer"))) TS_HTLCDescriptor_derive_channel_signer(uint64_t this_arg, uint64_t signer_provider) {
66445         LDKHTLCDescriptor this_arg_conv;
66446         this_arg_conv.inner = untag_ptr(this_arg);
66447         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66449         this_arg_conv.is_owned = false;
66450         void* signer_provider_ptr = untag_ptr(signer_provider);
66451         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
66452         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
66453         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
66454         *ret_ret = HTLCDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
66455         return tag_ptr(ret_ret, true);
66456 }
66457
66458 void  __attribute__((export_name("TS_BumpTransactionEvent_free"))) TS_BumpTransactionEvent_free(uint64_t this_ptr) {
66459         if (!ptr_is_owned(this_ptr)) return;
66460         void* this_ptr_ptr = untag_ptr(this_ptr);
66461         CHECK_ACCESS(this_ptr_ptr);
66462         LDKBumpTransactionEvent this_ptr_conv = *(LDKBumpTransactionEvent*)(this_ptr_ptr);
66463         FREE(untag_ptr(this_ptr));
66464         BumpTransactionEvent_free(this_ptr_conv);
66465 }
66466
66467 static inline uint64_t BumpTransactionEvent_clone_ptr(LDKBumpTransactionEvent *NONNULL_PTR arg) {
66468         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
66469         *ret_copy = BumpTransactionEvent_clone(arg);
66470         uint64_t ret_ref = tag_ptr(ret_copy, true);
66471         return ret_ref;
66472 }
66473 int64_t  __attribute__((export_name("TS_BumpTransactionEvent_clone_ptr"))) TS_BumpTransactionEvent_clone_ptr(uint64_t arg) {
66474         LDKBumpTransactionEvent* arg_conv = (LDKBumpTransactionEvent*)untag_ptr(arg);
66475         int64_t ret_conv = BumpTransactionEvent_clone_ptr(arg_conv);
66476         return ret_conv;
66477 }
66478
66479 uint64_t  __attribute__((export_name("TS_BumpTransactionEvent_clone"))) TS_BumpTransactionEvent_clone(uint64_t orig) {
66480         LDKBumpTransactionEvent* orig_conv = (LDKBumpTransactionEvent*)untag_ptr(orig);
66481         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
66482         *ret_copy = BumpTransactionEvent_clone(orig_conv);
66483         uint64_t ret_ref = tag_ptr(ret_copy, true);
66484         return ret_ref;
66485 }
66486
66487 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) {
66488         LDKThirtyTwoBytes claim_id_ref;
66489         CHECK(claim_id->arr_len == 32);
66490         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
66491         LDKTransaction commitment_tx_ref;
66492         commitment_tx_ref.datalen = commitment_tx->arr_len;
66493         commitment_tx_ref.data = MALLOC(commitment_tx_ref.datalen, "LDKTransaction Bytes");
66494         memcpy(commitment_tx_ref.data, commitment_tx->elems, commitment_tx_ref.datalen); FREE(commitment_tx);
66495         commitment_tx_ref.data_is_owned = true;
66496         LDKAnchorDescriptor anchor_descriptor_conv;
66497         anchor_descriptor_conv.inner = untag_ptr(anchor_descriptor);
66498         anchor_descriptor_conv.is_owned = ptr_is_owned(anchor_descriptor);
66499         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_conv);
66500         anchor_descriptor_conv = AnchorDescriptor_clone(&anchor_descriptor_conv);
66501         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_constr;
66502         pending_htlcs_constr.datalen = pending_htlcs->arr_len;
66503         if (pending_htlcs_constr.datalen > 0)
66504                 pending_htlcs_constr.data = MALLOC(pending_htlcs_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
66505         else
66506                 pending_htlcs_constr.data = NULL;
66507         uint64_t* pending_htlcs_vals = pending_htlcs->elems;
66508         for (size_t y = 0; y < pending_htlcs_constr.datalen; y++) {
66509                 uint64_t pending_htlcs_conv_24 = pending_htlcs_vals[y];
66510                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_conv;
66511                 pending_htlcs_conv_24_conv.inner = untag_ptr(pending_htlcs_conv_24);
66512                 pending_htlcs_conv_24_conv.is_owned = ptr_is_owned(pending_htlcs_conv_24);
66513                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_conv);
66514                 pending_htlcs_conv_24_conv = HTLCOutputInCommitment_clone(&pending_htlcs_conv_24_conv);
66515                 pending_htlcs_constr.data[y] = pending_htlcs_conv_24_conv;
66516         }
66517         FREE(pending_htlcs);
66518         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
66519         *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);
66520         uint64_t ret_ref = tag_ptr(ret_copy, true);
66521         return ret_ref;
66522 }
66523
66524 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) {
66525         LDKThirtyTwoBytes claim_id_ref;
66526         CHECK(claim_id->arr_len == 32);
66527         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
66528         LDKCVec_HTLCDescriptorZ htlc_descriptors_constr;
66529         htlc_descriptors_constr.datalen = htlc_descriptors->arr_len;
66530         if (htlc_descriptors_constr.datalen > 0)
66531                 htlc_descriptors_constr.data = MALLOC(htlc_descriptors_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
66532         else
66533                 htlc_descriptors_constr.data = NULL;
66534         uint64_t* htlc_descriptors_vals = htlc_descriptors->elems;
66535         for (size_t q = 0; q < htlc_descriptors_constr.datalen; q++) {
66536                 uint64_t htlc_descriptors_conv_16 = htlc_descriptors_vals[q];
66537                 LDKHTLCDescriptor htlc_descriptors_conv_16_conv;
66538                 htlc_descriptors_conv_16_conv.inner = untag_ptr(htlc_descriptors_conv_16);
66539                 htlc_descriptors_conv_16_conv.is_owned = ptr_is_owned(htlc_descriptors_conv_16);
66540                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_conv);
66541                 htlc_descriptors_conv_16_conv = HTLCDescriptor_clone(&htlc_descriptors_conv_16_conv);
66542                 htlc_descriptors_constr.data[q] = htlc_descriptors_conv_16_conv;
66543         }
66544         FREE(htlc_descriptors);
66545         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
66546         *ret_copy = BumpTransactionEvent_htlcresolution(claim_id_ref, target_feerate_sat_per_1000_weight, htlc_descriptors_constr, tx_lock_time);
66547         uint64_t ret_ref = tag_ptr(ret_copy, true);
66548         return ret_ref;
66549 }
66550
66551 jboolean  __attribute__((export_name("TS_BumpTransactionEvent_eq"))) TS_BumpTransactionEvent_eq(uint64_t a, uint64_t b) {
66552         LDKBumpTransactionEvent* a_conv = (LDKBumpTransactionEvent*)untag_ptr(a);
66553         LDKBumpTransactionEvent* b_conv = (LDKBumpTransactionEvent*)untag_ptr(b);
66554         jboolean ret_conv = BumpTransactionEvent_eq(a_conv, b_conv);
66555         return ret_conv;
66556 }
66557
66558 void  __attribute__((export_name("TS_Input_free"))) TS_Input_free(uint64_t this_obj) {
66559         LDKInput this_obj_conv;
66560         this_obj_conv.inner = untag_ptr(this_obj);
66561         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66563         Input_free(this_obj_conv);
66564 }
66565
66566 uint64_t  __attribute__((export_name("TS_Input_get_outpoint"))) TS_Input_get_outpoint(uint64_t this_ptr) {
66567         LDKInput this_ptr_conv;
66568         this_ptr_conv.inner = untag_ptr(this_ptr);
66569         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66571         this_ptr_conv.is_owned = false;
66572         LDKOutPoint ret_var = Input_get_outpoint(&this_ptr_conv);
66573         uint64_t ret_ref = 0;
66574         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66575         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66576         return ret_ref;
66577 }
66578
66579 void  __attribute__((export_name("TS_Input_set_outpoint"))) TS_Input_set_outpoint(uint64_t this_ptr, uint64_t val) {
66580         LDKInput this_ptr_conv;
66581         this_ptr_conv.inner = untag_ptr(this_ptr);
66582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66584         this_ptr_conv.is_owned = false;
66585         LDKOutPoint val_conv;
66586         val_conv.inner = untag_ptr(val);
66587         val_conv.is_owned = ptr_is_owned(val);
66588         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
66589         val_conv = OutPoint_clone(&val_conv);
66590         Input_set_outpoint(&this_ptr_conv, val_conv);
66591 }
66592
66593 uint64_t  __attribute__((export_name("TS_Input_get_previous_utxo"))) TS_Input_get_previous_utxo(uint64_t this_ptr) {
66594         LDKInput this_ptr_conv;
66595         this_ptr_conv.inner = untag_ptr(this_ptr);
66596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66598         this_ptr_conv.is_owned = false;
66599         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
66600         *ret_ref = Input_get_previous_utxo(&this_ptr_conv);
66601         return tag_ptr(ret_ref, true);
66602 }
66603
66604 void  __attribute__((export_name("TS_Input_set_previous_utxo"))) TS_Input_set_previous_utxo(uint64_t this_ptr, uint64_t val) {
66605         LDKInput this_ptr_conv;
66606         this_ptr_conv.inner = untag_ptr(this_ptr);
66607         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66609         this_ptr_conv.is_owned = false;
66610         void* val_ptr = untag_ptr(val);
66611         CHECK_ACCESS(val_ptr);
66612         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
66613         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
66614         Input_set_previous_utxo(&this_ptr_conv, val_conv);
66615 }
66616
66617 int64_t  __attribute__((export_name("TS_Input_get_satisfaction_weight"))) TS_Input_get_satisfaction_weight(uint64_t this_ptr) {
66618         LDKInput this_ptr_conv;
66619         this_ptr_conv.inner = untag_ptr(this_ptr);
66620         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66622         this_ptr_conv.is_owned = false;
66623         int64_t ret_conv = Input_get_satisfaction_weight(&this_ptr_conv);
66624         return ret_conv;
66625 }
66626
66627 void  __attribute__((export_name("TS_Input_set_satisfaction_weight"))) TS_Input_set_satisfaction_weight(uint64_t this_ptr, int64_t val) {
66628         LDKInput this_ptr_conv;
66629         this_ptr_conv.inner = untag_ptr(this_ptr);
66630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66632         this_ptr_conv.is_owned = false;
66633         Input_set_satisfaction_weight(&this_ptr_conv, val);
66634 }
66635
66636 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) {
66637         LDKOutPoint outpoint_arg_conv;
66638         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
66639         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
66640         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
66641         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
66642         void* previous_utxo_arg_ptr = untag_ptr(previous_utxo_arg);
66643         CHECK_ACCESS(previous_utxo_arg_ptr);
66644         LDKTxOut previous_utxo_arg_conv = *(LDKTxOut*)(previous_utxo_arg_ptr);
66645         previous_utxo_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(previous_utxo_arg));
66646         LDKInput ret_var = Input_new(outpoint_arg_conv, previous_utxo_arg_conv, satisfaction_weight_arg);
66647         uint64_t ret_ref = 0;
66648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66650         return ret_ref;
66651 }
66652
66653 static inline uint64_t Input_clone_ptr(LDKInput *NONNULL_PTR arg) {
66654         LDKInput ret_var = Input_clone(arg);
66655         uint64_t ret_ref = 0;
66656         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66657         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66658         return ret_ref;
66659 }
66660 int64_t  __attribute__((export_name("TS_Input_clone_ptr"))) TS_Input_clone_ptr(uint64_t arg) {
66661         LDKInput arg_conv;
66662         arg_conv.inner = untag_ptr(arg);
66663         arg_conv.is_owned = ptr_is_owned(arg);
66664         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66665         arg_conv.is_owned = false;
66666         int64_t ret_conv = Input_clone_ptr(&arg_conv);
66667         return ret_conv;
66668 }
66669
66670 uint64_t  __attribute__((export_name("TS_Input_clone"))) TS_Input_clone(uint64_t orig) {
66671         LDKInput orig_conv;
66672         orig_conv.inner = untag_ptr(orig);
66673         orig_conv.is_owned = ptr_is_owned(orig);
66674         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66675         orig_conv.is_owned = false;
66676         LDKInput ret_var = Input_clone(&orig_conv);
66677         uint64_t ret_ref = 0;
66678         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66679         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66680         return ret_ref;
66681 }
66682
66683 int64_t  __attribute__((export_name("TS_Input_hash"))) TS_Input_hash(uint64_t o) {
66684         LDKInput o_conv;
66685         o_conv.inner = untag_ptr(o);
66686         o_conv.is_owned = ptr_is_owned(o);
66687         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
66688         o_conv.is_owned = false;
66689         int64_t ret_conv = Input_hash(&o_conv);
66690         return ret_conv;
66691 }
66692
66693 jboolean  __attribute__((export_name("TS_Input_eq"))) TS_Input_eq(uint64_t a, uint64_t b) {
66694         LDKInput a_conv;
66695         a_conv.inner = untag_ptr(a);
66696         a_conv.is_owned = ptr_is_owned(a);
66697         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66698         a_conv.is_owned = false;
66699         LDKInput b_conv;
66700         b_conv.inner = untag_ptr(b);
66701         b_conv.is_owned = ptr_is_owned(b);
66702         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
66703         b_conv.is_owned = false;
66704         jboolean ret_conv = Input_eq(&a_conv, &b_conv);
66705         return ret_conv;
66706 }
66707
66708 void  __attribute__((export_name("TS_Utxo_free"))) TS_Utxo_free(uint64_t this_obj) {
66709         LDKUtxo this_obj_conv;
66710         this_obj_conv.inner = untag_ptr(this_obj);
66711         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66713         Utxo_free(this_obj_conv);
66714 }
66715
66716 uint64_t  __attribute__((export_name("TS_Utxo_get_outpoint"))) TS_Utxo_get_outpoint(uint64_t this_ptr) {
66717         LDKUtxo this_ptr_conv;
66718         this_ptr_conv.inner = untag_ptr(this_ptr);
66719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66721         this_ptr_conv.is_owned = false;
66722         LDKOutPoint ret_var = Utxo_get_outpoint(&this_ptr_conv);
66723         uint64_t ret_ref = 0;
66724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66726         return ret_ref;
66727 }
66728
66729 void  __attribute__((export_name("TS_Utxo_set_outpoint"))) TS_Utxo_set_outpoint(uint64_t this_ptr, uint64_t val) {
66730         LDKUtxo this_ptr_conv;
66731         this_ptr_conv.inner = untag_ptr(this_ptr);
66732         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66734         this_ptr_conv.is_owned = false;
66735         LDKOutPoint val_conv;
66736         val_conv.inner = untag_ptr(val);
66737         val_conv.is_owned = ptr_is_owned(val);
66738         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
66739         val_conv = OutPoint_clone(&val_conv);
66740         Utxo_set_outpoint(&this_ptr_conv, val_conv);
66741 }
66742
66743 uint64_t  __attribute__((export_name("TS_Utxo_get_output"))) TS_Utxo_get_output(uint64_t this_ptr) {
66744         LDKUtxo this_ptr_conv;
66745         this_ptr_conv.inner = untag_ptr(this_ptr);
66746         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66748         this_ptr_conv.is_owned = false;
66749         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
66750         *ret_ref = Utxo_get_output(&this_ptr_conv);
66751         return tag_ptr(ret_ref, true);
66752 }
66753
66754 void  __attribute__((export_name("TS_Utxo_set_output"))) TS_Utxo_set_output(uint64_t this_ptr, uint64_t val) {
66755         LDKUtxo this_ptr_conv;
66756         this_ptr_conv.inner = untag_ptr(this_ptr);
66757         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66759         this_ptr_conv.is_owned = false;
66760         void* val_ptr = untag_ptr(val);
66761         CHECK_ACCESS(val_ptr);
66762         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
66763         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
66764         Utxo_set_output(&this_ptr_conv, val_conv);
66765 }
66766
66767 int64_t  __attribute__((export_name("TS_Utxo_get_satisfaction_weight"))) TS_Utxo_get_satisfaction_weight(uint64_t this_ptr) {
66768         LDKUtxo this_ptr_conv;
66769         this_ptr_conv.inner = untag_ptr(this_ptr);
66770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66772         this_ptr_conv.is_owned = false;
66773         int64_t ret_conv = Utxo_get_satisfaction_weight(&this_ptr_conv);
66774         return ret_conv;
66775 }
66776
66777 void  __attribute__((export_name("TS_Utxo_set_satisfaction_weight"))) TS_Utxo_set_satisfaction_weight(uint64_t this_ptr, int64_t val) {
66778         LDKUtxo this_ptr_conv;
66779         this_ptr_conv.inner = untag_ptr(this_ptr);
66780         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66782         this_ptr_conv.is_owned = false;
66783         Utxo_set_satisfaction_weight(&this_ptr_conv, val);
66784 }
66785
66786 uint64_t  __attribute__((export_name("TS_Utxo_new"))) TS_Utxo_new(uint64_t outpoint_arg, uint64_t output_arg, int64_t satisfaction_weight_arg) {
66787         LDKOutPoint outpoint_arg_conv;
66788         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
66789         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
66790         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
66791         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
66792         void* output_arg_ptr = untag_ptr(output_arg);
66793         CHECK_ACCESS(output_arg_ptr);
66794         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
66795         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
66796         LDKUtxo ret_var = Utxo_new(outpoint_arg_conv, output_arg_conv, satisfaction_weight_arg);
66797         uint64_t ret_ref = 0;
66798         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66799         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66800         return ret_ref;
66801 }
66802
66803 static inline uint64_t Utxo_clone_ptr(LDKUtxo *NONNULL_PTR arg) {
66804         LDKUtxo ret_var = Utxo_clone(arg);
66805         uint64_t ret_ref = 0;
66806         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66807         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66808         return ret_ref;
66809 }
66810 int64_t  __attribute__((export_name("TS_Utxo_clone_ptr"))) TS_Utxo_clone_ptr(uint64_t arg) {
66811         LDKUtxo arg_conv;
66812         arg_conv.inner = untag_ptr(arg);
66813         arg_conv.is_owned = ptr_is_owned(arg);
66814         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66815         arg_conv.is_owned = false;
66816         int64_t ret_conv = Utxo_clone_ptr(&arg_conv);
66817         return ret_conv;
66818 }
66819
66820 uint64_t  __attribute__((export_name("TS_Utxo_clone"))) TS_Utxo_clone(uint64_t orig) {
66821         LDKUtxo orig_conv;
66822         orig_conv.inner = untag_ptr(orig);
66823         orig_conv.is_owned = ptr_is_owned(orig);
66824         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66825         orig_conv.is_owned = false;
66826         LDKUtxo ret_var = Utxo_clone(&orig_conv);
66827         uint64_t ret_ref = 0;
66828         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66829         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66830         return ret_ref;
66831 }
66832
66833 int64_t  __attribute__((export_name("TS_Utxo_hash"))) TS_Utxo_hash(uint64_t o) {
66834         LDKUtxo o_conv;
66835         o_conv.inner = untag_ptr(o);
66836         o_conv.is_owned = ptr_is_owned(o);
66837         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
66838         o_conv.is_owned = false;
66839         int64_t ret_conv = Utxo_hash(&o_conv);
66840         return ret_conv;
66841 }
66842
66843 jboolean  __attribute__((export_name("TS_Utxo_eq"))) TS_Utxo_eq(uint64_t a, uint64_t b) {
66844         LDKUtxo a_conv;
66845         a_conv.inner = untag_ptr(a);
66846         a_conv.is_owned = ptr_is_owned(a);
66847         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66848         a_conv.is_owned = false;
66849         LDKUtxo b_conv;
66850         b_conv.inner = untag_ptr(b);
66851         b_conv.is_owned = ptr_is_owned(b);
66852         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
66853         b_conv.is_owned = false;
66854         jboolean ret_conv = Utxo_eq(&a_conv, &b_conv);
66855         return ret_conv;
66856 }
66857
66858 uint64_t  __attribute__((export_name("TS_Utxo_new_p2pkh"))) TS_Utxo_new_p2pkh(uint64_t outpoint, int64_t value, int8_tArray pubkey_hash) {
66859         LDKOutPoint outpoint_conv;
66860         outpoint_conv.inner = untag_ptr(outpoint);
66861         outpoint_conv.is_owned = ptr_is_owned(outpoint);
66862         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
66863         outpoint_conv = OutPoint_clone(&outpoint_conv);
66864         uint8_t pubkey_hash_arr[20];
66865         CHECK(pubkey_hash->arr_len == 20);
66866         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
66867         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
66868         LDKUtxo ret_var = Utxo_new_p2pkh(outpoint_conv, value, pubkey_hash_ref);
66869         uint64_t ret_ref = 0;
66870         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66871         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66872         return ret_ref;
66873 }
66874
66875 void  __attribute__((export_name("TS_CoinSelection_free"))) TS_CoinSelection_free(uint64_t this_obj) {
66876         LDKCoinSelection this_obj_conv;
66877         this_obj_conv.inner = untag_ptr(this_obj);
66878         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66880         CoinSelection_free(this_obj_conv);
66881 }
66882
66883 uint64_tArray  __attribute__((export_name("TS_CoinSelection_get_confirmed_utxos"))) TS_CoinSelection_get_confirmed_utxos(uint64_t this_ptr) {
66884         LDKCoinSelection this_ptr_conv;
66885         this_ptr_conv.inner = untag_ptr(this_ptr);
66886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66888         this_ptr_conv.is_owned = false;
66889         LDKCVec_UtxoZ ret_var = CoinSelection_get_confirmed_utxos(&this_ptr_conv);
66890         uint64_tArray ret_arr = NULL;
66891         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
66892         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
66893         for (size_t g = 0; g < ret_var.datalen; g++) {
66894                 LDKUtxo ret_conv_6_var = ret_var.data[g];
66895                 uint64_t ret_conv_6_ref = 0;
66896                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
66897                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
66898                 ret_arr_ptr[g] = ret_conv_6_ref;
66899         }
66900         
66901         FREE(ret_var.data);
66902         return ret_arr;
66903 }
66904
66905 void  __attribute__((export_name("TS_CoinSelection_set_confirmed_utxos"))) TS_CoinSelection_set_confirmed_utxos(uint64_t this_ptr, uint64_tArray val) {
66906         LDKCoinSelection this_ptr_conv;
66907         this_ptr_conv.inner = untag_ptr(this_ptr);
66908         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66910         this_ptr_conv.is_owned = false;
66911         LDKCVec_UtxoZ val_constr;
66912         val_constr.datalen = val->arr_len;
66913         if (val_constr.datalen > 0)
66914                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
66915         else
66916                 val_constr.data = NULL;
66917         uint64_t* val_vals = val->elems;
66918         for (size_t g = 0; g < val_constr.datalen; g++) {
66919                 uint64_t val_conv_6 = val_vals[g];
66920                 LDKUtxo val_conv_6_conv;
66921                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
66922                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
66923                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
66924                 val_conv_6_conv = Utxo_clone(&val_conv_6_conv);
66925                 val_constr.data[g] = val_conv_6_conv;
66926         }
66927         FREE(val);
66928         CoinSelection_set_confirmed_utxos(&this_ptr_conv, val_constr);
66929 }
66930
66931 uint64_t  __attribute__((export_name("TS_CoinSelection_get_change_output"))) TS_CoinSelection_get_change_output(uint64_t this_ptr) {
66932         LDKCoinSelection this_ptr_conv;
66933         this_ptr_conv.inner = untag_ptr(this_ptr);
66934         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66936         this_ptr_conv.is_owned = false;
66937         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
66938         *ret_copy = CoinSelection_get_change_output(&this_ptr_conv);
66939         uint64_t ret_ref = tag_ptr(ret_copy, true);
66940         return ret_ref;
66941 }
66942
66943 void  __attribute__((export_name("TS_CoinSelection_set_change_output"))) TS_CoinSelection_set_change_output(uint64_t this_ptr, uint64_t val) {
66944         LDKCoinSelection this_ptr_conv;
66945         this_ptr_conv.inner = untag_ptr(this_ptr);
66946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66948         this_ptr_conv.is_owned = false;
66949         void* val_ptr = untag_ptr(val);
66950         CHECK_ACCESS(val_ptr);
66951         LDKCOption_TxOutZ val_conv = *(LDKCOption_TxOutZ*)(val_ptr);
66952         val_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(val));
66953         CoinSelection_set_change_output(&this_ptr_conv, val_conv);
66954 }
66955
66956 uint64_t  __attribute__((export_name("TS_CoinSelection_new"))) TS_CoinSelection_new(uint64_tArray confirmed_utxos_arg, uint64_t change_output_arg) {
66957         LDKCVec_UtxoZ confirmed_utxos_arg_constr;
66958         confirmed_utxos_arg_constr.datalen = confirmed_utxos_arg->arr_len;
66959         if (confirmed_utxos_arg_constr.datalen > 0)
66960                 confirmed_utxos_arg_constr.data = MALLOC(confirmed_utxos_arg_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
66961         else
66962                 confirmed_utxos_arg_constr.data = NULL;
66963         uint64_t* confirmed_utxos_arg_vals = confirmed_utxos_arg->elems;
66964         for (size_t g = 0; g < confirmed_utxos_arg_constr.datalen; g++) {
66965                 uint64_t confirmed_utxos_arg_conv_6 = confirmed_utxos_arg_vals[g];
66966                 LDKUtxo confirmed_utxos_arg_conv_6_conv;
66967                 confirmed_utxos_arg_conv_6_conv.inner = untag_ptr(confirmed_utxos_arg_conv_6);
66968                 confirmed_utxos_arg_conv_6_conv.is_owned = ptr_is_owned(confirmed_utxos_arg_conv_6);
66969                 CHECK_INNER_FIELD_ACCESS_OR_NULL(confirmed_utxos_arg_conv_6_conv);
66970                 confirmed_utxos_arg_conv_6_conv = Utxo_clone(&confirmed_utxos_arg_conv_6_conv);
66971                 confirmed_utxos_arg_constr.data[g] = confirmed_utxos_arg_conv_6_conv;
66972         }
66973         FREE(confirmed_utxos_arg);
66974         void* change_output_arg_ptr = untag_ptr(change_output_arg);
66975         CHECK_ACCESS(change_output_arg_ptr);
66976         LDKCOption_TxOutZ change_output_arg_conv = *(LDKCOption_TxOutZ*)(change_output_arg_ptr);
66977         change_output_arg_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(change_output_arg));
66978         LDKCoinSelection ret_var = CoinSelection_new(confirmed_utxos_arg_constr, change_output_arg_conv);
66979         uint64_t ret_ref = 0;
66980         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66981         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66982         return ret_ref;
66983 }
66984
66985 static inline uint64_t CoinSelection_clone_ptr(LDKCoinSelection *NONNULL_PTR arg) {
66986         LDKCoinSelection ret_var = CoinSelection_clone(arg);
66987         uint64_t ret_ref = 0;
66988         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66989         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66990         return ret_ref;
66991 }
66992 int64_t  __attribute__((export_name("TS_CoinSelection_clone_ptr"))) TS_CoinSelection_clone_ptr(uint64_t arg) {
66993         LDKCoinSelection arg_conv;
66994         arg_conv.inner = untag_ptr(arg);
66995         arg_conv.is_owned = ptr_is_owned(arg);
66996         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66997         arg_conv.is_owned = false;
66998         int64_t ret_conv = CoinSelection_clone_ptr(&arg_conv);
66999         return ret_conv;
67000 }
67001
67002 uint64_t  __attribute__((export_name("TS_CoinSelection_clone"))) TS_CoinSelection_clone(uint64_t orig) {
67003         LDKCoinSelection orig_conv;
67004         orig_conv.inner = untag_ptr(orig);
67005         orig_conv.is_owned = ptr_is_owned(orig);
67006         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67007         orig_conv.is_owned = false;
67008         LDKCoinSelection ret_var = CoinSelection_clone(&orig_conv);
67009         uint64_t ret_ref = 0;
67010         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67011         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67012         return ret_ref;
67013 }
67014
67015 void  __attribute__((export_name("TS_CoinSelectionSource_free"))) TS_CoinSelectionSource_free(uint64_t this_ptr) {
67016         if (!ptr_is_owned(this_ptr)) return;
67017         void* this_ptr_ptr = untag_ptr(this_ptr);
67018         CHECK_ACCESS(this_ptr_ptr);
67019         LDKCoinSelectionSource this_ptr_conv = *(LDKCoinSelectionSource*)(this_ptr_ptr);
67020         FREE(untag_ptr(this_ptr));
67021         CoinSelectionSource_free(this_ptr_conv);
67022 }
67023
67024 void  __attribute__((export_name("TS_WalletSource_free"))) TS_WalletSource_free(uint64_t this_ptr) {
67025         if (!ptr_is_owned(this_ptr)) return;
67026         void* this_ptr_ptr = untag_ptr(this_ptr);
67027         CHECK_ACCESS(this_ptr_ptr);
67028         LDKWalletSource this_ptr_conv = *(LDKWalletSource*)(this_ptr_ptr);
67029         FREE(untag_ptr(this_ptr));
67030         WalletSource_free(this_ptr_conv);
67031 }
67032
67033 void  __attribute__((export_name("TS_Wallet_free"))) TS_Wallet_free(uint64_t this_obj) {
67034         LDKWallet this_obj_conv;
67035         this_obj_conv.inner = untag_ptr(this_obj);
67036         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67038         Wallet_free(this_obj_conv);
67039 }
67040
67041 uint64_t  __attribute__((export_name("TS_Wallet_new"))) TS_Wallet_new(uint64_t source, uint64_t logger) {
67042         void* source_ptr = untag_ptr(source);
67043         CHECK_ACCESS(source_ptr);
67044         LDKWalletSource source_conv = *(LDKWalletSource*)(source_ptr);
67045         if (source_conv.free == LDKWalletSource_JCalls_free) {
67046                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67047                 LDKWalletSource_JCalls_cloned(&source_conv);
67048         }
67049         void* logger_ptr = untag_ptr(logger);
67050         CHECK_ACCESS(logger_ptr);
67051         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
67052         if (logger_conv.free == LDKLogger_JCalls_free) {
67053                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67054                 LDKLogger_JCalls_cloned(&logger_conv);
67055         }
67056         LDKWallet ret_var = Wallet_new(source_conv, logger_conv);
67057         uint64_t ret_ref = 0;
67058         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67059         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67060         return ret_ref;
67061 }
67062
67063 uint64_t  __attribute__((export_name("TS_Wallet_as_CoinSelectionSource"))) TS_Wallet_as_CoinSelectionSource(uint64_t this_arg) {
67064         LDKWallet this_arg_conv;
67065         this_arg_conv.inner = untag_ptr(this_arg);
67066         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67068         this_arg_conv.is_owned = false;
67069         LDKCoinSelectionSource* ret_ret = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
67070         *ret_ret = Wallet_as_CoinSelectionSource(&this_arg_conv);
67071         return tag_ptr(ret_ret, true);
67072 }
67073
67074 void  __attribute__((export_name("TS_BumpTransactionEventHandler_free"))) TS_BumpTransactionEventHandler_free(uint64_t this_obj) {
67075         LDKBumpTransactionEventHandler this_obj_conv;
67076         this_obj_conv.inner = untag_ptr(this_obj);
67077         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67079         BumpTransactionEventHandler_free(this_obj_conv);
67080 }
67081
67082 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) {
67083         void* broadcaster_ptr = untag_ptr(broadcaster);
67084         CHECK_ACCESS(broadcaster_ptr);
67085         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
67086         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
67087                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67088                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
67089         }
67090         void* utxo_source_ptr = untag_ptr(utxo_source);
67091         CHECK_ACCESS(utxo_source_ptr);
67092         LDKCoinSelectionSource utxo_source_conv = *(LDKCoinSelectionSource*)(utxo_source_ptr);
67093         if (utxo_source_conv.free == LDKCoinSelectionSource_JCalls_free) {
67094                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67095                 LDKCoinSelectionSource_JCalls_cloned(&utxo_source_conv);
67096         }
67097         void* signer_provider_ptr = untag_ptr(signer_provider);
67098         CHECK_ACCESS(signer_provider_ptr);
67099         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
67100         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
67101                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67102                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
67103         }
67104         void* logger_ptr = untag_ptr(logger);
67105         CHECK_ACCESS(logger_ptr);
67106         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
67107         if (logger_conv.free == LDKLogger_JCalls_free) {
67108                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67109                 LDKLogger_JCalls_cloned(&logger_conv);
67110         }
67111         LDKBumpTransactionEventHandler ret_var = BumpTransactionEventHandler_new(broadcaster_conv, utxo_source_conv, signer_provider_conv, logger_conv);
67112         uint64_t ret_ref = 0;
67113         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67114         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67115         return ret_ref;
67116 }
67117
67118 void  __attribute__((export_name("TS_BumpTransactionEventHandler_handle_event"))) TS_BumpTransactionEventHandler_handle_event(uint64_t this_arg, uint64_t event) {
67119         LDKBumpTransactionEventHandler this_arg_conv;
67120         this_arg_conv.inner = untag_ptr(this_arg);
67121         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67123         this_arg_conv.is_owned = false;
67124         LDKBumpTransactionEvent* event_conv = (LDKBumpTransactionEvent*)untag_ptr(event);
67125         BumpTransactionEventHandler_handle_event(&this_arg_conv, event_conv);
67126 }
67127
67128 void  __attribute__((export_name("TS_GossipSync_free"))) TS_GossipSync_free(uint64_t this_ptr) {
67129         if (!ptr_is_owned(this_ptr)) return;
67130         void* this_ptr_ptr = untag_ptr(this_ptr);
67131         CHECK_ACCESS(this_ptr_ptr);
67132         LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
67133         FREE(untag_ptr(this_ptr));
67134         GossipSync_free(this_ptr_conv);
67135 }
67136
67137 uint64_t  __attribute__((export_name("TS_GossipSync_p2_p"))) TS_GossipSync_p2_p(uint64_t a) {
67138         LDKP2PGossipSync a_conv;
67139         a_conv.inner = untag_ptr(a);
67140         a_conv.is_owned = ptr_is_owned(a);
67141         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67142         a_conv.is_owned = false;
67143         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
67144         *ret_copy = GossipSync_p2_p(&a_conv);
67145         uint64_t ret_ref = tag_ptr(ret_copy, true);
67146         return ret_ref;
67147 }
67148
67149 uint64_t  __attribute__((export_name("TS_GossipSync_rapid"))) TS_GossipSync_rapid(uint64_t a) {
67150         LDKRapidGossipSync a_conv;
67151         a_conv.inner = untag_ptr(a);
67152         a_conv.is_owned = ptr_is_owned(a);
67153         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67154         a_conv.is_owned = false;
67155         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
67156         *ret_copy = GossipSync_rapid(&a_conv);
67157         uint64_t ret_ref = tag_ptr(ret_copy, true);
67158         return ret_ref;
67159 }
67160
67161 uint64_t  __attribute__((export_name("TS_GossipSync_none"))) TS_GossipSync_none() {
67162         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
67163         *ret_copy = GossipSync_none();
67164         uint64_t ret_ref = tag_ptr(ret_copy, true);
67165         return ret_ref;
67166 }
67167
67168 void  __attribute__((export_name("TS_RapidGossipSync_free"))) TS_RapidGossipSync_free(uint64_t this_obj) {
67169         LDKRapidGossipSync this_obj_conv;
67170         this_obj_conv.inner = untag_ptr(this_obj);
67171         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67173         RapidGossipSync_free(this_obj_conv);
67174 }
67175
67176 uint64_t  __attribute__((export_name("TS_RapidGossipSync_new"))) TS_RapidGossipSync_new(uint64_t network_graph, uint64_t logger) {
67177         LDKNetworkGraph network_graph_conv;
67178         network_graph_conv.inner = untag_ptr(network_graph);
67179         network_graph_conv.is_owned = ptr_is_owned(network_graph);
67180         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
67181         network_graph_conv.is_owned = false;
67182         void* logger_ptr = untag_ptr(logger);
67183         CHECK_ACCESS(logger_ptr);
67184         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
67185         if (logger_conv.free == LDKLogger_JCalls_free) {
67186                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67187                 LDKLogger_JCalls_cloned(&logger_conv);
67188         }
67189         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv, logger_conv);
67190         uint64_t ret_ref = 0;
67191         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67192         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67193         return ret_ref;
67194 }
67195
67196 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) {
67197         LDKRapidGossipSync this_arg_conv;
67198         this_arg_conv.inner = untag_ptr(this_arg);
67199         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67201         this_arg_conv.is_owned = false;
67202         LDKu8slice update_data_ref;
67203         update_data_ref.datalen = update_data->arr_len;
67204         update_data_ref.data = update_data->elems;
67205         void* current_time_unix_ptr = untag_ptr(current_time_unix);
67206         CHECK_ACCESS(current_time_unix_ptr);
67207         LDKCOption_u64Z current_time_unix_conv = *(LDKCOption_u64Z*)(current_time_unix_ptr);
67208         current_time_unix_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(current_time_unix));
67209         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
67210         *ret_conv = RapidGossipSync_update_network_graph_no_std(&this_arg_conv, update_data_ref, current_time_unix_conv);
67211         FREE(update_data);
67212         return tag_ptr(ret_conv, true);
67213 }
67214
67215 jboolean  __attribute__((export_name("TS_RapidGossipSync_is_initial_sync_complete"))) TS_RapidGossipSync_is_initial_sync_complete(uint64_t this_arg) {
67216         LDKRapidGossipSync this_arg_conv;
67217         this_arg_conv.inner = untag_ptr(this_arg);
67218         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67220         this_arg_conv.is_owned = false;
67221         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
67222         return ret_conv;
67223 }
67224
67225 void  __attribute__((export_name("TS_GraphSyncError_free"))) TS_GraphSyncError_free(uint64_t this_ptr) {
67226         if (!ptr_is_owned(this_ptr)) return;
67227         void* this_ptr_ptr = untag_ptr(this_ptr);
67228         CHECK_ACCESS(this_ptr_ptr);
67229         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
67230         FREE(untag_ptr(this_ptr));
67231         GraphSyncError_free(this_ptr_conv);
67232 }
67233
67234 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
67235         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
67236         *ret_copy = GraphSyncError_clone(arg);
67237         uint64_t ret_ref = tag_ptr(ret_copy, true);
67238         return ret_ref;
67239 }
67240 int64_t  __attribute__((export_name("TS_GraphSyncError_clone_ptr"))) TS_GraphSyncError_clone_ptr(uint64_t arg) {
67241         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
67242         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
67243         return ret_conv;
67244 }
67245
67246 uint64_t  __attribute__((export_name("TS_GraphSyncError_clone"))) TS_GraphSyncError_clone(uint64_t orig) {
67247         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
67248         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
67249         *ret_copy = GraphSyncError_clone(orig_conv);
67250         uint64_t ret_ref = tag_ptr(ret_copy, true);
67251         return ret_ref;
67252 }
67253
67254 uint64_t  __attribute__((export_name("TS_GraphSyncError_decode_error"))) TS_GraphSyncError_decode_error(uint64_t a) {
67255         void* a_ptr = untag_ptr(a);
67256         CHECK_ACCESS(a_ptr);
67257         LDKDecodeError a_conv = *(LDKDecodeError*)(a_ptr);
67258         a_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(a));
67259         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
67260         *ret_copy = GraphSyncError_decode_error(a_conv);
67261         uint64_t ret_ref = tag_ptr(ret_copy, true);
67262         return ret_ref;
67263 }
67264
67265 uint64_t  __attribute__((export_name("TS_GraphSyncError_lightning_error"))) TS_GraphSyncError_lightning_error(uint64_t a) {
67266         LDKLightningError a_conv;
67267         a_conv.inner = untag_ptr(a);
67268         a_conv.is_owned = ptr_is_owned(a);
67269         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67270         a_conv = LightningError_clone(&a_conv);
67271         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
67272         *ret_copy = GraphSyncError_lightning_error(a_conv);
67273         uint64_t ret_ref = tag_ptr(ret_copy, true);
67274         return ret_ref;
67275 }
67276
67277 void  __attribute__((export_name("TS_Bolt11ParseError_free"))) TS_Bolt11ParseError_free(uint64_t this_ptr) {
67278         if (!ptr_is_owned(this_ptr)) return;
67279         void* this_ptr_ptr = untag_ptr(this_ptr);
67280         CHECK_ACCESS(this_ptr_ptr);
67281         LDKBolt11ParseError this_ptr_conv = *(LDKBolt11ParseError*)(this_ptr_ptr);
67282         FREE(untag_ptr(this_ptr));
67283         Bolt11ParseError_free(this_ptr_conv);
67284 }
67285
67286 static inline uint64_t Bolt11ParseError_clone_ptr(LDKBolt11ParseError *NONNULL_PTR arg) {
67287         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67288         *ret_copy = Bolt11ParseError_clone(arg);
67289         uint64_t ret_ref = tag_ptr(ret_copy, true);
67290         return ret_ref;
67291 }
67292 int64_t  __attribute__((export_name("TS_Bolt11ParseError_clone_ptr"))) TS_Bolt11ParseError_clone_ptr(uint64_t arg) {
67293         LDKBolt11ParseError* arg_conv = (LDKBolt11ParseError*)untag_ptr(arg);
67294         int64_t ret_conv = Bolt11ParseError_clone_ptr(arg_conv);
67295         return ret_conv;
67296 }
67297
67298 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_clone"))) TS_Bolt11ParseError_clone(uint64_t orig) {
67299         LDKBolt11ParseError* orig_conv = (LDKBolt11ParseError*)untag_ptr(orig);
67300         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67301         *ret_copy = Bolt11ParseError_clone(orig_conv);
67302         uint64_t ret_ref = tag_ptr(ret_copy, true);
67303         return ret_ref;
67304 }
67305
67306 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_bech32_error"))) TS_Bolt11ParseError_bech32_error(uint64_t a) {
67307         void* a_ptr = untag_ptr(a);
67308         CHECK_ACCESS(a_ptr);
67309         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
67310         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
67311         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67312         *ret_copy = Bolt11ParseError_bech32_error(a_conv);
67313         uint64_t ret_ref = tag_ptr(ret_copy, true);
67314         return ret_ref;
67315 }
67316
67317 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_parse_amount_error"))) TS_Bolt11ParseError_parse_amount_error(int32_t a) {
67318         
67319         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67320         *ret_copy = Bolt11ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
67321         uint64_t ret_ref = tag_ptr(ret_copy, true);
67322         return ret_ref;
67323 }
67324
67325 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_malformed_signature"))) TS_Bolt11ParseError_malformed_signature(uint32_t a) {
67326         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
67327         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67328         *ret_copy = Bolt11ParseError_malformed_signature(a_conv);
67329         uint64_t ret_ref = tag_ptr(ret_copy, true);
67330         return ret_ref;
67331 }
67332
67333 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_bad_prefix"))) TS_Bolt11ParseError_bad_prefix() {
67334         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67335         *ret_copy = Bolt11ParseError_bad_prefix();
67336         uint64_t ret_ref = tag_ptr(ret_copy, true);
67337         return ret_ref;
67338 }
67339
67340 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_unknown_currency"))) TS_Bolt11ParseError_unknown_currency() {
67341         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67342         *ret_copy = Bolt11ParseError_unknown_currency();
67343         uint64_t ret_ref = tag_ptr(ret_copy, true);
67344         return ret_ref;
67345 }
67346
67347 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_unknown_si_prefix"))) TS_Bolt11ParseError_unknown_si_prefix() {
67348         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67349         *ret_copy = Bolt11ParseError_unknown_si_prefix();
67350         uint64_t ret_ref = tag_ptr(ret_copy, true);
67351         return ret_ref;
67352 }
67353
67354 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_malformed_hrp"))) TS_Bolt11ParseError_malformed_hrp() {
67355         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67356         *ret_copy = Bolt11ParseError_malformed_hrp();
67357         uint64_t ret_ref = tag_ptr(ret_copy, true);
67358         return ret_ref;
67359 }
67360
67361 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_too_short_data_part"))) TS_Bolt11ParseError_too_short_data_part() {
67362         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67363         *ret_copy = Bolt11ParseError_too_short_data_part();
67364         uint64_t ret_ref = tag_ptr(ret_copy, true);
67365         return ret_ref;
67366 }
67367
67368 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_unexpected_end_of_tagged_fields"))) TS_Bolt11ParseError_unexpected_end_of_tagged_fields() {
67369         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67370         *ret_copy = Bolt11ParseError_unexpected_end_of_tagged_fields();
67371         uint64_t ret_ref = tag_ptr(ret_copy, true);
67372         return ret_ref;
67373 }
67374
67375 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_description_decode_error"))) TS_Bolt11ParseError_description_decode_error(int32_t a) {
67376         
67377         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67378         *ret_copy = Bolt11ParseError_description_decode_error((LDKError){ ._dummy = 0 });
67379         uint64_t ret_ref = tag_ptr(ret_copy, true);
67380         return ret_ref;
67381 }
67382
67383 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_padding_error"))) TS_Bolt11ParseError_padding_error() {
67384         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67385         *ret_copy = Bolt11ParseError_padding_error();
67386         uint64_t ret_ref = tag_ptr(ret_copy, true);
67387         return ret_ref;
67388 }
67389
67390 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_integer_overflow_error"))) TS_Bolt11ParseError_integer_overflow_error() {
67391         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67392         *ret_copy = Bolt11ParseError_integer_overflow_error();
67393         uint64_t ret_ref = tag_ptr(ret_copy, true);
67394         return ret_ref;
67395 }
67396
67397 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_seg_wit_program_length"))) TS_Bolt11ParseError_invalid_seg_wit_program_length() {
67398         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67399         *ret_copy = Bolt11ParseError_invalid_seg_wit_program_length();
67400         uint64_t ret_ref = tag_ptr(ret_copy, true);
67401         return ret_ref;
67402 }
67403
67404 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_pub_key_hash_length"))) TS_Bolt11ParseError_invalid_pub_key_hash_length() {
67405         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67406         *ret_copy = Bolt11ParseError_invalid_pub_key_hash_length();
67407         uint64_t ret_ref = tag_ptr(ret_copy, true);
67408         return ret_ref;
67409 }
67410
67411 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_script_hash_length"))) TS_Bolt11ParseError_invalid_script_hash_length() {
67412         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67413         *ret_copy = Bolt11ParseError_invalid_script_hash_length();
67414         uint64_t ret_ref = tag_ptr(ret_copy, true);
67415         return ret_ref;
67416 }
67417
67418 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_recovery_id"))) TS_Bolt11ParseError_invalid_recovery_id() {
67419         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67420         *ret_copy = Bolt11ParseError_invalid_recovery_id();
67421         uint64_t ret_ref = tag_ptr(ret_copy, true);
67422         return ret_ref;
67423 }
67424
67425 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_slice_length"))) TS_Bolt11ParseError_invalid_slice_length(jstring a) {
67426         LDKStr a_conv = str_ref_to_owned_c(a);
67427         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67428         *ret_copy = Bolt11ParseError_invalid_slice_length(a_conv);
67429         uint64_t ret_ref = tag_ptr(ret_copy, true);
67430         return ret_ref;
67431 }
67432
67433 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_skip"))) TS_Bolt11ParseError_skip() {
67434         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67435         *ret_copy = Bolt11ParseError_skip();
67436         uint64_t ret_ref = tag_ptr(ret_copy, true);
67437         return ret_ref;
67438 }
67439
67440 jboolean  __attribute__((export_name("TS_Bolt11ParseError_eq"))) TS_Bolt11ParseError_eq(uint64_t a, uint64_t b) {
67441         LDKBolt11ParseError* a_conv = (LDKBolt11ParseError*)untag_ptr(a);
67442         LDKBolt11ParseError* b_conv = (LDKBolt11ParseError*)untag_ptr(b);
67443         jboolean ret_conv = Bolt11ParseError_eq(a_conv, b_conv);
67444         return ret_conv;
67445 }
67446
67447 void  __attribute__((export_name("TS_ParseOrSemanticError_free"))) TS_ParseOrSemanticError_free(uint64_t this_ptr) {
67448         if (!ptr_is_owned(this_ptr)) return;
67449         void* this_ptr_ptr = untag_ptr(this_ptr);
67450         CHECK_ACCESS(this_ptr_ptr);
67451         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
67452         FREE(untag_ptr(this_ptr));
67453         ParseOrSemanticError_free(this_ptr_conv);
67454 }
67455
67456 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
67457         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
67458         *ret_copy = ParseOrSemanticError_clone(arg);
67459         uint64_t ret_ref = tag_ptr(ret_copy, true);
67460         return ret_ref;
67461 }
67462 int64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone_ptr"))) TS_ParseOrSemanticError_clone_ptr(uint64_t arg) {
67463         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
67464         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
67465         return ret_conv;
67466 }
67467
67468 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone"))) TS_ParseOrSemanticError_clone(uint64_t orig) {
67469         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
67470         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
67471         *ret_copy = ParseOrSemanticError_clone(orig_conv);
67472         uint64_t ret_ref = tag_ptr(ret_copy, true);
67473         return ret_ref;
67474 }
67475
67476 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_parse_error"))) TS_ParseOrSemanticError_parse_error(uint64_t a) {
67477         void* a_ptr = untag_ptr(a);
67478         CHECK_ACCESS(a_ptr);
67479         LDKBolt11ParseError a_conv = *(LDKBolt11ParseError*)(a_ptr);
67480         a_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(a));
67481         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
67482         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
67483         uint64_t ret_ref = tag_ptr(ret_copy, true);
67484         return ret_ref;
67485 }
67486
67487 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_semantic_error"))) TS_ParseOrSemanticError_semantic_error(uint32_t a) {
67488         LDKBolt11SemanticError a_conv = LDKBolt11SemanticError_from_js(a);
67489         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
67490         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
67491         uint64_t ret_ref = tag_ptr(ret_copy, true);
67492         return ret_ref;
67493 }
67494
67495 jboolean  __attribute__((export_name("TS_ParseOrSemanticError_eq"))) TS_ParseOrSemanticError_eq(uint64_t a, uint64_t b) {
67496         LDKParseOrSemanticError* a_conv = (LDKParseOrSemanticError*)untag_ptr(a);
67497         LDKParseOrSemanticError* b_conv = (LDKParseOrSemanticError*)untag_ptr(b);
67498         jboolean ret_conv = ParseOrSemanticError_eq(a_conv, b_conv);
67499         return ret_conv;
67500 }
67501
67502 void  __attribute__((export_name("TS_Bolt11Invoice_free"))) TS_Bolt11Invoice_free(uint64_t this_obj) {
67503         LDKBolt11Invoice this_obj_conv;
67504         this_obj_conv.inner = untag_ptr(this_obj);
67505         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67507         Bolt11Invoice_free(this_obj_conv);
67508 }
67509
67510 jboolean  __attribute__((export_name("TS_Bolt11Invoice_eq"))) TS_Bolt11Invoice_eq(uint64_t a, uint64_t b) {
67511         LDKBolt11Invoice a_conv;
67512         a_conv.inner = untag_ptr(a);
67513         a_conv.is_owned = ptr_is_owned(a);
67514         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67515         a_conv.is_owned = false;
67516         LDKBolt11Invoice b_conv;
67517         b_conv.inner = untag_ptr(b);
67518         b_conv.is_owned = ptr_is_owned(b);
67519         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67520         b_conv.is_owned = false;
67521         jboolean ret_conv = Bolt11Invoice_eq(&a_conv, &b_conv);
67522         return ret_conv;
67523 }
67524
67525 static inline uint64_t Bolt11Invoice_clone_ptr(LDKBolt11Invoice *NONNULL_PTR arg) {
67526         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(arg);
67527         uint64_t ret_ref = 0;
67528         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67529         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67530         return ret_ref;
67531 }
67532 int64_t  __attribute__((export_name("TS_Bolt11Invoice_clone_ptr"))) TS_Bolt11Invoice_clone_ptr(uint64_t arg) {
67533         LDKBolt11Invoice arg_conv;
67534         arg_conv.inner = untag_ptr(arg);
67535         arg_conv.is_owned = ptr_is_owned(arg);
67536         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67537         arg_conv.is_owned = false;
67538         int64_t ret_conv = Bolt11Invoice_clone_ptr(&arg_conv);
67539         return ret_conv;
67540 }
67541
67542 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_clone"))) TS_Bolt11Invoice_clone(uint64_t orig) {
67543         LDKBolt11Invoice orig_conv;
67544         orig_conv.inner = untag_ptr(orig);
67545         orig_conv.is_owned = ptr_is_owned(orig);
67546         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67547         orig_conv.is_owned = false;
67548         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(&orig_conv);
67549         uint64_t ret_ref = 0;
67550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67552         return ret_ref;
67553 }
67554
67555 int64_t  __attribute__((export_name("TS_Bolt11Invoice_hash"))) TS_Bolt11Invoice_hash(uint64_t o) {
67556         LDKBolt11Invoice o_conv;
67557         o_conv.inner = untag_ptr(o);
67558         o_conv.is_owned = ptr_is_owned(o);
67559         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67560         o_conv.is_owned = false;
67561         int64_t ret_conv = Bolt11Invoice_hash(&o_conv);
67562         return ret_conv;
67563 }
67564
67565 void  __attribute__((export_name("TS_SignedRawBolt11Invoice_free"))) TS_SignedRawBolt11Invoice_free(uint64_t this_obj) {
67566         LDKSignedRawBolt11Invoice this_obj_conv;
67567         this_obj_conv.inner = untag_ptr(this_obj);
67568         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67570         SignedRawBolt11Invoice_free(this_obj_conv);
67571 }
67572
67573 jboolean  __attribute__((export_name("TS_SignedRawBolt11Invoice_eq"))) TS_SignedRawBolt11Invoice_eq(uint64_t a, uint64_t b) {
67574         LDKSignedRawBolt11Invoice a_conv;
67575         a_conv.inner = untag_ptr(a);
67576         a_conv.is_owned = ptr_is_owned(a);
67577         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67578         a_conv.is_owned = false;
67579         LDKSignedRawBolt11Invoice b_conv;
67580         b_conv.inner = untag_ptr(b);
67581         b_conv.is_owned = ptr_is_owned(b);
67582         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67583         b_conv.is_owned = false;
67584         jboolean ret_conv = SignedRawBolt11Invoice_eq(&a_conv, &b_conv);
67585         return ret_conv;
67586 }
67587
67588 static inline uint64_t SignedRawBolt11Invoice_clone_ptr(LDKSignedRawBolt11Invoice *NONNULL_PTR arg) {
67589         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(arg);
67590         uint64_t ret_ref = 0;
67591         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67592         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67593         return ret_ref;
67594 }
67595 int64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_clone_ptr"))) TS_SignedRawBolt11Invoice_clone_ptr(uint64_t arg) {
67596         LDKSignedRawBolt11Invoice arg_conv;
67597         arg_conv.inner = untag_ptr(arg);
67598         arg_conv.is_owned = ptr_is_owned(arg);
67599         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67600         arg_conv.is_owned = false;
67601         int64_t ret_conv = SignedRawBolt11Invoice_clone_ptr(&arg_conv);
67602         return ret_conv;
67603 }
67604
67605 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_clone"))) TS_SignedRawBolt11Invoice_clone(uint64_t orig) {
67606         LDKSignedRawBolt11Invoice orig_conv;
67607         orig_conv.inner = untag_ptr(orig);
67608         orig_conv.is_owned = ptr_is_owned(orig);
67609         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67610         orig_conv.is_owned = false;
67611         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(&orig_conv);
67612         uint64_t ret_ref = 0;
67613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67615         return ret_ref;
67616 }
67617
67618 int64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_hash"))) TS_SignedRawBolt11Invoice_hash(uint64_t o) {
67619         LDKSignedRawBolt11Invoice o_conv;
67620         o_conv.inner = untag_ptr(o);
67621         o_conv.is_owned = ptr_is_owned(o);
67622         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67623         o_conv.is_owned = false;
67624         int64_t ret_conv = SignedRawBolt11Invoice_hash(&o_conv);
67625         return ret_conv;
67626 }
67627
67628 void  __attribute__((export_name("TS_RawBolt11Invoice_free"))) TS_RawBolt11Invoice_free(uint64_t this_obj) {
67629         LDKRawBolt11Invoice this_obj_conv;
67630         this_obj_conv.inner = untag_ptr(this_obj);
67631         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67633         RawBolt11Invoice_free(this_obj_conv);
67634 }
67635
67636 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_get_data"))) TS_RawBolt11Invoice_get_data(uint64_t this_ptr) {
67637         LDKRawBolt11Invoice this_ptr_conv;
67638         this_ptr_conv.inner = untag_ptr(this_ptr);
67639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67641         this_ptr_conv.is_owned = false;
67642         LDKRawDataPart ret_var = RawBolt11Invoice_get_data(&this_ptr_conv);
67643         uint64_t ret_ref = 0;
67644         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67645         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67646         return ret_ref;
67647 }
67648
67649 void  __attribute__((export_name("TS_RawBolt11Invoice_set_data"))) TS_RawBolt11Invoice_set_data(uint64_t this_ptr, uint64_t val) {
67650         LDKRawBolt11Invoice this_ptr_conv;
67651         this_ptr_conv.inner = untag_ptr(this_ptr);
67652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67654         this_ptr_conv.is_owned = false;
67655         LDKRawDataPart val_conv;
67656         val_conv.inner = untag_ptr(val);
67657         val_conv.is_owned = ptr_is_owned(val);
67658         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67659         val_conv = RawDataPart_clone(&val_conv);
67660         RawBolt11Invoice_set_data(&this_ptr_conv, val_conv);
67661 }
67662
67663 jboolean  __attribute__((export_name("TS_RawBolt11Invoice_eq"))) TS_RawBolt11Invoice_eq(uint64_t a, uint64_t b) {
67664         LDKRawBolt11Invoice a_conv;
67665         a_conv.inner = untag_ptr(a);
67666         a_conv.is_owned = ptr_is_owned(a);
67667         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67668         a_conv.is_owned = false;
67669         LDKRawBolt11Invoice b_conv;
67670         b_conv.inner = untag_ptr(b);
67671         b_conv.is_owned = ptr_is_owned(b);
67672         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67673         b_conv.is_owned = false;
67674         jboolean ret_conv = RawBolt11Invoice_eq(&a_conv, &b_conv);
67675         return ret_conv;
67676 }
67677
67678 static inline uint64_t RawBolt11Invoice_clone_ptr(LDKRawBolt11Invoice *NONNULL_PTR arg) {
67679         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(arg);
67680         uint64_t ret_ref = 0;
67681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67683         return ret_ref;
67684 }
67685 int64_t  __attribute__((export_name("TS_RawBolt11Invoice_clone_ptr"))) TS_RawBolt11Invoice_clone_ptr(uint64_t arg) {
67686         LDKRawBolt11Invoice arg_conv;
67687         arg_conv.inner = untag_ptr(arg);
67688         arg_conv.is_owned = ptr_is_owned(arg);
67689         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67690         arg_conv.is_owned = false;
67691         int64_t ret_conv = RawBolt11Invoice_clone_ptr(&arg_conv);
67692         return ret_conv;
67693 }
67694
67695 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_clone"))) TS_RawBolt11Invoice_clone(uint64_t orig) {
67696         LDKRawBolt11Invoice orig_conv;
67697         orig_conv.inner = untag_ptr(orig);
67698         orig_conv.is_owned = ptr_is_owned(orig);
67699         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67700         orig_conv.is_owned = false;
67701         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(&orig_conv);
67702         uint64_t ret_ref = 0;
67703         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67704         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67705         return ret_ref;
67706 }
67707
67708 int64_t  __attribute__((export_name("TS_RawBolt11Invoice_hash"))) TS_RawBolt11Invoice_hash(uint64_t o) {
67709         LDKRawBolt11Invoice o_conv;
67710         o_conv.inner = untag_ptr(o);
67711         o_conv.is_owned = ptr_is_owned(o);
67712         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67713         o_conv.is_owned = false;
67714         int64_t ret_conv = RawBolt11Invoice_hash(&o_conv);
67715         return ret_conv;
67716 }
67717
67718 void  __attribute__((export_name("TS_RawDataPart_free"))) TS_RawDataPart_free(uint64_t this_obj) {
67719         LDKRawDataPart this_obj_conv;
67720         this_obj_conv.inner = untag_ptr(this_obj);
67721         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67723         RawDataPart_free(this_obj_conv);
67724 }
67725
67726 uint64_t  __attribute__((export_name("TS_RawDataPart_get_timestamp"))) TS_RawDataPart_get_timestamp(uint64_t this_ptr) {
67727         LDKRawDataPart this_ptr_conv;
67728         this_ptr_conv.inner = untag_ptr(this_ptr);
67729         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67731         this_ptr_conv.is_owned = false;
67732         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
67733         uint64_t ret_ref = 0;
67734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67736         return ret_ref;
67737 }
67738
67739 void  __attribute__((export_name("TS_RawDataPart_set_timestamp"))) TS_RawDataPart_set_timestamp(uint64_t this_ptr, uint64_t val) {
67740         LDKRawDataPart this_ptr_conv;
67741         this_ptr_conv.inner = untag_ptr(this_ptr);
67742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67744         this_ptr_conv.is_owned = false;
67745         LDKPositiveTimestamp val_conv;
67746         val_conv.inner = untag_ptr(val);
67747         val_conv.is_owned = ptr_is_owned(val);
67748         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67749         val_conv = PositiveTimestamp_clone(&val_conv);
67750         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
67751 }
67752
67753 jboolean  __attribute__((export_name("TS_RawDataPart_eq"))) TS_RawDataPart_eq(uint64_t a, uint64_t b) {
67754         LDKRawDataPart a_conv;
67755         a_conv.inner = untag_ptr(a);
67756         a_conv.is_owned = ptr_is_owned(a);
67757         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67758         a_conv.is_owned = false;
67759         LDKRawDataPart b_conv;
67760         b_conv.inner = untag_ptr(b);
67761         b_conv.is_owned = ptr_is_owned(b);
67762         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67763         b_conv.is_owned = false;
67764         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
67765         return ret_conv;
67766 }
67767
67768 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
67769         LDKRawDataPart ret_var = RawDataPart_clone(arg);
67770         uint64_t ret_ref = 0;
67771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67773         return ret_ref;
67774 }
67775 int64_t  __attribute__((export_name("TS_RawDataPart_clone_ptr"))) TS_RawDataPart_clone_ptr(uint64_t arg) {
67776         LDKRawDataPart arg_conv;
67777         arg_conv.inner = untag_ptr(arg);
67778         arg_conv.is_owned = ptr_is_owned(arg);
67779         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67780         arg_conv.is_owned = false;
67781         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
67782         return ret_conv;
67783 }
67784
67785 uint64_t  __attribute__((export_name("TS_RawDataPart_clone"))) TS_RawDataPart_clone(uint64_t orig) {
67786         LDKRawDataPart orig_conv;
67787         orig_conv.inner = untag_ptr(orig);
67788         orig_conv.is_owned = ptr_is_owned(orig);
67789         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67790         orig_conv.is_owned = false;
67791         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
67792         uint64_t ret_ref = 0;
67793         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67794         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67795         return ret_ref;
67796 }
67797
67798 int64_t  __attribute__((export_name("TS_RawDataPart_hash"))) TS_RawDataPart_hash(uint64_t o) {
67799         LDKRawDataPart o_conv;
67800         o_conv.inner = untag_ptr(o);
67801         o_conv.is_owned = ptr_is_owned(o);
67802         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67803         o_conv.is_owned = false;
67804         int64_t ret_conv = RawDataPart_hash(&o_conv);
67805         return ret_conv;
67806 }
67807
67808 void  __attribute__((export_name("TS_PositiveTimestamp_free"))) TS_PositiveTimestamp_free(uint64_t this_obj) {
67809         LDKPositiveTimestamp this_obj_conv;
67810         this_obj_conv.inner = untag_ptr(this_obj);
67811         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67813         PositiveTimestamp_free(this_obj_conv);
67814 }
67815
67816 jboolean  __attribute__((export_name("TS_PositiveTimestamp_eq"))) TS_PositiveTimestamp_eq(uint64_t a, uint64_t b) {
67817         LDKPositiveTimestamp a_conv;
67818         a_conv.inner = untag_ptr(a);
67819         a_conv.is_owned = ptr_is_owned(a);
67820         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67821         a_conv.is_owned = false;
67822         LDKPositiveTimestamp b_conv;
67823         b_conv.inner = untag_ptr(b);
67824         b_conv.is_owned = ptr_is_owned(b);
67825         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67826         b_conv.is_owned = false;
67827         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
67828         return ret_conv;
67829 }
67830
67831 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
67832         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
67833         uint64_t ret_ref = 0;
67834         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67835         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67836         return ret_ref;
67837 }
67838 int64_t  __attribute__((export_name("TS_PositiveTimestamp_clone_ptr"))) TS_PositiveTimestamp_clone_ptr(uint64_t arg) {
67839         LDKPositiveTimestamp arg_conv;
67840         arg_conv.inner = untag_ptr(arg);
67841         arg_conv.is_owned = ptr_is_owned(arg);
67842         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67843         arg_conv.is_owned = false;
67844         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
67845         return ret_conv;
67846 }
67847
67848 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_clone"))) TS_PositiveTimestamp_clone(uint64_t orig) {
67849         LDKPositiveTimestamp orig_conv;
67850         orig_conv.inner = untag_ptr(orig);
67851         orig_conv.is_owned = ptr_is_owned(orig);
67852         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67853         orig_conv.is_owned = false;
67854         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
67855         uint64_t ret_ref = 0;
67856         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67857         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67858         return ret_ref;
67859 }
67860
67861 int64_t  __attribute__((export_name("TS_PositiveTimestamp_hash"))) TS_PositiveTimestamp_hash(uint64_t o) {
67862         LDKPositiveTimestamp o_conv;
67863         o_conv.inner = untag_ptr(o);
67864         o_conv.is_owned = ptr_is_owned(o);
67865         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67866         o_conv.is_owned = false;
67867         int64_t ret_conv = PositiveTimestamp_hash(&o_conv);
67868         return ret_conv;
67869 }
67870
67871 uint32_t  __attribute__((export_name("TS_SiPrefix_clone"))) TS_SiPrefix_clone(uint64_t orig) {
67872         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
67873         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
67874         return ret_conv;
67875 }
67876
67877 uint32_t  __attribute__((export_name("TS_SiPrefix_milli"))) TS_SiPrefix_milli() {
67878         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
67879         return ret_conv;
67880 }
67881
67882 uint32_t  __attribute__((export_name("TS_SiPrefix_micro"))) TS_SiPrefix_micro() {
67883         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
67884         return ret_conv;
67885 }
67886
67887 uint32_t  __attribute__((export_name("TS_SiPrefix_nano"))) TS_SiPrefix_nano() {
67888         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
67889         return ret_conv;
67890 }
67891
67892 uint32_t  __attribute__((export_name("TS_SiPrefix_pico"))) TS_SiPrefix_pico() {
67893         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
67894         return ret_conv;
67895 }
67896
67897 jboolean  __attribute__((export_name("TS_SiPrefix_eq"))) TS_SiPrefix_eq(uint64_t a, uint64_t b) {
67898         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
67899         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
67900         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
67901         return ret_conv;
67902 }
67903
67904 int64_t  __attribute__((export_name("TS_SiPrefix_hash"))) TS_SiPrefix_hash(uint64_t o) {
67905         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
67906         int64_t ret_conv = SiPrefix_hash(o_conv);
67907         return ret_conv;
67908 }
67909
67910 int64_t  __attribute__((export_name("TS_SiPrefix_multiplier"))) TS_SiPrefix_multiplier(uint64_t this_arg) {
67911         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
67912         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
67913         return ret_conv;
67914 }
67915
67916 uint32_t  __attribute__((export_name("TS_Currency_clone"))) TS_Currency_clone(uint64_t orig) {
67917         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
67918         uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
67919         return ret_conv;
67920 }
67921
67922 uint32_t  __attribute__((export_name("TS_Currency_bitcoin"))) TS_Currency_bitcoin() {
67923         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
67924         return ret_conv;
67925 }
67926
67927 uint32_t  __attribute__((export_name("TS_Currency_bitcoin_testnet"))) TS_Currency_bitcoin_testnet() {
67928         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
67929         return ret_conv;
67930 }
67931
67932 uint32_t  __attribute__((export_name("TS_Currency_regtest"))) TS_Currency_regtest() {
67933         uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
67934         return ret_conv;
67935 }
67936
67937 uint32_t  __attribute__((export_name("TS_Currency_simnet"))) TS_Currency_simnet() {
67938         uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
67939         return ret_conv;
67940 }
67941
67942 uint32_t  __attribute__((export_name("TS_Currency_signet"))) TS_Currency_signet() {
67943         uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
67944         return ret_conv;
67945 }
67946
67947 int64_t  __attribute__((export_name("TS_Currency_hash"))) TS_Currency_hash(uint64_t o) {
67948         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
67949         int64_t ret_conv = Currency_hash(o_conv);
67950         return ret_conv;
67951 }
67952
67953 jboolean  __attribute__((export_name("TS_Currency_eq"))) TS_Currency_eq(uint64_t a, uint64_t b) {
67954         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
67955         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
67956         jboolean ret_conv = Currency_eq(a_conv, b_conv);
67957         return ret_conv;
67958 }
67959
67960 void  __attribute__((export_name("TS_Sha256_free"))) TS_Sha256_free(uint64_t this_obj) {
67961         LDKSha256 this_obj_conv;
67962         this_obj_conv.inner = untag_ptr(this_obj);
67963         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67965         Sha256_free(this_obj_conv);
67966 }
67967
67968 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
67969         LDKSha256 ret_var = Sha256_clone(arg);
67970         uint64_t ret_ref = 0;
67971         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67972         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67973         return ret_ref;
67974 }
67975 int64_t  __attribute__((export_name("TS_Sha256_clone_ptr"))) TS_Sha256_clone_ptr(uint64_t arg) {
67976         LDKSha256 arg_conv;
67977         arg_conv.inner = untag_ptr(arg);
67978         arg_conv.is_owned = ptr_is_owned(arg);
67979         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67980         arg_conv.is_owned = false;
67981         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
67982         return ret_conv;
67983 }
67984
67985 uint64_t  __attribute__((export_name("TS_Sha256_clone"))) TS_Sha256_clone(uint64_t orig) {
67986         LDKSha256 orig_conv;
67987         orig_conv.inner = untag_ptr(orig);
67988         orig_conv.is_owned = ptr_is_owned(orig);
67989         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67990         orig_conv.is_owned = false;
67991         LDKSha256 ret_var = Sha256_clone(&orig_conv);
67992         uint64_t ret_ref = 0;
67993         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67994         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67995         return ret_ref;
67996 }
67997
67998 int64_t  __attribute__((export_name("TS_Sha256_hash"))) TS_Sha256_hash(uint64_t o) {
67999         LDKSha256 o_conv;
68000         o_conv.inner = untag_ptr(o);
68001         o_conv.is_owned = ptr_is_owned(o);
68002         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68003         o_conv.is_owned = false;
68004         int64_t ret_conv = Sha256_hash(&o_conv);
68005         return ret_conv;
68006 }
68007
68008 jboolean  __attribute__((export_name("TS_Sha256_eq"))) TS_Sha256_eq(uint64_t a, uint64_t b) {
68009         LDKSha256 a_conv;
68010         a_conv.inner = untag_ptr(a);
68011         a_conv.is_owned = ptr_is_owned(a);
68012         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68013         a_conv.is_owned = false;
68014         LDKSha256 b_conv;
68015         b_conv.inner = untag_ptr(b);
68016         b_conv.is_owned = ptr_is_owned(b);
68017         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68018         b_conv.is_owned = false;
68019         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
68020         return ret_conv;
68021 }
68022
68023 uint64_t  __attribute__((export_name("TS_Sha256_from_bytes"))) TS_Sha256_from_bytes(int8_tArray bytes) {
68024         uint8_t bytes_arr[32];
68025         CHECK(bytes->arr_len == 32);
68026         memcpy(bytes_arr, bytes->elems, 32); FREE(bytes);
68027         uint8_t (*bytes_ref)[32] = &bytes_arr;
68028         LDKSha256 ret_var = Sha256_from_bytes(bytes_ref);
68029         uint64_t ret_ref = 0;
68030         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68031         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68032         return ret_ref;
68033 }
68034
68035 void  __attribute__((export_name("TS_Description_free"))) TS_Description_free(uint64_t this_obj) {
68036         LDKDescription this_obj_conv;
68037         this_obj_conv.inner = untag_ptr(this_obj);
68038         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68040         Description_free(this_obj_conv);
68041 }
68042
68043 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
68044         LDKDescription ret_var = Description_clone(arg);
68045         uint64_t ret_ref = 0;
68046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68048         return ret_ref;
68049 }
68050 int64_t  __attribute__((export_name("TS_Description_clone_ptr"))) TS_Description_clone_ptr(uint64_t arg) {
68051         LDKDescription arg_conv;
68052         arg_conv.inner = untag_ptr(arg);
68053         arg_conv.is_owned = ptr_is_owned(arg);
68054         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68055         arg_conv.is_owned = false;
68056         int64_t ret_conv = Description_clone_ptr(&arg_conv);
68057         return ret_conv;
68058 }
68059
68060 uint64_t  __attribute__((export_name("TS_Description_clone"))) TS_Description_clone(uint64_t orig) {
68061         LDKDescription orig_conv;
68062         orig_conv.inner = untag_ptr(orig);
68063         orig_conv.is_owned = ptr_is_owned(orig);
68064         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68065         orig_conv.is_owned = false;
68066         LDKDescription ret_var = Description_clone(&orig_conv);
68067         uint64_t ret_ref = 0;
68068         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68069         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68070         return ret_ref;
68071 }
68072
68073 int64_t  __attribute__((export_name("TS_Description_hash"))) TS_Description_hash(uint64_t o) {
68074         LDKDescription o_conv;
68075         o_conv.inner = untag_ptr(o);
68076         o_conv.is_owned = ptr_is_owned(o);
68077         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68078         o_conv.is_owned = false;
68079         int64_t ret_conv = Description_hash(&o_conv);
68080         return ret_conv;
68081 }
68082
68083 jboolean  __attribute__((export_name("TS_Description_eq"))) TS_Description_eq(uint64_t a, uint64_t b) {
68084         LDKDescription a_conv;
68085         a_conv.inner = untag_ptr(a);
68086         a_conv.is_owned = ptr_is_owned(a);
68087         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68088         a_conv.is_owned = false;
68089         LDKDescription b_conv;
68090         b_conv.inner = untag_ptr(b);
68091         b_conv.is_owned = ptr_is_owned(b);
68092         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68093         b_conv.is_owned = false;
68094         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
68095         return ret_conv;
68096 }
68097
68098 void  __attribute__((export_name("TS_PayeePubKey_free"))) TS_PayeePubKey_free(uint64_t this_obj) {
68099         LDKPayeePubKey this_obj_conv;
68100         this_obj_conv.inner = untag_ptr(this_obj);
68101         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68103         PayeePubKey_free(this_obj_conv);
68104 }
68105
68106 int8_tArray  __attribute__((export_name("TS_PayeePubKey_get_a"))) TS_PayeePubKey_get_a(uint64_t this_ptr) {
68107         LDKPayeePubKey this_ptr_conv;
68108         this_ptr_conv.inner = untag_ptr(this_ptr);
68109         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68111         this_ptr_conv.is_owned = false;
68112         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
68113         memcpy(ret_arr->elems, PayeePubKey_get_a(&this_ptr_conv).compressed_form, 33);
68114         return ret_arr;
68115 }
68116
68117 void  __attribute__((export_name("TS_PayeePubKey_set_a"))) TS_PayeePubKey_set_a(uint64_t this_ptr, int8_tArray val) {
68118         LDKPayeePubKey this_ptr_conv;
68119         this_ptr_conv.inner = untag_ptr(this_ptr);
68120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68122         this_ptr_conv.is_owned = false;
68123         LDKPublicKey val_ref;
68124         CHECK(val->arr_len == 33);
68125         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
68126         PayeePubKey_set_a(&this_ptr_conv, val_ref);
68127 }
68128
68129 uint64_t  __attribute__((export_name("TS_PayeePubKey_new"))) TS_PayeePubKey_new(int8_tArray a_arg) {
68130         LDKPublicKey a_arg_ref;
68131         CHECK(a_arg->arr_len == 33);
68132         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
68133         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
68134         uint64_t ret_ref = 0;
68135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68137         return ret_ref;
68138 }
68139
68140 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
68141         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
68142         uint64_t ret_ref = 0;
68143         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68144         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68145         return ret_ref;
68146 }
68147 int64_t  __attribute__((export_name("TS_PayeePubKey_clone_ptr"))) TS_PayeePubKey_clone_ptr(uint64_t arg) {
68148         LDKPayeePubKey arg_conv;
68149         arg_conv.inner = untag_ptr(arg);
68150         arg_conv.is_owned = ptr_is_owned(arg);
68151         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68152         arg_conv.is_owned = false;
68153         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
68154         return ret_conv;
68155 }
68156
68157 uint64_t  __attribute__((export_name("TS_PayeePubKey_clone"))) TS_PayeePubKey_clone(uint64_t orig) {
68158         LDKPayeePubKey orig_conv;
68159         orig_conv.inner = untag_ptr(orig);
68160         orig_conv.is_owned = ptr_is_owned(orig);
68161         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68162         orig_conv.is_owned = false;
68163         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
68164         uint64_t ret_ref = 0;
68165         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68166         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68167         return ret_ref;
68168 }
68169
68170 int64_t  __attribute__((export_name("TS_PayeePubKey_hash"))) TS_PayeePubKey_hash(uint64_t o) {
68171         LDKPayeePubKey o_conv;
68172         o_conv.inner = untag_ptr(o);
68173         o_conv.is_owned = ptr_is_owned(o);
68174         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68175         o_conv.is_owned = false;
68176         int64_t ret_conv = PayeePubKey_hash(&o_conv);
68177         return ret_conv;
68178 }
68179
68180 jboolean  __attribute__((export_name("TS_PayeePubKey_eq"))) TS_PayeePubKey_eq(uint64_t a, uint64_t b) {
68181         LDKPayeePubKey a_conv;
68182         a_conv.inner = untag_ptr(a);
68183         a_conv.is_owned = ptr_is_owned(a);
68184         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68185         a_conv.is_owned = false;
68186         LDKPayeePubKey b_conv;
68187         b_conv.inner = untag_ptr(b);
68188         b_conv.is_owned = ptr_is_owned(b);
68189         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68190         b_conv.is_owned = false;
68191         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
68192         return ret_conv;
68193 }
68194
68195 void  __attribute__((export_name("TS_ExpiryTime_free"))) TS_ExpiryTime_free(uint64_t this_obj) {
68196         LDKExpiryTime this_obj_conv;
68197         this_obj_conv.inner = untag_ptr(this_obj);
68198         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68200         ExpiryTime_free(this_obj_conv);
68201 }
68202
68203 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
68204         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
68205         uint64_t ret_ref = 0;
68206         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68207         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68208         return ret_ref;
68209 }
68210 int64_t  __attribute__((export_name("TS_ExpiryTime_clone_ptr"))) TS_ExpiryTime_clone_ptr(uint64_t arg) {
68211         LDKExpiryTime arg_conv;
68212         arg_conv.inner = untag_ptr(arg);
68213         arg_conv.is_owned = ptr_is_owned(arg);
68214         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68215         arg_conv.is_owned = false;
68216         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
68217         return ret_conv;
68218 }
68219
68220 uint64_t  __attribute__((export_name("TS_ExpiryTime_clone"))) TS_ExpiryTime_clone(uint64_t orig) {
68221         LDKExpiryTime orig_conv;
68222         orig_conv.inner = untag_ptr(orig);
68223         orig_conv.is_owned = ptr_is_owned(orig);
68224         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68225         orig_conv.is_owned = false;
68226         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
68227         uint64_t ret_ref = 0;
68228         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68229         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68230         return ret_ref;
68231 }
68232
68233 int64_t  __attribute__((export_name("TS_ExpiryTime_hash"))) TS_ExpiryTime_hash(uint64_t o) {
68234         LDKExpiryTime o_conv;
68235         o_conv.inner = untag_ptr(o);
68236         o_conv.is_owned = ptr_is_owned(o);
68237         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68238         o_conv.is_owned = false;
68239         int64_t ret_conv = ExpiryTime_hash(&o_conv);
68240         return ret_conv;
68241 }
68242
68243 jboolean  __attribute__((export_name("TS_ExpiryTime_eq"))) TS_ExpiryTime_eq(uint64_t a, uint64_t b) {
68244         LDKExpiryTime a_conv;
68245         a_conv.inner = untag_ptr(a);
68246         a_conv.is_owned = ptr_is_owned(a);
68247         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68248         a_conv.is_owned = false;
68249         LDKExpiryTime b_conv;
68250         b_conv.inner = untag_ptr(b);
68251         b_conv.is_owned = ptr_is_owned(b);
68252         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68253         b_conv.is_owned = false;
68254         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
68255         return ret_conv;
68256 }
68257
68258 void  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_free"))) TS_MinFinalCltvExpiryDelta_free(uint64_t this_obj) {
68259         LDKMinFinalCltvExpiryDelta this_obj_conv;
68260         this_obj_conv.inner = untag_ptr(this_obj);
68261         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68263         MinFinalCltvExpiryDelta_free(this_obj_conv);
68264 }
68265
68266 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_get_a"))) TS_MinFinalCltvExpiryDelta_get_a(uint64_t this_ptr) {
68267         LDKMinFinalCltvExpiryDelta this_ptr_conv;
68268         this_ptr_conv.inner = untag_ptr(this_ptr);
68269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68271         this_ptr_conv.is_owned = false;
68272         int64_t ret_conv = MinFinalCltvExpiryDelta_get_a(&this_ptr_conv);
68273         return ret_conv;
68274 }
68275
68276 void  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_set_a"))) TS_MinFinalCltvExpiryDelta_set_a(uint64_t this_ptr, int64_t val) {
68277         LDKMinFinalCltvExpiryDelta this_ptr_conv;
68278         this_ptr_conv.inner = untag_ptr(this_ptr);
68279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68281         this_ptr_conv.is_owned = false;
68282         MinFinalCltvExpiryDelta_set_a(&this_ptr_conv, val);
68283 }
68284
68285 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_new"))) TS_MinFinalCltvExpiryDelta_new(int64_t a_arg) {
68286         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_new(a_arg);
68287         uint64_t ret_ref = 0;
68288         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68289         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68290         return ret_ref;
68291 }
68292
68293 static inline uint64_t MinFinalCltvExpiryDelta_clone_ptr(LDKMinFinalCltvExpiryDelta *NONNULL_PTR arg) {
68294         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(arg);
68295         uint64_t ret_ref = 0;
68296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68297         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68298         return ret_ref;
68299 }
68300 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_clone_ptr"))) TS_MinFinalCltvExpiryDelta_clone_ptr(uint64_t arg) {
68301         LDKMinFinalCltvExpiryDelta arg_conv;
68302         arg_conv.inner = untag_ptr(arg);
68303         arg_conv.is_owned = ptr_is_owned(arg);
68304         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68305         arg_conv.is_owned = false;
68306         int64_t ret_conv = MinFinalCltvExpiryDelta_clone_ptr(&arg_conv);
68307         return ret_conv;
68308 }
68309
68310 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_clone"))) TS_MinFinalCltvExpiryDelta_clone(uint64_t orig) {
68311         LDKMinFinalCltvExpiryDelta orig_conv;
68312         orig_conv.inner = untag_ptr(orig);
68313         orig_conv.is_owned = ptr_is_owned(orig);
68314         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68315         orig_conv.is_owned = false;
68316         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(&orig_conv);
68317         uint64_t ret_ref = 0;
68318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68320         return ret_ref;
68321 }
68322
68323 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_hash"))) TS_MinFinalCltvExpiryDelta_hash(uint64_t o) {
68324         LDKMinFinalCltvExpiryDelta o_conv;
68325         o_conv.inner = untag_ptr(o);
68326         o_conv.is_owned = ptr_is_owned(o);
68327         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68328         o_conv.is_owned = false;
68329         int64_t ret_conv = MinFinalCltvExpiryDelta_hash(&o_conv);
68330         return ret_conv;
68331 }
68332
68333 jboolean  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_eq"))) TS_MinFinalCltvExpiryDelta_eq(uint64_t a, uint64_t b) {
68334         LDKMinFinalCltvExpiryDelta a_conv;
68335         a_conv.inner = untag_ptr(a);
68336         a_conv.is_owned = ptr_is_owned(a);
68337         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68338         a_conv.is_owned = false;
68339         LDKMinFinalCltvExpiryDelta b_conv;
68340         b_conv.inner = untag_ptr(b);
68341         b_conv.is_owned = ptr_is_owned(b);
68342         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68343         b_conv.is_owned = false;
68344         jboolean ret_conv = MinFinalCltvExpiryDelta_eq(&a_conv, &b_conv);
68345         return ret_conv;
68346 }
68347
68348 void  __attribute__((export_name("TS_Fallback_free"))) TS_Fallback_free(uint64_t this_ptr) {
68349         if (!ptr_is_owned(this_ptr)) return;
68350         void* this_ptr_ptr = untag_ptr(this_ptr);
68351         CHECK_ACCESS(this_ptr_ptr);
68352         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
68353         FREE(untag_ptr(this_ptr));
68354         Fallback_free(this_ptr_conv);
68355 }
68356
68357 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
68358         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
68359         *ret_copy = Fallback_clone(arg);
68360         uint64_t ret_ref = tag_ptr(ret_copy, true);
68361         return ret_ref;
68362 }
68363 int64_t  __attribute__((export_name("TS_Fallback_clone_ptr"))) TS_Fallback_clone_ptr(uint64_t arg) {
68364         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
68365         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
68366         return ret_conv;
68367 }
68368
68369 uint64_t  __attribute__((export_name("TS_Fallback_clone"))) TS_Fallback_clone(uint64_t orig) {
68370         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
68371         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
68372         *ret_copy = Fallback_clone(orig_conv);
68373         uint64_t ret_ref = tag_ptr(ret_copy, true);
68374         return ret_ref;
68375 }
68376
68377 uint64_t  __attribute__((export_name("TS_Fallback_seg_wit_program"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
68378         
68379         LDKCVec_u8Z program_ref;
68380         program_ref.datalen = program->arr_len;
68381         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
68382         memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
68383         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
68384         *ret_copy = Fallback_seg_wit_program((LDKWitnessVersion){ ._0 = version }, program_ref);
68385         uint64_t ret_ref = tag_ptr(ret_copy, true);
68386         return ret_ref;
68387 }
68388
68389 uint64_t  __attribute__((export_name("TS_Fallback_pub_key_hash"))) TS_Fallback_pub_key_hash(int8_tArray a) {
68390         LDKTwentyBytes a_ref;
68391         CHECK(a->arr_len == 20);
68392         memcpy(a_ref.data, a->elems, 20); FREE(a);
68393         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
68394         *ret_copy = Fallback_pub_key_hash(a_ref);
68395         uint64_t ret_ref = tag_ptr(ret_copy, true);
68396         return ret_ref;
68397 }
68398
68399 uint64_t  __attribute__((export_name("TS_Fallback_script_hash"))) TS_Fallback_script_hash(int8_tArray a) {
68400         LDKTwentyBytes a_ref;
68401         CHECK(a->arr_len == 20);
68402         memcpy(a_ref.data, a->elems, 20); FREE(a);
68403         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
68404         *ret_copy = Fallback_script_hash(a_ref);
68405         uint64_t ret_ref = tag_ptr(ret_copy, true);
68406         return ret_ref;
68407 }
68408
68409 int64_t  __attribute__((export_name("TS_Fallback_hash"))) TS_Fallback_hash(uint64_t o) {
68410         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
68411         int64_t ret_conv = Fallback_hash(o_conv);
68412         return ret_conv;
68413 }
68414
68415 jboolean  __attribute__((export_name("TS_Fallback_eq"))) TS_Fallback_eq(uint64_t a, uint64_t b) {
68416         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
68417         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
68418         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
68419         return ret_conv;
68420 }
68421
68422 void  __attribute__((export_name("TS_Bolt11InvoiceSignature_free"))) TS_Bolt11InvoiceSignature_free(uint64_t this_obj) {
68423         LDKBolt11InvoiceSignature this_obj_conv;
68424         this_obj_conv.inner = untag_ptr(this_obj);
68425         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68427         Bolt11InvoiceSignature_free(this_obj_conv);
68428 }
68429
68430 static inline uint64_t Bolt11InvoiceSignature_clone_ptr(LDKBolt11InvoiceSignature *NONNULL_PTR arg) {
68431         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(arg);
68432         uint64_t ret_ref = 0;
68433         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68434         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68435         return ret_ref;
68436 }
68437 int64_t  __attribute__((export_name("TS_Bolt11InvoiceSignature_clone_ptr"))) TS_Bolt11InvoiceSignature_clone_ptr(uint64_t arg) {
68438         LDKBolt11InvoiceSignature arg_conv;
68439         arg_conv.inner = untag_ptr(arg);
68440         arg_conv.is_owned = ptr_is_owned(arg);
68441         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68442         arg_conv.is_owned = false;
68443         int64_t ret_conv = Bolt11InvoiceSignature_clone_ptr(&arg_conv);
68444         return ret_conv;
68445 }
68446
68447 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceSignature_clone"))) TS_Bolt11InvoiceSignature_clone(uint64_t orig) {
68448         LDKBolt11InvoiceSignature orig_conv;
68449         orig_conv.inner = untag_ptr(orig);
68450         orig_conv.is_owned = ptr_is_owned(orig);
68451         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68452         orig_conv.is_owned = false;
68453         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(&orig_conv);
68454         uint64_t ret_ref = 0;
68455         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68456         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68457         return ret_ref;
68458 }
68459
68460 int64_t  __attribute__((export_name("TS_Bolt11InvoiceSignature_hash"))) TS_Bolt11InvoiceSignature_hash(uint64_t o) {
68461         LDKBolt11InvoiceSignature o_conv;
68462         o_conv.inner = untag_ptr(o);
68463         o_conv.is_owned = ptr_is_owned(o);
68464         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68465         o_conv.is_owned = false;
68466         int64_t ret_conv = Bolt11InvoiceSignature_hash(&o_conv);
68467         return ret_conv;
68468 }
68469
68470 jboolean  __attribute__((export_name("TS_Bolt11InvoiceSignature_eq"))) TS_Bolt11InvoiceSignature_eq(uint64_t a, uint64_t b) {
68471         LDKBolt11InvoiceSignature a_conv;
68472         a_conv.inner = untag_ptr(a);
68473         a_conv.is_owned = ptr_is_owned(a);
68474         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68475         a_conv.is_owned = false;
68476         LDKBolt11InvoiceSignature b_conv;
68477         b_conv.inner = untag_ptr(b);
68478         b_conv.is_owned = ptr_is_owned(b);
68479         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68480         b_conv.is_owned = false;
68481         jboolean ret_conv = Bolt11InvoiceSignature_eq(&a_conv, &b_conv);
68482         return ret_conv;
68483 }
68484
68485 void  __attribute__((export_name("TS_PrivateRoute_free"))) TS_PrivateRoute_free(uint64_t this_obj) {
68486         LDKPrivateRoute this_obj_conv;
68487         this_obj_conv.inner = untag_ptr(this_obj);
68488         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68490         PrivateRoute_free(this_obj_conv);
68491 }
68492
68493 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
68494         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
68495         uint64_t ret_ref = 0;
68496         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68497         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68498         return ret_ref;
68499 }
68500 int64_t  __attribute__((export_name("TS_PrivateRoute_clone_ptr"))) TS_PrivateRoute_clone_ptr(uint64_t arg) {
68501         LDKPrivateRoute arg_conv;
68502         arg_conv.inner = untag_ptr(arg);
68503         arg_conv.is_owned = ptr_is_owned(arg);
68504         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68505         arg_conv.is_owned = false;
68506         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
68507         return ret_conv;
68508 }
68509
68510 uint64_t  __attribute__((export_name("TS_PrivateRoute_clone"))) TS_PrivateRoute_clone(uint64_t orig) {
68511         LDKPrivateRoute orig_conv;
68512         orig_conv.inner = untag_ptr(orig);
68513         orig_conv.is_owned = ptr_is_owned(orig);
68514         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68515         orig_conv.is_owned = false;
68516         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
68517         uint64_t ret_ref = 0;
68518         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68519         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68520         return ret_ref;
68521 }
68522
68523 int64_t  __attribute__((export_name("TS_PrivateRoute_hash"))) TS_PrivateRoute_hash(uint64_t o) {
68524         LDKPrivateRoute o_conv;
68525         o_conv.inner = untag_ptr(o);
68526         o_conv.is_owned = ptr_is_owned(o);
68527         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68528         o_conv.is_owned = false;
68529         int64_t ret_conv = PrivateRoute_hash(&o_conv);
68530         return ret_conv;
68531 }
68532
68533 jboolean  __attribute__((export_name("TS_PrivateRoute_eq"))) TS_PrivateRoute_eq(uint64_t a, uint64_t b) {
68534         LDKPrivateRoute a_conv;
68535         a_conv.inner = untag_ptr(a);
68536         a_conv.is_owned = ptr_is_owned(a);
68537         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68538         a_conv.is_owned = false;
68539         LDKPrivateRoute b_conv;
68540         b_conv.inner = untag_ptr(b);
68541         b_conv.is_owned = ptr_is_owned(b);
68542         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68543         b_conv.is_owned = false;
68544         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
68545         return ret_conv;
68546 }
68547
68548 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_into_parts"))) TS_SignedRawBolt11Invoice_into_parts(uint64_t this_arg) {
68549         LDKSignedRawBolt11Invoice this_arg_conv;
68550         this_arg_conv.inner = untag_ptr(this_arg);
68551         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68553         this_arg_conv = SignedRawBolt11Invoice_clone(&this_arg_conv);
68554         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
68555         *ret_conv = SignedRawBolt11Invoice_into_parts(this_arg_conv);
68556         return tag_ptr(ret_conv, true);
68557 }
68558
68559 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_raw_invoice"))) TS_SignedRawBolt11Invoice_raw_invoice(uint64_t this_arg) {
68560         LDKSignedRawBolt11Invoice this_arg_conv;
68561         this_arg_conv.inner = untag_ptr(this_arg);
68562         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68564         this_arg_conv.is_owned = false;
68565         LDKRawBolt11Invoice ret_var = SignedRawBolt11Invoice_raw_invoice(&this_arg_conv);
68566         uint64_t ret_ref = 0;
68567         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68568         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68569         return ret_ref;
68570 }
68571
68572 int8_tArray  __attribute__((export_name("TS_SignedRawBolt11Invoice_signable_hash"))) TS_SignedRawBolt11Invoice_signable_hash(uint64_t this_arg) {
68573         LDKSignedRawBolt11Invoice this_arg_conv;
68574         this_arg_conv.inner = untag_ptr(this_arg);
68575         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68577         this_arg_conv.is_owned = false;
68578         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
68579         memcpy(ret_arr->elems, *SignedRawBolt11Invoice_signable_hash(&this_arg_conv), 32);
68580         return ret_arr;
68581 }
68582
68583 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_signature"))) TS_SignedRawBolt11Invoice_signature(uint64_t this_arg) {
68584         LDKSignedRawBolt11Invoice this_arg_conv;
68585         this_arg_conv.inner = untag_ptr(this_arg);
68586         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68588         this_arg_conv.is_owned = false;
68589         LDKBolt11InvoiceSignature ret_var = SignedRawBolt11Invoice_signature(&this_arg_conv);
68590         uint64_t ret_ref = 0;
68591         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68592         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68593         return ret_ref;
68594 }
68595
68596 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_recover_payee_pub_key"))) TS_SignedRawBolt11Invoice_recover_payee_pub_key(uint64_t this_arg) {
68597         LDKSignedRawBolt11Invoice this_arg_conv;
68598         this_arg_conv.inner = untag_ptr(this_arg);
68599         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68601         this_arg_conv.is_owned = false;
68602         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
68603         *ret_conv = SignedRawBolt11Invoice_recover_payee_pub_key(&this_arg_conv);
68604         return tag_ptr(ret_conv, true);
68605 }
68606
68607 jboolean  __attribute__((export_name("TS_SignedRawBolt11Invoice_check_signature"))) TS_SignedRawBolt11Invoice_check_signature(uint64_t this_arg) {
68608         LDKSignedRawBolt11Invoice this_arg_conv;
68609         this_arg_conv.inner = untag_ptr(this_arg);
68610         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68612         this_arg_conv.is_owned = false;
68613         jboolean ret_conv = SignedRawBolt11Invoice_check_signature(&this_arg_conv);
68614         return ret_conv;
68615 }
68616
68617 int8_tArray  __attribute__((export_name("TS_RawBolt11Invoice_signable_hash"))) TS_RawBolt11Invoice_signable_hash(uint64_t this_arg) {
68618         LDKRawBolt11Invoice this_arg_conv;
68619         this_arg_conv.inner = untag_ptr(this_arg);
68620         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68622         this_arg_conv.is_owned = false;
68623         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
68624         memcpy(ret_arr->elems, RawBolt11Invoice_signable_hash(&this_arg_conv).data, 32);
68625         return ret_arr;
68626 }
68627
68628 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payment_hash"))) TS_RawBolt11Invoice_payment_hash(uint64_t this_arg) {
68629         LDKRawBolt11Invoice this_arg_conv;
68630         this_arg_conv.inner = untag_ptr(this_arg);
68631         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68633         this_arg_conv.is_owned = false;
68634         LDKSha256 ret_var = RawBolt11Invoice_payment_hash(&this_arg_conv);
68635         uint64_t ret_ref = 0;
68636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68638         return ret_ref;
68639 }
68640
68641 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_description"))) TS_RawBolt11Invoice_description(uint64_t this_arg) {
68642         LDKRawBolt11Invoice this_arg_conv;
68643         this_arg_conv.inner = untag_ptr(this_arg);
68644         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68646         this_arg_conv.is_owned = false;
68647         LDKDescription ret_var = RawBolt11Invoice_description(&this_arg_conv);
68648         uint64_t ret_ref = 0;
68649         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68650         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68651         return ret_ref;
68652 }
68653
68654 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payee_pub_key"))) TS_RawBolt11Invoice_payee_pub_key(uint64_t this_arg) {
68655         LDKRawBolt11Invoice this_arg_conv;
68656         this_arg_conv.inner = untag_ptr(this_arg);
68657         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68659         this_arg_conv.is_owned = false;
68660         LDKPayeePubKey ret_var = RawBolt11Invoice_payee_pub_key(&this_arg_conv);
68661         uint64_t ret_ref = 0;
68662         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68663         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68664         return ret_ref;
68665 }
68666
68667 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_description_hash"))) TS_RawBolt11Invoice_description_hash(uint64_t this_arg) {
68668         LDKRawBolt11Invoice this_arg_conv;
68669         this_arg_conv.inner = untag_ptr(this_arg);
68670         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68672         this_arg_conv.is_owned = false;
68673         LDKSha256 ret_var = RawBolt11Invoice_description_hash(&this_arg_conv);
68674         uint64_t ret_ref = 0;
68675         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68676         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68677         return ret_ref;
68678 }
68679
68680 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_expiry_time"))) TS_RawBolt11Invoice_expiry_time(uint64_t this_arg) {
68681         LDKRawBolt11Invoice this_arg_conv;
68682         this_arg_conv.inner = untag_ptr(this_arg);
68683         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68685         this_arg_conv.is_owned = false;
68686         LDKExpiryTime ret_var = RawBolt11Invoice_expiry_time(&this_arg_conv);
68687         uint64_t ret_ref = 0;
68688         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68689         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68690         return ret_ref;
68691 }
68692
68693 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_min_final_cltv_expiry_delta"))) TS_RawBolt11Invoice_min_final_cltv_expiry_delta(uint64_t this_arg) {
68694         LDKRawBolt11Invoice this_arg_conv;
68695         this_arg_conv.inner = untag_ptr(this_arg);
68696         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68698         this_arg_conv.is_owned = false;
68699         LDKMinFinalCltvExpiryDelta ret_var = RawBolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
68700         uint64_t ret_ref = 0;
68701         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68702         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68703         return ret_ref;
68704 }
68705
68706 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payment_secret"))) TS_RawBolt11Invoice_payment_secret(uint64_t this_arg) {
68707         LDKRawBolt11Invoice this_arg_conv;
68708         this_arg_conv.inner = untag_ptr(this_arg);
68709         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68711         this_arg_conv.is_owned = false;
68712         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
68713         *ret_copy = RawBolt11Invoice_payment_secret(&this_arg_conv);
68714         uint64_t ret_ref = tag_ptr(ret_copy, true);
68715         return ret_ref;
68716 }
68717
68718 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payment_metadata"))) TS_RawBolt11Invoice_payment_metadata(uint64_t this_arg) {
68719         LDKRawBolt11Invoice this_arg_conv;
68720         this_arg_conv.inner = untag_ptr(this_arg);
68721         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68723         this_arg_conv.is_owned = false;
68724         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
68725         *ret_copy = RawBolt11Invoice_payment_metadata(&this_arg_conv);
68726         uint64_t ret_ref = tag_ptr(ret_copy, true);
68727         return ret_ref;
68728 }
68729
68730 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_features"))) TS_RawBolt11Invoice_features(uint64_t this_arg) {
68731         LDKRawBolt11Invoice this_arg_conv;
68732         this_arg_conv.inner = untag_ptr(this_arg);
68733         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68735         this_arg_conv.is_owned = false;
68736         LDKBolt11InvoiceFeatures ret_var = RawBolt11Invoice_features(&this_arg_conv);
68737         uint64_t ret_ref = 0;
68738         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68739         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68740         return ret_ref;
68741 }
68742
68743 uint64_tArray  __attribute__((export_name("TS_RawBolt11Invoice_private_routes"))) TS_RawBolt11Invoice_private_routes(uint64_t this_arg) {
68744         LDKRawBolt11Invoice this_arg_conv;
68745         this_arg_conv.inner = untag_ptr(this_arg);
68746         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68748         this_arg_conv.is_owned = false;
68749         LDKCVec_PrivateRouteZ ret_var = RawBolt11Invoice_private_routes(&this_arg_conv);
68750         uint64_tArray ret_arr = NULL;
68751         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
68752         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
68753         for (size_t o = 0; o < ret_var.datalen; o++) {
68754                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
68755                 uint64_t ret_conv_14_ref = 0;
68756                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
68757                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
68758                 ret_arr_ptr[o] = ret_conv_14_ref;
68759         }
68760         
68761         FREE(ret_var.data);
68762         return ret_arr;
68763 }
68764
68765 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_amount_pico_btc"))) TS_RawBolt11Invoice_amount_pico_btc(uint64_t this_arg) {
68766         LDKRawBolt11Invoice this_arg_conv;
68767         this_arg_conv.inner = untag_ptr(this_arg);
68768         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68770         this_arg_conv.is_owned = false;
68771         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
68772         *ret_copy = RawBolt11Invoice_amount_pico_btc(&this_arg_conv);
68773         uint64_t ret_ref = tag_ptr(ret_copy, true);
68774         return ret_ref;
68775 }
68776
68777 uint32_t  __attribute__((export_name("TS_RawBolt11Invoice_currency"))) TS_RawBolt11Invoice_currency(uint64_t this_arg) {
68778         LDKRawBolt11Invoice this_arg_conv;
68779         this_arg_conv.inner = untag_ptr(this_arg);
68780         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68782         this_arg_conv.is_owned = false;
68783         uint32_t ret_conv = LDKCurrency_to_js(RawBolt11Invoice_currency(&this_arg_conv));
68784         return ret_conv;
68785 }
68786
68787 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_unix_timestamp"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
68788         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
68789         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
68790         return tag_ptr(ret_conv, true);
68791 }
68792
68793 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_duration_since_epoch"))) TS_PositiveTimestamp_from_duration_since_epoch(int64_t duration) {
68794         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
68795         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
68796         return tag_ptr(ret_conv, true);
68797 }
68798
68799 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_unix_timestamp"))) TS_PositiveTimestamp_as_unix_timestamp(uint64_t this_arg) {
68800         LDKPositiveTimestamp this_arg_conv;
68801         this_arg_conv.inner = untag_ptr(this_arg);
68802         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68804         this_arg_conv.is_owned = false;
68805         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
68806         return ret_conv;
68807 }
68808
68809 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_duration_since_epoch"))) TS_PositiveTimestamp_as_duration_since_epoch(uint64_t this_arg) {
68810         LDKPositiveTimestamp this_arg_conv;
68811         this_arg_conv.inner = untag_ptr(this_arg);
68812         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68814         this_arg_conv.is_owned = false;
68815         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
68816         return ret_conv;
68817 }
68818
68819 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_signable_hash"))) TS_Bolt11Invoice_signable_hash(uint64_t this_arg) {
68820         LDKBolt11Invoice this_arg_conv;
68821         this_arg_conv.inner = untag_ptr(this_arg);
68822         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68824         this_arg_conv.is_owned = false;
68825         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
68826         memcpy(ret_arr->elems, Bolt11Invoice_signable_hash(&this_arg_conv).data, 32);
68827         return ret_arr;
68828 }
68829
68830 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_into_signed_raw"))) TS_Bolt11Invoice_into_signed_raw(uint64_t this_arg) {
68831         LDKBolt11Invoice this_arg_conv;
68832         this_arg_conv.inner = untag_ptr(this_arg);
68833         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68835         this_arg_conv = Bolt11Invoice_clone(&this_arg_conv);
68836         LDKSignedRawBolt11Invoice ret_var = Bolt11Invoice_into_signed_raw(this_arg_conv);
68837         uint64_t ret_ref = 0;
68838         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68839         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68840         return ret_ref;
68841 }
68842
68843 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_check_signature"))) TS_Bolt11Invoice_check_signature(uint64_t this_arg) {
68844         LDKBolt11Invoice this_arg_conv;
68845         this_arg_conv.inner = untag_ptr(this_arg);
68846         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68848         this_arg_conv.is_owned = false;
68849         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
68850         *ret_conv = Bolt11Invoice_check_signature(&this_arg_conv);
68851         return tag_ptr(ret_conv, true);
68852 }
68853
68854 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_from_signed"))) TS_Bolt11Invoice_from_signed(uint64_t signed_invoice) {
68855         LDKSignedRawBolt11Invoice signed_invoice_conv;
68856         signed_invoice_conv.inner = untag_ptr(signed_invoice);
68857         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
68858         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
68859         signed_invoice_conv = SignedRawBolt11Invoice_clone(&signed_invoice_conv);
68860         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
68861         *ret_conv = Bolt11Invoice_from_signed(signed_invoice_conv);
68862         return tag_ptr(ret_conv, true);
68863 }
68864
68865 int64_t  __attribute__((export_name("TS_Bolt11Invoice_duration_since_epoch"))) TS_Bolt11Invoice_duration_since_epoch(uint64_t this_arg) {
68866         LDKBolt11Invoice this_arg_conv;
68867         this_arg_conv.inner = untag_ptr(this_arg);
68868         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68870         this_arg_conv.is_owned = false;
68871         int64_t ret_conv = Bolt11Invoice_duration_since_epoch(&this_arg_conv);
68872         return ret_conv;
68873 }
68874
68875 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_payment_hash"))) TS_Bolt11Invoice_payment_hash(uint64_t this_arg) {
68876         LDKBolt11Invoice this_arg_conv;
68877         this_arg_conv.inner = untag_ptr(this_arg);
68878         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68880         this_arg_conv.is_owned = false;
68881         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
68882         memcpy(ret_arr->elems, *Bolt11Invoice_payment_hash(&this_arg_conv), 32);
68883         return ret_arr;
68884 }
68885
68886 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_payee_pub_key"))) TS_Bolt11Invoice_payee_pub_key(uint64_t this_arg) {
68887         LDKBolt11Invoice this_arg_conv;
68888         this_arg_conv.inner = untag_ptr(this_arg);
68889         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68891         this_arg_conv.is_owned = false;
68892         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
68893         memcpy(ret_arr->elems, Bolt11Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
68894         return ret_arr;
68895 }
68896
68897 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_payment_secret"))) TS_Bolt11Invoice_payment_secret(uint64_t this_arg) {
68898         LDKBolt11Invoice this_arg_conv;
68899         this_arg_conv.inner = untag_ptr(this_arg);
68900         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68902         this_arg_conv.is_owned = false;
68903         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
68904         memcpy(ret_arr->elems, *Bolt11Invoice_payment_secret(&this_arg_conv), 32);
68905         return ret_arr;
68906 }
68907
68908 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_payment_metadata"))) TS_Bolt11Invoice_payment_metadata(uint64_t this_arg) {
68909         LDKBolt11Invoice this_arg_conv;
68910         this_arg_conv.inner = untag_ptr(this_arg);
68911         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68913         this_arg_conv.is_owned = false;
68914         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
68915         *ret_copy = Bolt11Invoice_payment_metadata(&this_arg_conv);
68916         uint64_t ret_ref = tag_ptr(ret_copy, true);
68917         return ret_ref;
68918 }
68919
68920 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_features"))) TS_Bolt11Invoice_features(uint64_t this_arg) {
68921         LDKBolt11Invoice this_arg_conv;
68922         this_arg_conv.inner = untag_ptr(this_arg);
68923         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68925         this_arg_conv.is_owned = false;
68926         LDKBolt11InvoiceFeatures ret_var = Bolt11Invoice_features(&this_arg_conv);
68927         uint64_t ret_ref = 0;
68928         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68929         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68930         return ret_ref;
68931 }
68932
68933 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_recover_payee_pub_key"))) TS_Bolt11Invoice_recover_payee_pub_key(uint64_t this_arg) {
68934         LDKBolt11Invoice this_arg_conv;
68935         this_arg_conv.inner = untag_ptr(this_arg);
68936         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68938         this_arg_conv.is_owned = false;
68939         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
68940         memcpy(ret_arr->elems, Bolt11Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
68941         return ret_arr;
68942 }
68943
68944 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_expires_at"))) TS_Bolt11Invoice_expires_at(uint64_t this_arg) {
68945         LDKBolt11Invoice this_arg_conv;
68946         this_arg_conv.inner = untag_ptr(this_arg);
68947         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68949         this_arg_conv.is_owned = false;
68950         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
68951         *ret_copy = Bolt11Invoice_expires_at(&this_arg_conv);
68952         uint64_t ret_ref = tag_ptr(ret_copy, true);
68953         return ret_ref;
68954 }
68955
68956 int64_t  __attribute__((export_name("TS_Bolt11Invoice_expiry_time"))) TS_Bolt11Invoice_expiry_time(uint64_t this_arg) {
68957         LDKBolt11Invoice this_arg_conv;
68958         this_arg_conv.inner = untag_ptr(this_arg);
68959         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68961         this_arg_conv.is_owned = false;
68962         int64_t ret_conv = Bolt11Invoice_expiry_time(&this_arg_conv);
68963         return ret_conv;
68964 }
68965
68966 int64_t  __attribute__((export_name("TS_Bolt11Invoice_expiration_remaining_from_epoch"))) TS_Bolt11Invoice_expiration_remaining_from_epoch(uint64_t this_arg, int64_t time) {
68967         LDKBolt11Invoice this_arg_conv;
68968         this_arg_conv.inner = untag_ptr(this_arg);
68969         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68971         this_arg_conv.is_owned = false;
68972         int64_t ret_conv = Bolt11Invoice_expiration_remaining_from_epoch(&this_arg_conv, time);
68973         return ret_conv;
68974 }
68975
68976 jboolean  __attribute__((export_name("TS_Bolt11Invoice_would_expire"))) TS_Bolt11Invoice_would_expire(uint64_t this_arg, int64_t at_time) {
68977         LDKBolt11Invoice this_arg_conv;
68978         this_arg_conv.inner = untag_ptr(this_arg);
68979         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68981         this_arg_conv.is_owned = false;
68982         jboolean ret_conv = Bolt11Invoice_would_expire(&this_arg_conv, at_time);
68983         return ret_conv;
68984 }
68985
68986 int64_t  __attribute__((export_name("TS_Bolt11Invoice_min_final_cltv_expiry_delta"))) TS_Bolt11Invoice_min_final_cltv_expiry_delta(uint64_t this_arg) {
68987         LDKBolt11Invoice this_arg_conv;
68988         this_arg_conv.inner = untag_ptr(this_arg);
68989         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68991         this_arg_conv.is_owned = false;
68992         int64_t ret_conv = Bolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
68993         return ret_conv;
68994 }
68995
68996 ptrArray  __attribute__((export_name("TS_Bolt11Invoice_fallback_addresses"))) TS_Bolt11Invoice_fallback_addresses(uint64_t this_arg) {
68997         LDKBolt11Invoice this_arg_conv;
68998         this_arg_conv.inner = untag_ptr(this_arg);
68999         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69001         this_arg_conv.is_owned = false;
69002         LDKCVec_StrZ ret_var = Bolt11Invoice_fallback_addresses(&this_arg_conv);
69003         ptrArray ret_arr = NULL;
69004         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
69005         jstring *ret_arr_ptr = (jstring*)(((uint8_t*)ret_arr) + 8);
69006         for (size_t i = 0; i < ret_var.datalen; i++) {
69007                 LDKStr ret_conv_8_str = ret_var.data[i];
69008                 jstring ret_conv_8_conv = str_ref_to_ts(ret_conv_8_str.chars, ret_conv_8_str.len);
69009                 Str_free(ret_conv_8_str);
69010                 ret_arr_ptr[i] = ret_conv_8_conv;
69011         }
69012         
69013         FREE(ret_var.data);
69014         return ret_arr;
69015 }
69016
69017 uint64_tArray  __attribute__((export_name("TS_Bolt11Invoice_private_routes"))) TS_Bolt11Invoice_private_routes(uint64_t this_arg) {
69018         LDKBolt11Invoice this_arg_conv;
69019         this_arg_conv.inner = untag_ptr(this_arg);
69020         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69022         this_arg_conv.is_owned = false;
69023         LDKCVec_PrivateRouteZ ret_var = Bolt11Invoice_private_routes(&this_arg_conv);
69024         uint64_tArray ret_arr = NULL;
69025         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
69026         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
69027         for (size_t o = 0; o < ret_var.datalen; o++) {
69028                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
69029                 uint64_t ret_conv_14_ref = 0;
69030                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
69031                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
69032                 ret_arr_ptr[o] = ret_conv_14_ref;
69033         }
69034         
69035         FREE(ret_var.data);
69036         return ret_arr;
69037 }
69038
69039 uint64_tArray  __attribute__((export_name("TS_Bolt11Invoice_route_hints"))) TS_Bolt11Invoice_route_hints(uint64_t this_arg) {
69040         LDKBolt11Invoice this_arg_conv;
69041         this_arg_conv.inner = untag_ptr(this_arg);
69042         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69044         this_arg_conv.is_owned = false;
69045         LDKCVec_RouteHintZ ret_var = Bolt11Invoice_route_hints(&this_arg_conv);
69046         uint64_tArray ret_arr = NULL;
69047         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
69048         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
69049         for (size_t l = 0; l < ret_var.datalen; l++) {
69050                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
69051                 uint64_t ret_conv_11_ref = 0;
69052                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
69053                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
69054                 ret_arr_ptr[l] = ret_conv_11_ref;
69055         }
69056         
69057         FREE(ret_var.data);
69058         return ret_arr;
69059 }
69060
69061 uint32_t  __attribute__((export_name("TS_Bolt11Invoice_currency"))) TS_Bolt11Invoice_currency(uint64_t this_arg) {
69062         LDKBolt11Invoice this_arg_conv;
69063         this_arg_conv.inner = untag_ptr(this_arg);
69064         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69066         this_arg_conv.is_owned = false;
69067         uint32_t ret_conv = LDKCurrency_to_js(Bolt11Invoice_currency(&this_arg_conv));
69068         return ret_conv;
69069 }
69070
69071 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_amount_milli_satoshis"))) TS_Bolt11Invoice_amount_milli_satoshis(uint64_t this_arg) {
69072         LDKBolt11Invoice this_arg_conv;
69073         this_arg_conv.inner = untag_ptr(this_arg);
69074         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69076         this_arg_conv.is_owned = false;
69077         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
69078         *ret_copy = Bolt11Invoice_amount_milli_satoshis(&this_arg_conv);
69079         uint64_t ret_ref = tag_ptr(ret_copy, true);
69080         return ret_ref;
69081 }
69082
69083 uint64_t  __attribute__((export_name("TS_Description_new"))) TS_Description_new(jstring description) {
69084         LDKStr description_conv = str_ref_to_owned_c(description);
69085         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
69086         *ret_conv = Description_new(description_conv);
69087         return tag_ptr(ret_conv, true);
69088 }
69089
69090 jstring  __attribute__((export_name("TS_Description_into_inner"))) TS_Description_into_inner(uint64_t this_arg) {
69091         LDKDescription this_arg_conv;
69092         this_arg_conv.inner = untag_ptr(this_arg);
69093         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69095         this_arg_conv = Description_clone(&this_arg_conv);
69096         LDKStr ret_str = Description_into_inner(this_arg_conv);
69097         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
69098         Str_free(ret_str);
69099         return ret_conv;
69100 }
69101
69102 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_seconds"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
69103         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
69104         uint64_t ret_ref = 0;
69105         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69106         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69107         return ret_ref;
69108 }
69109
69110 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_duration"))) TS_ExpiryTime_from_duration(int64_t duration) {
69111         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
69112         uint64_t ret_ref = 0;
69113         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69114         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69115         return ret_ref;
69116 }
69117
69118 int64_t  __attribute__((export_name("TS_ExpiryTime_as_seconds"))) TS_ExpiryTime_as_seconds(uint64_t this_arg) {
69119         LDKExpiryTime this_arg_conv;
69120         this_arg_conv.inner = untag_ptr(this_arg);
69121         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69123         this_arg_conv.is_owned = false;
69124         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
69125         return ret_conv;
69126 }
69127
69128 int64_t  __attribute__((export_name("TS_ExpiryTime_as_duration"))) TS_ExpiryTime_as_duration(uint64_t this_arg) {
69129         LDKExpiryTime this_arg_conv;
69130         this_arg_conv.inner = untag_ptr(this_arg);
69131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69133         this_arg_conv.is_owned = false;
69134         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
69135         return ret_conv;
69136 }
69137
69138 uint64_t  __attribute__((export_name("TS_PrivateRoute_new"))) TS_PrivateRoute_new(uint64_t hops) {
69139         LDKRouteHint hops_conv;
69140         hops_conv.inner = untag_ptr(hops);
69141         hops_conv.is_owned = ptr_is_owned(hops);
69142         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
69143         hops_conv = RouteHint_clone(&hops_conv);
69144         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
69145         *ret_conv = PrivateRoute_new(hops_conv);
69146         return tag_ptr(ret_conv, true);
69147 }
69148
69149 uint64_t  __attribute__((export_name("TS_PrivateRoute_into_inner"))) TS_PrivateRoute_into_inner(uint64_t this_arg) {
69150         LDKPrivateRoute this_arg_conv;
69151         this_arg_conv.inner = untag_ptr(this_arg);
69152         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69154         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
69155         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
69156         uint64_t ret_ref = 0;
69157         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69158         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69159         return ret_ref;
69160 }
69161
69162 uint32_t  __attribute__((export_name("TS_CreationError_clone"))) TS_CreationError_clone(uint64_t orig) {
69163         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
69164         uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
69165         return ret_conv;
69166 }
69167
69168 uint32_t  __attribute__((export_name("TS_CreationError_description_too_long"))) TS_CreationError_description_too_long() {
69169         uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
69170         return ret_conv;
69171 }
69172
69173 uint32_t  __attribute__((export_name("TS_CreationError_route_too_long"))) TS_CreationError_route_too_long() {
69174         uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
69175         return ret_conv;
69176 }
69177
69178 uint32_t  __attribute__((export_name("TS_CreationError_timestamp_out_of_bounds"))) TS_CreationError_timestamp_out_of_bounds() {
69179         uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
69180         return ret_conv;
69181 }
69182
69183 uint32_t  __attribute__((export_name("TS_CreationError_invalid_amount"))) TS_CreationError_invalid_amount() {
69184         uint32_t ret_conv = LDKCreationError_to_js(CreationError_invalid_amount());
69185         return ret_conv;
69186 }
69187
69188 uint32_t  __attribute__((export_name("TS_CreationError_missing_route_hints"))) TS_CreationError_missing_route_hints() {
69189         uint32_t ret_conv = LDKCreationError_to_js(CreationError_missing_route_hints());
69190         return ret_conv;
69191 }
69192
69193 uint32_t  __attribute__((export_name("TS_CreationError_min_final_cltv_expiry_delta_too_short"))) TS_CreationError_min_final_cltv_expiry_delta_too_short() {
69194         uint32_t ret_conv = LDKCreationError_to_js(CreationError_min_final_cltv_expiry_delta_too_short());
69195         return ret_conv;
69196 }
69197
69198 jboolean  __attribute__((export_name("TS_CreationError_eq"))) TS_CreationError_eq(uint64_t a, uint64_t b) {
69199         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
69200         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
69201         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
69202         return ret_conv;
69203 }
69204
69205 jstring  __attribute__((export_name("TS_CreationError_to_str"))) TS_CreationError_to_str(uint64_t o) {
69206         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
69207         LDKStr ret_str = CreationError_to_str(o_conv);
69208         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
69209         Str_free(ret_str);
69210         return ret_conv;
69211 }
69212
69213 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_clone"))) TS_Bolt11SemanticError_clone(uint64_t orig) {
69214         LDKBolt11SemanticError* orig_conv = (LDKBolt11SemanticError*)untag_ptr(orig);
69215         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_clone(orig_conv));
69216         return ret_conv;
69217 }
69218
69219 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_no_payment_hash"))) TS_Bolt11SemanticError_no_payment_hash() {
69220         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_no_payment_hash());
69221         return ret_conv;
69222 }
69223
69224 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_multiple_payment_hashes"))) TS_Bolt11SemanticError_multiple_payment_hashes() {
69225         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_multiple_payment_hashes());
69226         return ret_conv;
69227 }
69228
69229 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_no_description"))) TS_Bolt11SemanticError_no_description() {
69230         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_no_description());
69231         return ret_conv;
69232 }
69233
69234 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_multiple_descriptions"))) TS_Bolt11SemanticError_multiple_descriptions() {
69235         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_multiple_descriptions());
69236         return ret_conv;
69237 }
69238
69239 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_no_payment_secret"))) TS_Bolt11SemanticError_no_payment_secret() {
69240         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_no_payment_secret());
69241         return ret_conv;
69242 }
69243
69244 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_multiple_payment_secrets"))) TS_Bolt11SemanticError_multiple_payment_secrets() {
69245         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_multiple_payment_secrets());
69246         return ret_conv;
69247 }
69248
69249 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_invalid_features"))) TS_Bolt11SemanticError_invalid_features() {
69250         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_invalid_features());
69251         return ret_conv;
69252 }
69253
69254 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_invalid_recovery_id"))) TS_Bolt11SemanticError_invalid_recovery_id() {
69255         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_invalid_recovery_id());
69256         return ret_conv;
69257 }
69258
69259 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_invalid_signature"))) TS_Bolt11SemanticError_invalid_signature() {
69260         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_invalid_signature());
69261         return ret_conv;
69262 }
69263
69264 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_imprecise_amount"))) TS_Bolt11SemanticError_imprecise_amount() {
69265         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_imprecise_amount());
69266         return ret_conv;
69267 }
69268
69269 jboolean  __attribute__((export_name("TS_Bolt11SemanticError_eq"))) TS_Bolt11SemanticError_eq(uint64_t a, uint64_t b) {
69270         LDKBolt11SemanticError* a_conv = (LDKBolt11SemanticError*)untag_ptr(a);
69271         LDKBolt11SemanticError* b_conv = (LDKBolt11SemanticError*)untag_ptr(b);
69272         jboolean ret_conv = Bolt11SemanticError_eq(a_conv, b_conv);
69273         return ret_conv;
69274 }
69275
69276 jstring  __attribute__((export_name("TS_Bolt11SemanticError_to_str"))) TS_Bolt11SemanticError_to_str(uint64_t o) {
69277         LDKBolt11SemanticError* o_conv = (LDKBolt11SemanticError*)untag_ptr(o);
69278         LDKStr ret_str = Bolt11SemanticError_to_str(o_conv);
69279         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
69280         Str_free(ret_str);
69281         return ret_conv;
69282 }
69283
69284 void  __attribute__((export_name("TS_SignOrCreationError_free"))) TS_SignOrCreationError_free(uint64_t this_ptr) {
69285         if (!ptr_is_owned(this_ptr)) return;
69286         void* this_ptr_ptr = untag_ptr(this_ptr);
69287         CHECK_ACCESS(this_ptr_ptr);
69288         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
69289         FREE(untag_ptr(this_ptr));
69290         SignOrCreationError_free(this_ptr_conv);
69291 }
69292
69293 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
69294         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
69295         *ret_copy = SignOrCreationError_clone(arg);
69296         uint64_t ret_ref = tag_ptr(ret_copy, true);
69297         return ret_ref;
69298 }
69299 int64_t  __attribute__((export_name("TS_SignOrCreationError_clone_ptr"))) TS_SignOrCreationError_clone_ptr(uint64_t arg) {
69300         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
69301         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
69302         return ret_conv;
69303 }
69304
69305 uint64_t  __attribute__((export_name("TS_SignOrCreationError_clone"))) TS_SignOrCreationError_clone(uint64_t orig) {
69306         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
69307         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
69308         *ret_copy = SignOrCreationError_clone(orig_conv);
69309         uint64_t ret_ref = tag_ptr(ret_copy, true);
69310         return ret_ref;
69311 }
69312
69313 uint64_t  __attribute__((export_name("TS_SignOrCreationError_sign_error"))) TS_SignOrCreationError_sign_error() {
69314         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
69315         *ret_copy = SignOrCreationError_sign_error();
69316         uint64_t ret_ref = tag_ptr(ret_copy, true);
69317         return ret_ref;
69318 }
69319
69320 uint64_t  __attribute__((export_name("TS_SignOrCreationError_creation_error"))) TS_SignOrCreationError_creation_error(uint32_t a) {
69321         LDKCreationError a_conv = LDKCreationError_from_js(a);
69322         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
69323         *ret_copy = SignOrCreationError_creation_error(a_conv);
69324         uint64_t ret_ref = tag_ptr(ret_copy, true);
69325         return ret_ref;
69326 }
69327
69328 jboolean  __attribute__((export_name("TS_SignOrCreationError_eq"))) TS_SignOrCreationError_eq(uint64_t a, uint64_t b) {
69329         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
69330         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
69331         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
69332         return ret_conv;
69333 }
69334
69335 jstring  __attribute__((export_name("TS_SignOrCreationError_to_str"))) TS_SignOrCreationError_to_str(uint64_t o) {
69336         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
69337         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
69338         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
69339         Str_free(ret_str);
69340         return ret_conv;
69341 }
69342
69343 uint64_t  __attribute__((export_name("TS_pay_invoice"))) TS_pay_invoice(uint64_t invoice, uint64_t retry_strategy, uint64_t channelmanager) {
69344         LDKBolt11Invoice invoice_conv;
69345         invoice_conv.inner = untag_ptr(invoice);
69346         invoice_conv.is_owned = ptr_is_owned(invoice);
69347         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
69348         invoice_conv.is_owned = false;
69349         void* retry_strategy_ptr = untag_ptr(retry_strategy);
69350         CHECK_ACCESS(retry_strategy_ptr);
69351         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
69352         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
69353         LDKChannelManager channelmanager_conv;
69354         channelmanager_conv.inner = untag_ptr(channelmanager);
69355         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
69356         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
69357         channelmanager_conv.is_owned = false;
69358         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
69359         *ret_conv = pay_invoice(&invoice_conv, retry_strategy_conv, &channelmanager_conv);
69360         return tag_ptr(ret_conv, true);
69361 }
69362
69363 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) {
69364         LDKBolt11Invoice invoice_conv;
69365         invoice_conv.inner = untag_ptr(invoice);
69366         invoice_conv.is_owned = ptr_is_owned(invoice);
69367         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
69368         invoice_conv.is_owned = false;
69369         LDKThirtyTwoBytes payment_id_ref;
69370         CHECK(payment_id->arr_len == 32);
69371         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
69372         void* retry_strategy_ptr = untag_ptr(retry_strategy);
69373         CHECK_ACCESS(retry_strategy_ptr);
69374         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
69375         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
69376         LDKChannelManager channelmanager_conv;
69377         channelmanager_conv.inner = untag_ptr(channelmanager);
69378         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
69379         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
69380         channelmanager_conv.is_owned = false;
69381         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
69382         *ret_conv = pay_invoice_with_id(&invoice_conv, payment_id_ref, retry_strategy_conv, &channelmanager_conv);
69383         return tag_ptr(ret_conv, true);
69384 }
69385
69386 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) {
69387         LDKBolt11Invoice invoice_conv;
69388         invoice_conv.inner = untag_ptr(invoice);
69389         invoice_conv.is_owned = ptr_is_owned(invoice);
69390         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
69391         invoice_conv.is_owned = false;
69392         void* retry_strategy_ptr = untag_ptr(retry_strategy);
69393         CHECK_ACCESS(retry_strategy_ptr);
69394         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
69395         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
69396         LDKChannelManager channelmanager_conv;
69397         channelmanager_conv.inner = untag_ptr(channelmanager);
69398         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
69399         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
69400         channelmanager_conv.is_owned = false;
69401         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
69402         *ret_conv = pay_zero_value_invoice(&invoice_conv, amount_msats, retry_strategy_conv, &channelmanager_conv);
69403         return tag_ptr(ret_conv, true);
69404 }
69405
69406 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) {
69407         LDKBolt11Invoice invoice_conv;
69408         invoice_conv.inner = untag_ptr(invoice);
69409         invoice_conv.is_owned = ptr_is_owned(invoice);
69410         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
69411         invoice_conv.is_owned = false;
69412         LDKThirtyTwoBytes payment_id_ref;
69413         CHECK(payment_id->arr_len == 32);
69414         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
69415         void* retry_strategy_ptr = untag_ptr(retry_strategy);
69416         CHECK_ACCESS(retry_strategy_ptr);
69417         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
69418         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
69419         LDKChannelManager channelmanager_conv;
69420         channelmanager_conv.inner = untag_ptr(channelmanager);
69421         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
69422         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
69423         channelmanager_conv.is_owned = false;
69424         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
69425         *ret_conv = pay_zero_value_invoice_with_id(&invoice_conv, amount_msats, payment_id_ref, retry_strategy_conv, &channelmanager_conv);
69426         return tag_ptr(ret_conv, true);
69427 }
69428
69429 uint64_t  __attribute__((export_name("TS_preflight_probe_invoice"))) TS_preflight_probe_invoice(uint64_t invoice, uint64_t channelmanager, uint64_t liquidity_limit_multiplier) {
69430         LDKBolt11Invoice invoice_conv;
69431         invoice_conv.inner = untag_ptr(invoice);
69432         invoice_conv.is_owned = ptr_is_owned(invoice);
69433         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
69434         invoice_conv.is_owned = false;
69435         LDKChannelManager channelmanager_conv;
69436         channelmanager_conv.inner = untag_ptr(channelmanager);
69437         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
69438         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
69439         channelmanager_conv.is_owned = false;
69440         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
69441         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
69442         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
69443         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
69444         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
69445         *ret_conv = preflight_probe_invoice(&invoice_conv, &channelmanager_conv, liquidity_limit_multiplier_conv);
69446         return tag_ptr(ret_conv, true);
69447 }
69448
69449 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) {
69450         LDKBolt11Invoice invoice_conv;
69451         invoice_conv.inner = untag_ptr(invoice);
69452         invoice_conv.is_owned = ptr_is_owned(invoice);
69453         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
69454         invoice_conv.is_owned = false;
69455         LDKChannelManager channelmanager_conv;
69456         channelmanager_conv.inner = untag_ptr(channelmanager);
69457         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
69458         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
69459         channelmanager_conv.is_owned = false;
69460         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
69461         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
69462         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
69463         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
69464         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
69465         *ret_conv = preflight_probe_zero_value_invoice(&invoice_conv, amount_msat, &channelmanager_conv, liquidity_limit_multiplier_conv);
69466         return tag_ptr(ret_conv, true);
69467 }
69468
69469 void  __attribute__((export_name("TS_PaymentError_free"))) TS_PaymentError_free(uint64_t this_ptr) {
69470         if (!ptr_is_owned(this_ptr)) return;
69471         void* this_ptr_ptr = untag_ptr(this_ptr);
69472         CHECK_ACCESS(this_ptr_ptr);
69473         LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
69474         FREE(untag_ptr(this_ptr));
69475         PaymentError_free(this_ptr_conv);
69476 }
69477
69478 static inline uint64_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
69479         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
69480         *ret_copy = PaymentError_clone(arg);
69481         uint64_t ret_ref = tag_ptr(ret_copy, true);
69482         return ret_ref;
69483 }
69484 int64_t  __attribute__((export_name("TS_PaymentError_clone_ptr"))) TS_PaymentError_clone_ptr(uint64_t arg) {
69485         LDKPaymentError* arg_conv = (LDKPaymentError*)untag_ptr(arg);
69486         int64_t ret_conv = PaymentError_clone_ptr(arg_conv);
69487         return ret_conv;
69488 }
69489
69490 uint64_t  __attribute__((export_name("TS_PaymentError_clone"))) TS_PaymentError_clone(uint64_t orig) {
69491         LDKPaymentError* orig_conv = (LDKPaymentError*)untag_ptr(orig);
69492         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
69493         *ret_copy = PaymentError_clone(orig_conv);
69494         uint64_t ret_ref = tag_ptr(ret_copy, true);
69495         return ret_ref;
69496 }
69497
69498 uint64_t  __attribute__((export_name("TS_PaymentError_invoice"))) TS_PaymentError_invoice(jstring a) {
69499         LDKStr a_conv = str_ref_to_owned_c(a);
69500         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
69501         *ret_copy = PaymentError_invoice(a_conv);
69502         uint64_t ret_ref = tag_ptr(ret_copy, true);
69503         return ret_ref;
69504 }
69505
69506 uint64_t  __attribute__((export_name("TS_PaymentError_sending"))) TS_PaymentError_sending(uint32_t a) {
69507         LDKRetryableSendFailure a_conv = LDKRetryableSendFailure_from_js(a);
69508         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
69509         *ret_copy = PaymentError_sending(a_conv);
69510         uint64_t ret_ref = tag_ptr(ret_copy, true);
69511         return ret_ref;
69512 }
69513
69514 jboolean  __attribute__((export_name("TS_PaymentError_eq"))) TS_PaymentError_eq(uint64_t a, uint64_t b) {
69515         LDKPaymentError* a_conv = (LDKPaymentError*)untag_ptr(a);
69516         LDKPaymentError* b_conv = (LDKPaymentError*)untag_ptr(b);
69517         jboolean ret_conv = PaymentError_eq(a_conv, b_conv);
69518         return ret_conv;
69519 }
69520
69521 void  __attribute__((export_name("TS_ProbingError_free"))) TS_ProbingError_free(uint64_t this_ptr) {
69522         if (!ptr_is_owned(this_ptr)) return;
69523         void* this_ptr_ptr = untag_ptr(this_ptr);
69524         CHECK_ACCESS(this_ptr_ptr);
69525         LDKProbingError this_ptr_conv = *(LDKProbingError*)(this_ptr_ptr);
69526         FREE(untag_ptr(this_ptr));
69527         ProbingError_free(this_ptr_conv);
69528 }
69529
69530 static inline uint64_t ProbingError_clone_ptr(LDKProbingError *NONNULL_PTR arg) {
69531         LDKProbingError *ret_copy = MALLOC(sizeof(LDKProbingError), "LDKProbingError");
69532         *ret_copy = ProbingError_clone(arg);
69533         uint64_t ret_ref = tag_ptr(ret_copy, true);
69534         return ret_ref;
69535 }
69536 int64_t  __attribute__((export_name("TS_ProbingError_clone_ptr"))) TS_ProbingError_clone_ptr(uint64_t arg) {
69537         LDKProbingError* arg_conv = (LDKProbingError*)untag_ptr(arg);
69538         int64_t ret_conv = ProbingError_clone_ptr(arg_conv);
69539         return ret_conv;
69540 }
69541
69542 uint64_t  __attribute__((export_name("TS_ProbingError_clone"))) TS_ProbingError_clone(uint64_t orig) {
69543         LDKProbingError* orig_conv = (LDKProbingError*)untag_ptr(orig);
69544         LDKProbingError *ret_copy = MALLOC(sizeof(LDKProbingError), "LDKProbingError");
69545         *ret_copy = ProbingError_clone(orig_conv);
69546         uint64_t ret_ref = tag_ptr(ret_copy, true);
69547         return ret_ref;
69548 }
69549
69550 uint64_t  __attribute__((export_name("TS_ProbingError_invoice"))) TS_ProbingError_invoice(jstring a) {
69551         LDKStr a_conv = str_ref_to_owned_c(a);
69552         LDKProbingError *ret_copy = MALLOC(sizeof(LDKProbingError), "LDKProbingError");
69553         *ret_copy = ProbingError_invoice(a_conv);
69554         uint64_t ret_ref = tag_ptr(ret_copy, true);
69555         return ret_ref;
69556 }
69557
69558 uint64_t  __attribute__((export_name("TS_ProbingError_sending"))) TS_ProbingError_sending(uint64_t a) {
69559         void* a_ptr = untag_ptr(a);
69560         CHECK_ACCESS(a_ptr);
69561         LDKProbeSendFailure a_conv = *(LDKProbeSendFailure*)(a_ptr);
69562         a_conv = ProbeSendFailure_clone((LDKProbeSendFailure*)untag_ptr(a));
69563         LDKProbingError *ret_copy = MALLOC(sizeof(LDKProbingError), "LDKProbingError");
69564         *ret_copy = ProbingError_sending(a_conv);
69565         uint64_t ret_ref = tag_ptr(ret_copy, true);
69566         return ret_ref;
69567 }
69568
69569 jboolean  __attribute__((export_name("TS_ProbingError_eq"))) TS_ProbingError_eq(uint64_t a, uint64_t b) {
69570         LDKProbingError* a_conv = (LDKProbingError*)untag_ptr(a);
69571         LDKProbingError* b_conv = (LDKProbingError*)untag_ptr(b);
69572         jboolean ret_conv = ProbingError_eq(a_conv, b_conv);
69573         return ret_conv;
69574 }
69575
69576 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) {
69577         void* amt_msat_ptr = untag_ptr(amt_msat);
69578         CHECK_ACCESS(amt_msat_ptr);
69579         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
69580         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
69581         void* payment_hash_ptr = untag_ptr(payment_hash);
69582         CHECK_ACCESS(payment_hash_ptr);
69583         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
69584         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
69585         LDKStr description_conv = str_ref_to_owned_c(description);
69586         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
69587         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
69588         if (phantom_route_hints_constr.datalen > 0)
69589                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
69590         else
69591                 phantom_route_hints_constr.data = NULL;
69592         uint64_t* phantom_route_hints_vals = phantom_route_hints->elems;
69593         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
69594                 uint64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
69595                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
69596                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
69597                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
69598                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
69599                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
69600                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
69601         }
69602         FREE(phantom_route_hints);
69603         void* entropy_source_ptr = untag_ptr(entropy_source);
69604         CHECK_ACCESS(entropy_source_ptr);
69605         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
69606         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
69607                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69608                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
69609         }
69610         void* node_signer_ptr = untag_ptr(node_signer);
69611         CHECK_ACCESS(node_signer_ptr);
69612         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
69613         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
69614                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69615                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
69616         }
69617         void* logger_ptr = untag_ptr(logger);
69618         CHECK_ACCESS(logger_ptr);
69619         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69620         if (logger_conv.free == LDKLogger_JCalls_free) {
69621                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69622                 LDKLogger_JCalls_cloned(&logger_conv);
69623         }
69624         LDKCurrency network_conv = LDKCurrency_from_js(network);
69625         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
69626         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
69627         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
69628         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
69629         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
69630         *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);
69631         return tag_ptr(ret_conv, true);
69632 }
69633
69634 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) {
69635         void* amt_msat_ptr = untag_ptr(amt_msat);
69636         CHECK_ACCESS(amt_msat_ptr);
69637         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
69638         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
69639         void* payment_hash_ptr = untag_ptr(payment_hash);
69640         CHECK_ACCESS(payment_hash_ptr);
69641         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
69642         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
69643         LDKSha256 description_hash_conv;
69644         description_hash_conv.inner = untag_ptr(description_hash);
69645         description_hash_conv.is_owned = ptr_is_owned(description_hash);
69646         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
69647         description_hash_conv = Sha256_clone(&description_hash_conv);
69648         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
69649         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
69650         if (phantom_route_hints_constr.datalen > 0)
69651                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
69652         else
69653                 phantom_route_hints_constr.data = NULL;
69654         uint64_t* phantom_route_hints_vals = phantom_route_hints->elems;
69655         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
69656                 uint64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
69657                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
69658                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
69659                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
69660                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
69661                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
69662                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
69663         }
69664         FREE(phantom_route_hints);
69665         void* entropy_source_ptr = untag_ptr(entropy_source);
69666         CHECK_ACCESS(entropy_source_ptr);
69667         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
69668         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
69669                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69670                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
69671         }
69672         void* node_signer_ptr = untag_ptr(node_signer);
69673         CHECK_ACCESS(node_signer_ptr);
69674         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
69675         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
69676                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69677                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
69678         }
69679         void* logger_ptr = untag_ptr(logger);
69680         CHECK_ACCESS(logger_ptr);
69681         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69682         if (logger_conv.free == LDKLogger_JCalls_free) {
69683                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69684                 LDKLogger_JCalls_cloned(&logger_conv);
69685         }
69686         LDKCurrency network_conv = LDKCurrency_from_js(network);
69687         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
69688         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
69689         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
69690         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
69691         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
69692         *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);
69693         return tag_ptr(ret_conv, true);
69694 }
69695
69696 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) {
69697         LDKChannelManager channelmanager_conv;
69698         channelmanager_conv.inner = untag_ptr(channelmanager);
69699         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
69700         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
69701         channelmanager_conv.is_owned = false;
69702         void* node_signer_ptr = untag_ptr(node_signer);
69703         CHECK_ACCESS(node_signer_ptr);
69704         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
69705         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
69706                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69707                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
69708         }
69709         void* logger_ptr = untag_ptr(logger);
69710         CHECK_ACCESS(logger_ptr);
69711         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69712         if (logger_conv.free == LDKLogger_JCalls_free) {
69713                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69714                 LDKLogger_JCalls_cloned(&logger_conv);
69715         }
69716         LDKCurrency network_conv = LDKCurrency_from_js(network);
69717         void* amt_msat_ptr = untag_ptr(amt_msat);
69718         CHECK_ACCESS(amt_msat_ptr);
69719         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
69720         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
69721         LDKSha256 description_hash_conv;
69722         description_hash_conv.inner = untag_ptr(description_hash);
69723         description_hash_conv.is_owned = ptr_is_owned(description_hash);
69724         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
69725         description_hash_conv = Sha256_clone(&description_hash_conv);
69726         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
69727         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
69728         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
69729         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
69730         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
69731         *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);
69732         return tag_ptr(ret_conv, true);
69733 }
69734
69735 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) {
69736         LDKChannelManager channelmanager_conv;
69737         channelmanager_conv.inner = untag_ptr(channelmanager);
69738         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
69739         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
69740         channelmanager_conv.is_owned = false;
69741         void* node_signer_ptr = untag_ptr(node_signer);
69742         CHECK_ACCESS(node_signer_ptr);
69743         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
69744         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
69745                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69746                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
69747         }
69748         void* logger_ptr = untag_ptr(logger);
69749         CHECK_ACCESS(logger_ptr);
69750         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69751         if (logger_conv.free == LDKLogger_JCalls_free) {
69752                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69753                 LDKLogger_JCalls_cloned(&logger_conv);
69754         }
69755         LDKCurrency network_conv = LDKCurrency_from_js(network);
69756         void* amt_msat_ptr = untag_ptr(amt_msat);
69757         CHECK_ACCESS(amt_msat_ptr);
69758         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
69759         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
69760         LDKStr description_conv = str_ref_to_owned_c(description);
69761         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
69762         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
69763         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
69764         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
69765         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
69766         *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);
69767         return tag_ptr(ret_conv, true);
69768 }
69769
69770 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) {
69771         LDKChannelManager channelmanager_conv;
69772         channelmanager_conv.inner = untag_ptr(channelmanager);
69773         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
69774         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
69775         channelmanager_conv.is_owned = false;
69776         void* node_signer_ptr = untag_ptr(node_signer);
69777         CHECK_ACCESS(node_signer_ptr);
69778         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
69779         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
69780                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69781                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
69782         }
69783         void* logger_ptr = untag_ptr(logger);
69784         CHECK_ACCESS(logger_ptr);
69785         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69786         if (logger_conv.free == LDKLogger_JCalls_free) {
69787                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69788                 LDKLogger_JCalls_cloned(&logger_conv);
69789         }
69790         LDKCurrency network_conv = LDKCurrency_from_js(network);
69791         void* amt_msat_ptr = untag_ptr(amt_msat);
69792         CHECK_ACCESS(amt_msat_ptr);
69793         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
69794         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
69795         LDKStr description_conv = str_ref_to_owned_c(description);
69796         LDKThirtyTwoBytes payment_hash_ref;
69797         CHECK(payment_hash->arr_len == 32);
69798         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
69799         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
69800         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
69801         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
69802         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
69803         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
69804         *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);
69805         return tag_ptr(ret_conv, true);
69806 }
69807
69808 uint64_t  __attribute__((export_name("TS_SiPrefix_from_str"))) TS_SiPrefix_from_str(jstring s) {
69809         LDKStr s_conv = str_ref_to_owned_c(s);
69810         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
69811         *ret_conv = SiPrefix_from_str(s_conv);
69812         return tag_ptr(ret_conv, true);
69813 }
69814
69815 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_from_str"))) TS_Bolt11Invoice_from_str(jstring s) {
69816         LDKStr s_conv = str_ref_to_owned_c(s);
69817         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
69818         *ret_conv = Bolt11Invoice_from_str(s_conv);
69819         return tag_ptr(ret_conv, true);
69820 }
69821
69822 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_from_str"))) TS_SignedRawBolt11Invoice_from_str(jstring s) {
69823         LDKStr s_conv = str_ref_to_owned_c(s);
69824         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
69825         *ret_conv = SignedRawBolt11Invoice_from_str(s_conv);
69826         return tag_ptr(ret_conv, true);
69827 }
69828
69829 jstring  __attribute__((export_name("TS_Bolt11ParseError_to_str"))) TS_Bolt11ParseError_to_str(uint64_t o) {
69830         LDKBolt11ParseError* o_conv = (LDKBolt11ParseError*)untag_ptr(o);
69831         LDKStr ret_str = Bolt11ParseError_to_str(o_conv);
69832         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
69833         Str_free(ret_str);
69834         return ret_conv;
69835 }
69836
69837 jstring  __attribute__((export_name("TS_ParseOrSemanticError_to_str"))) TS_ParseOrSemanticError_to_str(uint64_t o) {
69838         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
69839         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
69840         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
69841         Str_free(ret_str);
69842         return ret_conv;
69843 }
69844
69845 jstring  __attribute__((export_name("TS_Bolt11Invoice_to_str"))) TS_Bolt11Invoice_to_str(uint64_t o) {
69846         LDKBolt11Invoice o_conv;
69847         o_conv.inner = untag_ptr(o);
69848         o_conv.is_owned = ptr_is_owned(o);
69849         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
69850         o_conv.is_owned = false;
69851         LDKStr ret_str = Bolt11Invoice_to_str(&o_conv);
69852         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
69853         Str_free(ret_str);
69854         return ret_conv;
69855 }
69856
69857 jstring  __attribute__((export_name("TS_SignedRawBolt11Invoice_to_str"))) TS_SignedRawBolt11Invoice_to_str(uint64_t o) {
69858         LDKSignedRawBolt11Invoice o_conv;
69859         o_conv.inner = untag_ptr(o);
69860         o_conv.is_owned = ptr_is_owned(o);
69861         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
69862         o_conv.is_owned = false;
69863         LDKStr ret_str = SignedRawBolt11Invoice_to_str(&o_conv);
69864         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
69865         Str_free(ret_str);
69866         return ret_conv;
69867 }
69868
69869 jstring  __attribute__((export_name("TS_Currency_to_str"))) TS_Currency_to_str(uint64_t o) {
69870         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
69871         LDKStr ret_str = Currency_to_str(o_conv);
69872         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
69873         Str_free(ret_str);
69874         return ret_conv;
69875 }
69876
69877 jstring  __attribute__((export_name("TS_SiPrefix_to_str"))) TS_SiPrefix_to_str(uint64_t o) {
69878         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
69879         LDKStr ret_str = SiPrefix_to_str(o_conv);
69880         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
69881         Str_free(ret_str);
69882         return ret_conv;
69883 }
69884